Ninja Library - Light Function

njCnkSetSimpleLight

Sets chunk simple light

FORMAT

void njCnkSetSimpleLight( x, y, z )
float x
float y
float z

PARAMETER

 x, y, z  Light vectors 

RETURN

None

DESCRIPTION

Sets light for njCnkSimpleDrawObject(njCnkSimpleDrawModel). Coordinate system of vector is fixed to screen. For example, the following sets the light always from the front screen.

njCnkSetSimpleLight( 0.0f, 0.0f, 1.0f );

To use coordinates in 3D space, set after converting by current matrix.

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

This sets light source from 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 );
njCnkSetSimpleLight( 0.f, 0.f, 1.0f );
njCnkSetSimpleLightIntensity( 1.0f, 0.0f );
njCnkSetSimpleLightColor( 1.0f, 1.0f, 1.0f );
njClearMatrix();
njTranslate( NULL, 0.f, 0.f, -10.f );
njRotateXYZ( NULL, rx,ry,rz );
njCnkSimpleDrawObject( object );

REFERENCE

njCnkSimpleDrawModel()
njCnkSimpleDrawObject()
njCnkSetSimpleLightIntensity()
njCnkSetSimpleLightColor()

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