Ninja Library - View Function

njCalcScreen

Projects points

FORMAT

int njCalcScreen( *p, *sx, *sy )
NJS_POINT3 *p
Float *sx
Float *sy

PARAMETER

 *p  Point coordinates in 3D space 
 *sx  X coordinates after projection 
 *sy  Y coordinates after projection 

RETURN

 OK  The coordinates after projection lie within the screen's drawing area 
 NG  The coordinates after projection fall outside of the screen's drawing area 

DESCRIPTION

Projects points in 3D space onto the screen, then finds the screen coordinates to which the points are projected. The result is indicated by *sx and *sy. Returns OK when the coordinates is inside the screen and NG when outside the screen.

EXAMPLE

The following projects the point at (1000, 1000, 1000) in 3D space onto the screen, 
then finds the screen coordinates.

NJS_POINT3 p;
Float sx, sy;
p.x = 1000.f;
p.y = 1000.f;
p.z = 1000.f;
sbInitSystem( NJD_RESOLUTION_640x480_NTSCNI, NJD_FRAMEBUFFER_MODE_RGB565, 1 );
njCalcScreen(&p, &sx, &sy);
% Result %
NG
sx = 820.000000, sy = 740.000000

NOTE

The results calculated by this function reflect the screen, aspect, near clipping, far clipping, and drawing area settings.

REFERENCE

njInitSystem()
njSetScreen()
njSetAspect()
njClipZ()

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