Samples
Using the environment map
MascotCapsule V3 can process sphere mapping by using a special texture for sphere mapping, when the models are specified with sphere mapping attributes.
Table of contents
1. Environment mapping
Environment mapping is a mapping method where surrounding environment is reflected on the surface of a model. Sphere mapping is a kind of environment mapping method where the 360-degree surrounding scenery is reflected on the model. There are other environment mapping methods, such as cube mapping where the 90-degree horizontal surrounding scenery and the 90-degree vertical surrounding scenery are reflected on the model, respectively.
2. Specifying the environment map setting
Use the following procedure to specify the environment map setting:
Specify TEXTURE_TYPE_SPHEREMAP as an argument in the IMICRO3D_Texture_loadBmpData() method to load the texture.
Use the IMICRO3D_Render_setSphereTexture() method to set a texture for sphere mapping in Render.
Specify M3D_SPECULAR as an argument in the IMICRO3D_Render_setAttribute() method to specify the environment attribute.
Also, it is necessary to enable the lighting to enable sphere mapping. To do so, please refer to Lighting in BREW - MascotCapsule V3 samples for details of lighting setting.
Once specified, the environment attribute will be retained unless it is replaced by other attributes.
Let's take a look at the following sample code:
IMICRO3D_Texture_loadBmpData( pMe -> pIM3D,
( IIstream* ) FileIstream_getIIstream( &fis ),
TEXTURE_TYPE_SPHEREMAP );
/* Sphere map setting */
IMICRO3D_Render_setSphereTexture( pMe -> pIM3D,
&pMe -> mc_data.texture [ 1 ] );
* Sphere map setting by the key check */
if ( ( mask & SOFT2_MASK) != 0 )
{
IMICRO3D_Render_setAttribute( pMe -> pIM3D,
pMe -> mc_data.attr | M3D_SPECULAR | M3D_LIGHTING );

Sphere mapping enabled ( left ), disabled ( right )


