Public Attributes
xsimrParticleShape Struct Reference
xsimrCurveExtrapolation Enum

## Detailed Description

Particle shape structure.

The data pointed to by each data tag is a flat list of particle attributes for each particle in the cloud. The size of each attribute entry is dependent upon the parameter type in xsimrAttributeData::type.

See also:
  xsimrParticleShapeType, xsimrAttributeData, xsimrPointCloudData

Since:
  7.0

Example:
  Example for how to use the particle data structure:

              xsimrPointCloudData *findParticleData( miState *state )
              {
                  if( state->instance == miNULLTAG )
                      return( NULL );

                  // Get the item tag and the item’s userdata block tag.
                  miTag       object_tag;
                  mi_query(miQ_INST_ITEM, NULL, state->instance, (void *)&object_tag);

                  if( object_tag == miNULLTAG )
                      return ( NULL );

                  miTag       data_tag;
                  mi_query(miQ_OBJ_DATA, NULL, object_tag, (void *)&data_tag );

                  while( data_tag )
                  {
                      miUint      label = 0;

                      mi_query( miQ_DATA_LABEL, NULL, data_tag, &label );

                      if( label == XSIMR_POINTCLOUDDATA_LABEL )
                      {
                          xsimrPointCloudData     *data_ptr = NULL;

                          mi_query( miQ_DATA_PARAM, NULL, data_tag, (void *)&data_ptr );

                          if( data_ptr->version != XSIMR_POINTCLOUDDATA_VERSION )
                          {
                              mi_error( "Unsupported point cloud data version (%d.%d)", data_ptr->version >> 16, data_ptr->version & 0xFFFF );
                              return( NULL );
                          }

                          return( data_ptr );
                      }

                      mi_query(miQ_DATA_NEXT, NULL, data_tag, &data_tag);
                  }
                  return( NULL );
              }

              static void *findAttribute
              (
                  xsimrPointCloudData *data_ptr,
                  const char      *name_wanted,
                  xsimrAttributeType type_wanted,
                  miBoolean       *is_constant
                  )
              {
                  for( int i = 0; i < data_ptr->n_data; i++ )
                  {
                      xsimrAttributeData  *attrib_ptr = &data_ptr->attributes[ data_ptr->i_data + i ];
                      const char*      attrib_name = (const char *)mi_db_access( attrib_ptr->name );
                      mi_db_unpin( attrib_ptr->name );

                      if( _stricmp( attrib_name, name_wanted ) == 0 &&
                          attrib_ptr->type == type_wanted )
                      {
                          void    *attrib_data_ptr;

                          *is_constant = attrib_ptr->constant;

                          mi_query( miQ_DATA_PARAM, NULL, attrib_ptr->data, &attrib_data_ptr );

                          return( data_ptr );
                      }
                  }

                  return( NULL );
              }

              // Get position vector and "size" attribute from cloud
              void get_my_data
              (
                  miState         *state,
                  miVector        **pos_ptr,
                  miScalar        **radius_ptr,
                  miBoolean       *radius_const
                  )
              {
                  xsimrPointCloudData *data_ptr;

                  data_ptr = findParticleData( state );
                  if( !data_ptr )
                      return;

                  // Get the position vector.
                  mi_query( miQ_DATA_PARAM, NULL, data_ptr->positions, (void *)pos_ptr );

                  findAttribute( data_ptr, "Radius", xsimrATTRIBUTE_SCALAR, radius_const );
              }

`#include <xsi_miuserdata_defs.h>`

List of all members.

## Public Attributes
xsimrParticleShapeType | type
miInteger | instance_id

## Member Data Documentation

xsimrParticleShapeType type

The particle shape type.

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

- xsi_miuserdata_defs.h