On 25-Jul-05, at 7:50 PM, Lo Saeteurn wrote:
Basically what I'm confused about is: if I use the New Trimesh
(existingtrimeshdata) to construct a new trimesh, does it create a
copy of everything (points, triangles, edges, etc.) or does it just
reference all the items?
Trimesh data is mostly just pointers to other blocks of data (look up
TQ3TriMeshData in the Quesa API reference). When you create a new
trimesh using an existing data set, you're just copying pointers for
the points, uvs, normals (etc). You're not actually making a copy of
the vertexes.
Is the object handle pretty much the pointer? If not, how do I
get an object handle from this custom trimesh?
Trimesh3D.GetHandle will give you the Quesa object handle if you
need it for custom declares.
Okay, but what I meant was what if I create it completely from
scratch:
//tmsh is an existing trimesh
dim tmsh as Trimesh3D
dim mem1, mem2 as memoryblock
mem1=tmsh.GetData
mem2=NewMemoryBlock(tmsh.kDataSize)
mem2.StringValue(0,mem2.Size)=mem1.StringValue(0,mem2.Size)
mem2.Ptr(tmsh.kOfsPoints)= NewMemoryBlock(NumberOfPoints*12)//
copy the points here
mem2 is the new trimesh and also a memoryblock, how do I add it to
a display group?
mem2 isn't a trimesh, it's trimesh *data* - GetHandle and GetData are
two totally different things. GetHandle returns a pointer to an
opaque TQ3GeometryObject (that's what you use to add it to a display
group) and GetData returns a copy of a TQ3TriMeshData struct, but the
actual vertex data is somewhere in the bowels of Quesa, unless you
made and assigned it yourself from scratch like you do with the
points above.
If you're using the Quesa Wrappers for display groups you don't need
GetHandle - just add objects directly to groups:
displayGroup.AddObject tmsh
This is assuming that calling "New Trimesh" copies all the data
including the points, triangles, etc. If it references these, I
should have no problem keeping just the Vertices locally.
See above - it just copies references.
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>
|