User Data
data "name"
[ tag labelint ]
bytecountint [ bytes list ]
data "name"
[ tag labelint ]
"filename"
data "name"
[ tag labelint ]
declaration_name ( parameters )
User data is arbitrary data stored in the scene file, which can
be passed to shaders as a shader parameter of type data.
This is useful for large amounts of data that is shared by several
shaders, or too large or complex to be defined with individual
shader parameters. There are three ways to define user data:
- as a raw byte list. The list is a sequence of hexadecimal byte
strings, each consisting of pairs of digits in the range 0..f, and
enclosed in single quotes. Each string can be no longer than 1024
bytes (2048 digits); if this is not sufficient more strings must
follow. Note that the angle brackets must be in the scene file
literally. The bytecount is the total byte count in the
square brackets, regardless of how many quoted strings it is split
up into.
- as a file name. The file will be opened and its binary contents
are read into memory.
- as a structured parameter list. This is the only user data type
that will be properly byte-swapped if used on a network of hosts
with different byte orders. The parameter definition works exactly
like the definition of shader parameters, and also need to be
declared in the same way except that the declaration begins with
"declare data" instead of "declare shader".
Shaders see a tag if they evaluate a parameter of type
data. This tag can be accessed with the
mi_query modes miQ_DATA_*,
especially miQ_DATA_PARAM for accessing the data payload,
and miQ_DATA_NEEDSWAP for determining if a raw byte block
(the first two data definition methods) need swapping by the
shader. Note that the result returned by miQ_DATA_PARAM
must be cast to the appropriate data type.
Copyright © 1986-2009 by
mental images GmbH