The parse method will take a NULL terminated argument list and parse attributes using a very simple heuristic. Attributes are specified by a name/value pair. The name includes binding class, storage and tuple size information (possibly type information). The value is an array which contains enough data to represent the data. A copy of the data is made.
The name consists of several parts: Binding Class The binding class is one of:
detail
, constant
a single value shared over all primitives
primitive
, uniform
a value for each primitive
point
, varying
a value for each shared point
vertex
, facevarying
a value for each vertex Storage Class
int32
, int
A 32 bit integer
int64
, long
A 64 bit integer
real16
, fpreal16
, float
A 16 bit float
real32
, fpreal32
, float
A 32 bit float
real64
, fpreal64
, double
A 64 bit float
point16
, point
A 16 bit position value (3-tuple)
point32
, point
A 32 bit position value (3-tuple)
point64
,
A 64 bit position value (3-tuple)
vector16
, vector
A 16 bit direction vector value (3-tuple)
vector32
, vector
A 32 bit direction vector value (3-tuple)
vector64
,
A 64 bit direction vector value (3-tuple)
normal16/32/64
, normal
A 16/32/64 bit normal vector value (3-tuple)
color16/32/64
, color
A 16/32/64 bit color value (3-tuple)
matrix32
A 32 bit transformation matrix (16-tuple)
matrix64
, matrix
A 64 bit transform matrix (16-tuple)
string
An array of chars (i.e. const char *) Array Size Optionally, an array size can be specified by using [size]
notation. Please note that a "point32[3]" would require 9 fpreal32 values per array entry.
For example:
"vertex float uv[2]",
uv,
"constant matrix xform", xform);
It is possible to pass in the same GT_AttributeBuilder for different binding classes. For example, for a GT_PrimSphere, you might have something like:
parse(detail, detail, detail, detail, ...);
which will build all attributes in the same builder (detail
) If a variable is specified multiple times, the value will be used for multi-segment motion blur. At the current time, all variables which have multiple segments should have the same number of segments specified. It is not necessary to specify segments for all variables, only ones which change over time. For example
"vertex point P", P0,
"vertex point P", P1,
"vertex normal N", N0,
"vertex normal N", N1,
"vertex float uv[2]",
uv,
"constant matrix xform", xform);