njDrawSprite3D Japanese
<-|INDEX|--
Draws 3D sprite

FORMAT

#include <Ninja.h>
void  njDrawSprite3D( *sp, n, attr )
NJS_SPRITE  *sp
Int         n
Uint32      attr

PARAMETERS

*sp
Pointer for sprite structure
n
Sprite number
attr
Attribute

RETURN VALUE

None

ERROR VALUE

None

FUNCTION


EXAMPLE

Use two 256x256 textures and divide each into 4 patterns, making 8 texture animation patterns.
NJS_TEXANIM  anim[] = {
  { 128,128, 64, 64,  0,  0,127,127,  0, 0 },
  { 128,128, 64, 64,128,  0,255,127,  0, 0 },
  { 128,128, 64, 64,  0,128,127,255,  0, 0 },
  { 128,128, 64, 64,128,128,255,255,  0, 0 },
  { 128,128, 64, 64,  0,  0,127,127,  1, 0 },
  { 128,128, 64, 64,128,  0,255,127,  1, 0 },
  { 128,128, 64, 64,  0,128,127,255,  1, 0 },
  { 128,128, 64, 64,128,128,255,255,  1, 0 },
};

main() {
  NJS_SPRITE  sprite;

         :
  Initial settings
         :

  sprite.tlist = &texlist;
  sprite.tanim = anim;
  sprite.ang = 0;
  sprite.sx = 1.0f;
  sprite.sy = 1.0f;
  sprite.p.x = 0.0f;
  sprite.p.y = 0.0f;
  sprite.p.z = 0.0f;

  njInitSystem( NJD_RESOLUTION_640x480, 1 );
  njInitMatrix( matrix, 128 );
  njInit3D( vbuf, 1024, abuf, fbuf, 32 );
  njInitView( &view );
  njCreateLight( &light, NJD_DIR_LIGHT );
  njSetView( &view );
  njInitTexture( tex, 100 );

  njLoadTexture( &texlist );

  while(1) {
    njClearMatrix();

    njTranslate( NULL, 0.f, 0.f, -400.f );
    njDrawSprite3D( &sprite, 2, NJD_SPRITE_ANGLE );

    sprite.angle += 100;

    ......
  }

}

NOTES

See also njDrawSprite2D()

RELATED TOPICS

njDrawSprite2D()
njSetConstantMaterial()
njLoadTexture()
njDrawModel()

njDrawSprite3D
<-|INDEX|--

Copyright SEGA ENTERPRISES, LTD., 1997