Samples

Switching the pattern using dynamic polygons

MBAC data can contain multiple patterns.




Use the IMICRO3D_Figure_setPattern() method in order to specify the model pattern for the Figure structure. The number of patterns within the model data is determined when the data is created. Use the IMICRO3D_Figure_getNumPattern() method in order to obtain the number of patterns.

There is a maximum of 33 model patterns including a common set. Assume each pattern as a bit in a 32-bit data ( the common set is 0 ), and then pass it in the IMICRO3D_Figure_setPattern() method.
This sample has four appearance patterns including the common set as follows:

The rendering output becomes as described below:

SampleDynamic3D screenshots Pattern 1 SampleDynamic3D screenshots Pattern 2 SampleDynamic3D screenshots Pattern 3
SampleDynamic3D screenshots ( from the left: Pattern 1, Pattern 2, and Pattern 3 )



If the model has multiple independent appearance patterns, multiple portions can be simultaneously moved, for example, by specifying the method as follows:

IMICRO3D_Figure_setPattern ( ( ( 1 << 1 ) | ( 1 << 5 ) ) )

/* Appearance pattern setting and changing by the key check */
if ( ( mask & ACTION_MASK ) != 0 )
{
pMe -> mc_data.pattern++;

if( pMe -> mc_data.pattern >= pMe -> mc_data.maxpat )
{
pMe -> mc_data.pattern = 0;
}

/* Specifying the model pattern */
if( pMe -> mc_data.pattern == 0 )
{
IMICRO3D_Figure_setPattern( pMe -> pIM3D, &pMe -> mc_data.figure, 0 );
}
else
{
IMICRO3D_Figure_setPattern( pMe       -> pIM3D,
  &pMe      -> mc_data.figure,
  1 << pMe -> mc_data.pattern );
}
pMe -> key_mask = 0;
}


Page TopBack