njDrawPolygon3D Japanese
<-|INDEX|->
Draws a polygon in 3D space.

FORMAT

#include <Ninja.h>
void njDrawPolygon3D(*p, n, attr)
NJS_POINT3COL *p
Int n
Uint32 attr

PARAMETERS

*p
list of coordinates of vertices of a polygon to be drawn
n
number of vertices of a polygon
attr
attributes (specifies the drawing method)

RETURN VALUE

None

FUNCTION


EXAMPLE

The following draws 100 squares at random.
int i;

NJS_POINT3COL p;
NJS_POINT3 point[4];
NJS_COLOR color[4];

p->p = point;
p->col = color;
p->tex = NULL;
p.num = 4;

for(i = 0; i< 100; i++){
    int j;
    p->p[0].x = njRandom()*1000.f-500.f;
    p->p[0].y = njRandom()*1000.f-500.f;
    p->p[0].z = -3000.f+(float)i;
    p->p[1].x = p->p[0].x-polysize;
    p->p[1].y = p->p[0].y;
    p->p[1].z = p->p[0].z;
    p->p[2].x = p->p[0].x-polysize;
    p->p[2].y = p->p[0].y-polysize;
    p->p[2].z = p->p[0].z;
    p->p[3].x = p->p[0].x;
    p->p[3].y = p->p[0].y-polysize;
    p->p[3].z = p->p[0].z;

    for(j = 0; j < 4; j++){
        p->col[j].argb.a = (Uint8)(0x80*njRandom());
        p->col[j].argb.r = (Uint8)(0x80*njRandom());
        p->col[j].argb.g = (Uint8)(0x80*njRandom());
        p->col[j].argb.b = (Uint8)(0x80*njRandom());
    }
    njDrawPolygon3D(&p, 4, NJD_DRAW_NORMAL|NJD_FILL);
Since this function draws in 3D, the view, screen, and matrix stack settings must be made before using it.

NOTES


RELATED TOPICS


njDrawPolygon3D
<-|INDEX|->

Copyright SEGA ENTERPRISES, LTD., 1997