rjDrawPolygon3DEx - shaddatic/sa2b-render-fix GitHub Wiki

Prototype

void rjDrawPolygon3DEx( const NJS_POLYGON_VTX* polygon, Int count, Int trans )

API

void (*DrawPolygon3DEx)( const NJS_POLYGON_VTX* polygon, Int count, Int trans )

Ninja

void njDrawPolygon3DEx( NJS_POLYGON_VTX* polygon, Int count, Int trans )

Parameters

const NJS_POLYGON_VTX* polygon

 polygon vertex list, of length count

Int count

 Length of vertex list

Int trans

 Use translucency (TRUE/FALSE)

Returns

No return value.

Description

Draw a non-textured polygon with 'n' vertexes in 3D units.

The vertex list is in triangle strip format.

Example

This example will draw a 64x64, opaque, multi-colored polygon in the center of the world at Y +10. This example's comments assumes the camera is looking down the -Z axis.

#define NUM_VTX 4

// set vertex list
NJS_POLYGON_VTX poly[NUM_VTX] = 
{
  //      x,     y,    z,    col (ARGB)
  [0] = { -32.f, 0.f, -32.f, 0xFFFFFFFF }, // far left, white
  [1] = { -32.f, 0.f,  32.f, 0xFFFF0000 }, // near left, red
  [2] = {  32.f, 0.f, -32.f, 0xFF00FF00 }, // far right, green
  [3] = {  32.f, 0.f,  32.f, 0xFF0000FF }, // near right, blue
};

njPushMatrix( NULL );

// move polygon 1 meter upwards in world space
njTranslate( NULL, 0.f, 10.f, 0.f );

// ... any other wanted matrix translations

// draw polygon
rjDrawPolygon3DEx( poly, NUM_VTX, FALSE ); // <<<<<<<<

njPopMatrix( 1 );

Related Functions

History