Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: exporting vertice and edge data  (Read 17922 times)

DeveloperX

  • Newbie
  • *
  • Posts: 5
    • View Profile
exporting vertice and edge data
« on: April 10, 2008, 04:08:31 am »

Hello.

I've been reading sample scripts and the language spec sheet, and I'm having difficulties locating the information that I'm looking for. Perhaps I'm overlooking it, but after 5 hours of looking and getting nowhere, I am turning to the community, as I guess someone here can help me out.

I want to export the vertex coordinates and the edge indices of the current object to a text file.

If anyone would be so kind as to point me in the right direction as to how to do this, I'd be very grateful.
Thanks.
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: exporting vertice and edge data
« Reply #1 on: April 10, 2008, 10:51:18 am »

On the Scripts page of the site under Object Export Plug-Ins,
you'll find an obj exporter.Study it with the help of the spec.
It exports vertices,indices of the points making the face edges
and a lot more.You'll have to remove what you don't need.
Logged

DeveloperX

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: exporting vertice and edge data
« Reply #2 on: April 10, 2008, 03:06:47 pm »

Thanks for your quick reply.
I reread the obj exporter, and the spec.

None of the exported file types give me the data I need expcet for the saved an8 format.

My model has no faces, its only vertices and edges.

I know this sounds dumb, but the engine that I am working with is wireframe only.
Again I know this sounds like a stupid idea, but just bear with me on this.

If I export my model as obj I get only the vertices coordinates in the obj file.
When I save my model as an8 it shows the edge indices that I need.

I have been trying to write a routine to read the edge and vertex data from the an8, but I've had no luck with that.

Can someone tell me how to export the edge data from my anim8or mesh object model with ASL?

I cannot seem to find the right command.
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: exporting vertice and edge data
« Reply #3 on: April 10, 2008, 04:04:17 pm »

Now.I understand.
Problem is that ASL doesn't let you access orphan edge data at the moment.
You're  limited to edge part of faces.

If your mesh is closed.meaning that no edge end is unconnected,then
you could create faces in Anim8or.This would not change the way it looks
in wireframe view and it would allow you to export a list of vertex and
a list of index couple for the edges.Going thru the list of face,you could
mark the edges so you you don't double them.

If not,you'll have to continue working on your An8 file parser.


Logged

DeveloperX

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: exporting vertice and edge data
« Reply #4 on: April 10, 2008, 04:40:10 pm »

Aww....dangit!  :-\

I don't quite understand how to get the edge data from the face data, so I guess I'm stuck working on ripping the data from the an8.

Well, thanks for letting me know that ASL cannot do what I want yet.
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: exporting vertice and edge data
« Reply #5 on: April 10, 2008, 11:36:33 pm »

Getting the edge data from the face data shouldn't be that difficult.

With this function
int GetFacePointIndex(int faceIndex, int vtxIndex);
you can get the vertex index of all the points of the face.
An edge is defined by 2 points.
The first and second index define the first edge.Second and third define
the second.You go on like this up to the last edge defined by the last
and first vertex.

Make sense?
Logged

Steve

  • Administrator
  • Hero Member
  • *****
  • Posts: 2126
    • View Profile
Re: exporting vertice and edge data
« Reply #6 on: April 11, 2008, 07:45:58 pm »

Yes, there is a GetNumPoints() call and a GetPoint() call which allow you to enumerate all of the points, but there is no GetNumEdges() or GetEdge() call.  I have a batch of these and other functions that were missed in the original ASL release almost ready to make available.

The GetEdge() call is (will be) done with GetEdgeIndex0(int edgeIndex) and GetEdgeIndex1(int edgeIndex) to get the point number and GetEdgePoint0/1() to return the value of the vertex because GetEdgeIndex() is already defined to return the edge within a face.

With luck the next v0.97 preview will be ready in a week or so.  Without luck it will be a week or so into May because I'll be out of town.
Logged

DeveloperX

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: exporting vertice and edge data
« Reply #7 on: April 12, 2008, 02:08:25 am »

Steve: Awesome! I'll just wait it out then. I'm in no rush, and this parser is kicking my behind :P
I'm close, but still no cigar. I toyed with the ASL options available, and I just could not find a way to pull the data I wanted from it. So, yeah I'm just going to wait for the next release that will (or should) have the functionality I need.

Also, in case you don't remember me, I've been a user of anim8or since the first release that you posted, and I've loved it ever since. :)
Logged

DeveloperX

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: exporting vertice and edge data
« Reply #8 on: April 13, 2008, 12:01:24 am »

Well, I got an idea to get the data; and guess what? It worked!

So, my parser is working perfectly, I wrote the parser/converter in java in about 2 hours.

I'm so happy about this. Now I can make my models in anim8or and use them in my engine without any problems (that I can forsee..haven't tried converting anything complicated, just a 6 sided cube model)
I think it should be fine though, nothing is hardcoded that should break it.

I still can't wait for the latest and greatest installment of anim8or. :D
Logged