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.
If I simply clone the Object3D and change only the Point reference to
point to another memoryblock (ptr), would that work? When I did this,
it crashes when the memoryblock goes out of scope via RB's garbage
collector. I solved this by storing it locally, but the Points in the
Trimesh seems to still be shared across multiple objects. I think the
problem is that the Trimeshes were the same for all objects so
changing the reference of the Points affected all.
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.
I can't seem to even duplicate the Shape data correctly. The
trimeshes comes out as a mess when rendered. I know I'm doing
something wrong, but I don't know what. Even appending the existing
Trimesh3D object (not the duplicate one) does the same thing so I
must be using the display group incorrectly.
I can't thank you enough for your help. Now if I could only find what
is wrong with how I'm using the display groups, I should be set. I'll
read more into your documentation to see if I can find the problem.
Dim status,i,c as integer
dim data,dataPtr,mem as MemoryBlock
dim dg as DisplayGroup3D
Dim tmshes(0),tmsh,obj As Trimesh3D
tmsh = self.GetFirstTrimeshInShape(0)
if tmsh <> Nil then
do
tmshes.Append tmsh
tmsh = self.GetNextTrimeshInShape(0, tmsh)
Loop until tmsh = Nil
end if
dg=new OrderedDisplayGroup3D
c=UBound(tmshes)
for i=1 to c
tmsh=tmshes(i)
obj=new Trimesh3D(tmsh.GetData)
dg.AddObject obj
next
_______________________________________________
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>
|