|
From: Roger H. <rog...@mi...> - 2004-06-15 17:17:31
|
Actually the vertex array is transformed when rendered, but every vertex gets the same transformation applied to it to give world coordinates. The TriMesh has many arrays, one for vertices, one for edges, one for triangles and also ones for attributes which can be attached to any of those. To combine two trees you need to double up the sizes of each of these arrays and fill out all the values. For the vertices you will need to apply a translation only, unless you need to scale as well for large trees and small trees. Of course you also might like to rotate them about the vertical axis or even lean them over a bit at the same time. For the triangles, they hold the indices of the vertices, so the second tree would need to add the original count of the number of vertices so that it picks up the second set instead of the first set. Similarly for the edges. The attribute arrays just need replicating as I presume any colours etc would remain the same. Roger. On Tuesday, June 15, 2004, at 03:27 pm, Keith Wiley wrote: > I don't see how I can do this with one TriMesh for the following > reason. In the debugger I have observed that the TriMesh has an array > of 3D points, clearly the vertices. However, these points are not a > global definition which is then translated, rotated, and scaled at the > time of rendering. The points store such changes, so there doesn't > seem to be anyway for one TriMesh to refer to two trees that are next > to each other since the points need to be in different locations. > > What's going on here? How do I combine them in that way? > > Roger Holmes wrote: > >> You would probably want something more along the lines of one TriMesh >> for all the >> brown tree trunks/branches and another for all the green foliage. >> >> >> On Tuesday, June 15, 2004, at 06:35 am, Keith Wiley wrote: >> >>> >>> Okay, I see. So, if in Meshwork I create a tree, then copy and >>> paste it next to the original tree so I have two separate trees, >>> with totally unconnected vertices, I can save the entire thing not >>> only as a group (which doesn't do much) but as a single "object" >>> even though it is clearly physically two separate objects. >>> >>> And likewise, I could take individual trees after opening them into >>> the program and combine them into a single object. Right? I'll >>> study the trimesh code. I guess what would be nice is to only have >>> the trimesh stored once and then specify that it is simply placed in >>> the world multiple times. Is that on the right track? >> |