|
From: Keith W. <kw...@cs...> - 2004-08-03 19:00:25
|
On Tue, 3 Aug 2004, James W. Walker wrote: > Keith Wiley <kw...@cs...> wrote: > > >What I get in the debugger is unique addresses for the two shaders, but > >the same address for the two textures. So copying the trimesh data > >creates a second new shader, but only copies a pointer or reference to the > >texture. I am right so far, right? > > That should not be the case. Duplicating a texture shader also > duplicates the textures. The CVS log shows that it has been so since > Feb. 26 2003. Dammit, you're right of course. I accidentally got the shaders from each trimesh and then got the textures from the shaders, but, oops, got it from the same shader both times. So my debugging code had a bug. :-) Ah me. Well, at least that explains some things. Like I said, I'm getting multipled copies in the profiler. So now I need to figure out how to copy a trimesh and copy its REFERENCES to shaders and textures. I'll chew on that one for a while. Ultimately what I'm doing, if you're curious, is creating one prototype tree object for a forest, and then copying it dozens of times to make individual trees. I want them all to link back to the same texture of course. Someone mentioned that I could avoid copying the meshes by using transofmr objects but I am intentionally unioning the meshes of any given terrain tile into a single large mesh so as to reduce the number of objects in the world. As a result of this, each "object" for a tree species is actually several trees located in various locations on a given terrain tile. Since the placements of the trees in a tile are random, each tile has an object with a unique geometry, so the transform object approach won't work, I need to make copies of the trees so I can union their trimeshes...but I still want them to all use just one texture for all the objects on all the tiles. ________________________________________________________________________ Keith Wiley kw...@cs... http://www.unm.edu/~keithw http://www.mp3.com/KeithWiley "Yet mark his perfect self-contentment, and hence learn his lesson, that to be self-contented is to be vile and ignorant, and that to aspire is better than to be blindly and impotently happy." -- Edwin A. Abbott, Flatland ________________________________________________________________________ |