Ninja Library - Light Function

njCnkSetAmbient

Sets the ambient color for the chunk model

FORMAT

void njCnkSetAmbient( red , green , blue )
Float red
Float green
Float blue

PARAMETER

 red  Red light source 
 green  Green light source 
 blue  Blue light source 

RETURN

None

DESCRIPTION

Sets the light source color using the three primary colors. 1.f stands for 100%. By default, all components are 100% (white). Brightness must be calculated as 100%. For example, when the R component is set to 1.f, 255 (for 8 bit) is entered as is.

EXAMPLE

	:
void
UserInit(void)
{
	sbInitSystem( NJD_RESOLUTION_640x240_NTSCNI, NJD_FRAMEBUFFER_MODE_RGB565, 1 );
	njInitVertexBuffer( 1000000, 0, 1000, 0, 0 );
	njInitMatrix( matrix, 8 , 0);
	njInit3D( vbuf, 4096 );
	njInitView( &view );
	njSetView( &view );
	njCreateLight(&light, NJD_SPEC_DIR);
	njSetLightColor(&light, 1.f, 0.8f, 0.8f);
	njSetLightDirection(&light, 1.f, 0.f, 0.f);
	
	njCnkSetAmbient( 0.3f, 0.1f, 0.1f );
}
void
UserMain()
{
	njClearMatrix();
	njTranslate( NULL, 0.f, 0.f, -10.f );
	njRotateXYZ( NULL, rx,ry,rz );
	njCnkDrawObject( object );
}
	:

NOTE

As opposed to the basic model, the ambient color is not reflected in the normal light. Only one ambient color can be registered per scene (system) by this function.

REFERENCE

njCreateLight()
njCnkDrawObject()

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