Ninja Library - Light Function

njCnkSetEasyLight

Set chunk easy light

FORMAT

void njCnkSetEasyLight( x, y, z )
Float x, y, z

PARAMETER

 x, y, z  Light vectors 

RETURN

None

DESCRIPTION

Sets the light for the njCnkEasyDrawObject (njCnkEasyDrawModel). The vector coordinate system is fixed to the screen. For example, a setting such as

njCnkSetEasyLight( 0.0f, 0.0f, 1.0f );

causes the light to always come from the front side of the screen. To obtain a coordinate system in a 3D space, perform conversion with the current matrix.

light.x = LIGHT3D_X;
light.y = LIGHT3D_Y;
light.z = LIGHT3D_Z;
njCalcVector( NULL, &light, &lwork );
njCnkSetEasyLight( lwork.x, lwork.y, lworkz );

This will result in the light source emerging from a 3D space (LIGHT3D_X, LIGHT3D_Y, LIGHT3D_Z).


EXAMPLE

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 );
njCnkSetEasyLight( 0.f, 0.f, 1.0f );
njCnkSetEasyLightIntensity( 1.0f, 0.0f );
njCnkSetEasyLightColor( 1.0f, 1.0f, 1.0f );
njClearMatrix();
njTranslate( NULL, 0.f, 0.f, -10.f );
njRotateXYZ( NULL, rx,ry,rz );
njCnkEasyDrawObject( object );

REFERENCE

njCnkEasyDrawObject()
njCnkEasyDrawModel()
njCnkSetEasyLightIntensity()
njCnkSetEasyLightColor()

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