[Papervision3D] Creating triangles dynamically - not rendering
corey at coreyoneil.com
Sat Mar 29 08:15:37 PST 2008
I'm working on my first project w/ PV3D (Great White), and am expecting to
hit a few bumps along the way as I get acclimated w/ the library. :)
I'm trying to create triangles in a loop and then push them onto an array
for future access. Everything works properly, except only the last triangle
appears on the screen. If I trace the render stats, it shows all of my
triangles are in the scene. I'm guessing it has to do with how/when I'm
setting each triangle's geometry's ready status, but could use a hand.
Here's the applicable code in the loop. The vertices and UV coords are set
prior to the loop.
for(var i:uint = 0; i < 50; i++)
var triangle:TriangleMesh3D = new TriangleMesh3D(material, , );
triangle.geometry.vertices.push(v0, v1, v2);
triangle.geometry.faces.push( new Triangle3D(triangle, new Array(v0, v1,
v2), material, new Array(uv1, uv2, uv3)) );
triangle.geometry.ready = true;
// Some math that moves each triangle to different parts of the stage
// Works no problem - I can trace x, y, z of each triangle later and
shows they're all over
I first set all of this up using planes instead of triangles, and all was
well, so I'm guessing the issue is with the ready status of each instance's
geometry. Like maybe the previous triangles lose their status as the next
one is created. Can anyone point me in the right direction?
View this message in context: http://www.nabble.com/Creating-triangles-dynamically---not-rendering-tp16371659p16371659.html
Sent from the Papervision3D mailing list archive at Nabble.com.
More information about the Papervision3D