Ninja Library - Drawing Function

njDrawTexture

Draws a texture polygon

FORMAT

void njDrawTexture( *polygon, count, tex, trans )
NJS_TEXTURE_VTX *polygon
Int count
Int tex
Int trans

PARAMETER

 *polygon  Pointer for NJS_TEXTURE_VTX structure 
 count  Vertex number 
 tex  Texture global index 
 trans  Transparent effective (TRUE), ineffective (FALSE) 

RETURN

None

DESCRIPTION

Draws a texture polygon. Input vertex count number for strip format. Initialize, set and load texture before using function. For texture or color, please set trans to TRUE when using transparet drawing and to FALSE when not using it. The relationship with the Z coordinate of other drawing functions is as follows: Z = 1/(-z)
z: Coordinate in other drawing function (-65536.f < z < 0.f)

Therefore, the valid range for Z is from 1.0f to infinity.


EXAMPLE

The following draws a square.
The vertex order is as follows.
1 3
2 4
NJS_TEXNAME texname[1]; 
NJS_TEXLIST texlist ={texname,1};
NJS_TEXMEMLIST tex[1];
NJS_TEXTURE_VTX poly[4];
Sint8 *texbuf
/* Set texture initialization */
njInitTexture(tex,1);
texbuf = syMalloc(0x20800);
njInitTextureBuffer(texbuf,0x20800);
njSetTextureName(&texname[0],"file0.pvr",0,NJD_TEXATTR_TYPE_FILE|
      NJD_TEXATTR_GLOBALINDEX);
njLoadTexture(&texlist);
syFree(texbuf);
njSetTexture(&texlist);
poly[0].x = 100.f;
poly[0].y = 100.f;
poly[0].z = 0.5f;
poly[0].u = 0.f;
poly[0].v = 0.f;
poly[0].col = 0xFFFFFFFF;
poly[1].x = 100.f;
poly[1].y = 300.f;
poly[1].z = 0.5.f;
poly[1].u = 0.f;
poly[1].v = 1.f;
poly[1].col = 0xFFFFFFFF;
poly[2].x = 300.f;
poly[2].y = 100.f;
poly[2].z = 0.5f;
poly[2].u = 1.f;
poly[2].v = 0.f;
poly[2].col = 0xFFFFFFFF;
poly[3].x = 300.f;
poly[3].y = 300.f;
poly[3].z = 0.5f;
poly[3].u = 1.f;
poly[3].v = 1.f;
poly[3].col = 0xFFFFFFFF;
/* Paste global index 0 texture on polygon */
njDrawTexture( poly, 4, 0, FALSE);

REFERENCE

njDrawPolygon()

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