rjDrawTexture3DEx - shaddatic/sa2b-render-fix GitHub Wiki

Prototype

void rjDrawTexture3DEx( const NJS_TEXTURE_VTX* polygon, Int count, Int flag )

API

void (*DrawTexture3DEx)( const NJS_TEXTURE_VTX* polygon, Int count, Int flag )

Ninja

void njDrawTexture3DEx( NJS_TEXTURE_VTX* polygon, Int count, Int flag )

Parameters

const NJS_TEXTURE_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 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. It uses a texture index of 0 in a defined texlist. This example's comments assumes the camera is looking down the -Z axis.

#define NUM_VTX 4
#define NUM_TEX 0

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

njPushMatrix( NULL );

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

// set the texture
rjSetTexture( &texlist );
rjSetTextureNum( NUM_TEX );

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

njPopMatrix( 1 );

Related Functions

History