On Dec 8, 2006, at 11:15 PM, Craig M. wrote:
I want to clone an object3D's subclass, but change their material
(just color in this case) independently. It appears I can not use
clone, but I can not find any way to copy the geometry. I can copy
everything else I need (properties and such), but not the actual
geometry.
What can I do?
That's how cloning works.
If your model has only one trimesh in it, (to quote Joe Strout:)
"So, to clone a TriMesh, you would make a new TriMesh, set its number
of vertices and triangles and such to the same as your original, and
then call Copy on the VertexPositions, VertexNormals, Triangles,
VertexColors (if applicable), and VertexUVs (ditto)."
Now you can change the Material on that Trimesh.
Another way you can make a copy is to reload the model each time you
need a new instance and then change that instance's material (or
materials if you have several textures in your model) after loading.
This is done for Zombies (source at: http://www.codenautics.com/
zombies).
So in both cases, you'd need to create a New Object3D for each copy,
thus ensuring that they don't have any vertices and materials in
common. Note that changing materials on an object can be slow.
==
Jeff Quan
jquan at mindspring dot com
http://www.jcquan.com/JQportfolio
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|