Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Cursor location for crosshair
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Zren




PostPosted: Mon Nov 14, 2011 3:55 pm   Post subject: RE:Cursor location for crosshair

code:

numPolys
polyType or polyNumVertices
poly1vertice1.x
poly1vertice1.y
poly1vertice1.z
poly1vertice2.x
poly1vertice2.y
poly1vertice2.z
poly1vertice3.x
poly1vertice3.y
poly1vertice3.z
polyType or polyNumVertices
poly2vertice1.x
...


code:

2
triangle
0.0 0.0 0.0
1.0 0.0 0.0
0.0 1.0 0.0
triangle
...


world -> models
model -> mesh
mesh -> polygons
polygon -> vertices

model -> loadMesh("model.txt")

A vertice in world space would be:
x = model.pos.x + vertice.x * model.width

So all values of vertices would be in the range -1.0 .. +1.0 so we can scale them nicely.

Also, if you know the entire mesh is made of triangles, you could skip those lines. Generally these types of files are in binary and not text, but unless your write an editor for your filetype, it's generally easier to just use text as the filesize + ease of use trumpts the load speed. Also, if your also bound to a single polygon type, you can skip the first line (numPolygons) as it's a constant amount of vertices to read, so you can just parse to EOF.

If you want to know standard mesh filetype, look them up at http://en.wikipedia.org/wiki/Polygon_mesh
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 16 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: