|
From: Dair G. <da...@re...> - 2004-06-16 01:08:13
|
Keith Wiley wrote:
>>If so, I would guess that the array is twice as long as
>> the number of vertices in the object, one U and one V coordinate per
>> vertex. Is that right?
>
>Actually, I'm studying the online PDF "Making Cool QuickDraw 3D
>Applications" and it looks like the attributes array is the same
>length as the number of vertices, which each element being a 2D UV
>coord.
That's correct (i.e., the second statement). There are really two counts
involved:
TQ3Uns32 numTriangleAttributeTypes;
TQ3TriMeshAttributeData *triangleAttributeTypes;
TQ3Uns32 numEdgeAttributeTypes;
TQ3TriMeshAttributeData *edgeAttributeTypes;
TQ3Uns32 numVertexAttributeTypes;
TQ3TriMeshAttributeData *vertexAttributeTypes;
The "numFooAttributeTypes" fields indicate the number of
TQ3TriMeshAttributeData structures pointed to by the corresponding
"fooAttributeTypes" field.
Each TQ3TriMeshAttributeData points to a block of data of some type and
a block of TQ3Uns8-sized flags indicating the validity of the entries in
the data.
The size of those blocks comes from the numTriangles/numEdges/numPoints
fields as appropriate (e.g., the size of the data in one of the items
pointed to by the triangleAttributeTypes field is numTriangles * N).
The size of N, the data stored in each entry withn the data block,
varies depending on the attribute type - TQ3ColorRGB, TQ3Vector3D,
TQ3Param2D, etc.
So for the UV case, if one of the entries in the vertexAttributeTypes
array was to hold the UVs then the data field in that entry would be an
array of TQ3Param2Ds.
If numPoints were 5, there would be 5 TQ3Param2Ds pointed to by that
data field: there may actually be <5 valid entries (as controlled by the
flags array, if present) but there must be enough space for 5 as the
array is just cast to the appropriate type and walked through.
-dair
___________________________________________________
mailto:dair+refnum.com http://www.refnum.com/
|