xsimrAttributeData Struct Reference
 
 
 
xsimrAttributeData Struct Reference

#include <xsi_miuserdata_defs.h>


Class Description

A structure containing the information for a single attribute.

Each attribute has a name and a type. The tag points to a miUserdata blob that contains a flat array of xsimrPointCloudData::nb_particles attribute values.

Note:
If the xsimrAttributeData::constant flag is miTRUE, then all the attribute entries are the same value and therefore only the first attribute entry is valid to conserve space.
See also:
xsimrAttributeType, xsimrPointCloudData, xsimrParticleShape
Since:
7.0
Example:
Example demonstrating how to use the xsimrAttributeData structure
                miScalar getSizeAtIndex( siParticleAttribute *attr, miUint pid, miUint index )
                {
                        miUserdata              *data_ptr;
                        miScalar                *size_ptr;
                        miScalar                result;

                        if( index >= attr->count )
                                index = attr->count - 1;

                        data_ptr = (miUserdata *)mi_db_access( attr->tag );
                        size_ptr = (miScalar *)&data_ptr->parameters[ 0 ];
                        if( attr->constant )
                                result = size_ptr[ 0 ];
                        else
                                result = size_ptr[ pid * attr->count + index ];

                        mi_db_unpin( attr_size->tag );

                        return( result );
                }

List of all members.

Public Attributes

miTag  name
xsimrAttributeType  type
miBoolean  constant
miUint  size
miTag  offsets
miTag  data
miTag  blob_type

Member Data Documentation

miTag name

The name of the attribute. The name is case-insensitive.

The value type of the data. See xsimrAttributeType for which mental ray native data types each enumeration type maps to.

miBoolean constant

The constant flag of the data. If all the values of an attribute are the same, then the data is considered to be constant and only one value is stored, which should be used for all points in the cloud. In case of arrays, the same array is used for all points, rather than all values of the array being the same.

Note:
If this value is miTRUE then the userdata blob pointed to by xsimrAttributeData::data will contain only a single value, or a single array of values, and xsimrAttributeData::offsets, if defined, will contain only two indices.
miUint size

The size of the data type in bytes. This is equal to the result of the sizeof operator on the mental ray data type used to store the data (see ::siParticleAttributeType).

miTag offsets

The userdata tag for the array offset indices of type miUint32. If the data is an array of arrays, then this index list will give the index into the data list for the given particle. This list is one entry larger than the number of particles so that the length can always be calculated by ( offset[ id + 1 ] - offset[ id ] ) for each particle. If the data is constant, and that data is an array of arrays, then this list will contain two entries.

miTag data

The userdata tag to the actual value data storage. If the xsimrAttributeData::offsets tag is an miNULLTAG then there is only one single value per particle. Otherwise the data comes in contiguous value chunks for each particle, and the contents of the offsets data can be used to index into it for each particle.

miTag blob_type

A tag to a string that contains the blob type name if the type field is set to xsimrATTRIBUTE_BLOB. For any other type, it is left as a miNULLTAG.

Since:
2010 (8.0)

The documentation for this struct was generated from the following file: