View previous topic :: View next topic |
Author |
Message |
Deformative
Joined: 27 Jan 2007 Posts: 13
|
Posted: Sun Feb 04, 2007 8:50 pm Post subject: yage.resource.model |
|
|
I am confused on how to use this class. It doesn't appear to accept more than 4 vertices. If you could provide a detailed explanation on how to use this module I would appreciate it.
From SpriteNode I have learned a bit, but hardly anything. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
JoeCoder
Joined: 29 Oct 2005 Posts: 294
|
Posted: Mon Feb 05, 2007 11:41 am Post subject: |
|
|
You can bascially call addVertex() multiple times to add as many as you need. Models have an array of meshes, which in turn each have a material and arrays of triangles. Each triangle stores the indexes of three vertices of the model needed to define that triangle. Having the data in this format reduces the amount of memory a model consumes and also allows optimal rendering speed for OpenGL VBO's.
In the latest svn, take a look at yage.system.render.Render.generate(). It generates a cube using only Model's public methods. node.graph.graphNode also uses model, but via its fields. Perhaps resource.model could use a better interface (and certainly better documentation). I'll put that next on my list and maybe even get to it this evening. I'll keep you posted.
As for SpriteNode's use of Model, that has now been refactored into yage.system.redner as well. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|