Ninja Library - Model Function

njSetConstantMaterial

Sets model materials

FORMAT

void njSetConstantMaterial( *argb )
NJS_ARGB *argb

PARAMETER

 argb  Material data  

RETURN

None

DESCRIPTION

Specifies model material data. Value set in argd parameter is between -1.0f and +1.0f. Unless njControl3D() function is specified, initial value is undefined without a value to refer.

Effective when NJD_CONTROL_3D_CONSTANT_MATERIAL or NJD_CONTROL_3D_OFFSET_MATERIAL is specified for njControl3D() function.

Model drawn using specified material when NJD_CONTROL_3D_CONSTANT_MATERIAL is specified.

When NJD_CONTROL_3D_OFFSET_MATERIAL is specified, drawing performed by adding specified material to model data material. Additionally, the color operation of sprite drawing is used.


EXAMPLE

The following displays semitransparent model.

sbInitSystem( NJD_RESOLUTION_640x240_NTSCNI, NJD_FRAMEBUFFER_MODE_RGB565, 1 );
njInitVertexBuffer( 500000, 0, 10000, 0, 0 );
njInitMatrix( matrix, 128, 0);
njInit3D( vbuf, 4096 );
njInitView( &view );
njCreateLight( &light, NJD_DIR_LIGHT );
njSetView( &view );
njControl3D( NJD_CONTROL_3D_OFFSET_MATERIAL );
njSetConstantAttr( 0xFFFFFFFF, NJD_FLAG_USE_ALPHA) 
/* When semitransparent model is not set */
argb.a = -0.5f;
argb.r = 0.f;
argb.g = 0.f;
argb.b = 0.f;
njSetConstantMaterial( &argb );
while(1) {
 njClearMatrix();
 njTranslate( NULL, 0.f, 0.f, -10.f );
 njRotateXYZ( NULL, xx,yy,zz );
 njDrawModel( model );
 xx += 257;
 yy += 179;
 zz += 193;
 njWaitVSync();
}

REFERENCE

njInit3D()
njControl3D()
njDrawModel()
njDrawObject()
njDrawSprite2D()
njDrawSprite3D()

njSetConstantMaterial
COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999