On 24-Jul-05, at 7:00 PM, Lo Saeteurn wrote:
I don't know how you're creating trimeshes though - you really
need to make them from scratch to ensure the data is yours and not
just a copy you got from Quesa.
I'm working on this part right now. I'm still trying to learn how
to use the Quesa Wrappers.
Here's what I have so far. I'm basically just trying to clone the
Object.
//GetTriMesh returns the pointers to all the Trimeshes
dim dis as DisplayGroup3D
dim t,t2 as Trimesh3D
Dim tmshes(0),i,c as integer, mem as MemoryBlock
GetTriMesh(GetShapeHandle(mShape),tmshes)
dis=new DisplayGroup3D
c=UBound(tmshes)
for i=1 to c
t=new Trimesh3D(tmshes(i))
mem=t.GetData
t2=new Trimesh3D(mem)
dis.AddObject t2
next
Addshapefromhandle dis.GetHandle
Here's where Quesa gets all convoluted...
The GetData call will create a copy inside Quesa of all the vertex
data inside the trimesh (points, triangles, uvs, etc.). It doesn't
copy the attribute set or textures however - it only grabs a
reference to that stuff. So "t2" will be a copy of "t", with it's own
points, triangles, uvs, (etc.), but it will share the same attribute
set and texture shader.
Although it should be easy enough to share triangle indices with a
couple Trimesh3D Lock/Unlocks and a pointer assignment it will be
more difficult to share texture UV's since they're mashed in with
normals and other crap inside the vertex attribute lump. You can
thumb through the Trimesh3D class source to see how to get a
particular vertex attribute data pointer, but if you get stuck I can
try to walk you through it (honestly I've forgotten how it all
works!) Alternately you can just live with the extra triangle and UV
copies in the clones - at least the textures will be shared.
Frank.
–––––––––––––––––––––––––––––––––
Open Source RB Goodies and Shareware
<http://developer.chaoticbox.com/>
<http://www.chaoticbox.com/>
–––––––––––––––––––––––––––––––––
_______________________________________________
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>
|