realbasic-games
[Top] [All Lists]

Re: Cloning Trimesh

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Cloning Trimesh
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Tue, 8 Nov 2005 09:06:51 -0700
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <14e78666b84e09bd1739f7ef5e4a01b6 at pyramiddesign dot us>
At 10:40 AM -0500 11/8/05, Joseph Nastasi wrote:

So, I built  a trimesh that I need to replicate. Can I clone it?

Yes, though it takes a few steps. Each of the group accessor classes (VectorList, TriangleList, and so on) has a Copy method. 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).

I tried to cast the trimesh as an Object3D and use the clone method, but it said the cast was illegal.

That's right.  Object3D and TriMesh both derive from Element3D; they are peers.

Best,
- Joe

--
Joe Strout                          REAL Software, Inc.

Vote for REALbasic (twice!) in the LinuxWorld Reader's Choice Awards:
http://linux.sys-con.com/general/readerschoice.htm
_______________________________________________
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>

<Prev in Thread] Current Thread [Next in Thread>