Ninjaライブラリ - モーション関数

njCnkSetCurrentShape

ノード・モーション関数のパラメータの設定

書式

void njCnkSetCurrentShape( *motion, type, frame )
NJS_MOTION *motion
Int type
Float frame

引数

*motionモーション構造体へのポインタ
type頂点リストの型
frameフレーム番号

戻値

なし

解説

チャンク用ノード毎のモーション・パラメータを設定(初期化)します。

用例

#include <Shinobi.h>
#define OBJECT  object_sample
#define MOTION  motion_sample
#define MDATA3  ((NJS_MDATA3 *) MOTION->mdata)
#define LINEAR  0
#define SPLINE  1
extern NJS_MOTION MOTION[];
extern NJS_OBJECT OBJECT[];
Float ff = 0.f;
Int spline_flg = SPLINE;
/*このmdataはオブジェクト情報取得のため*/
NJS_MDATA3 *mdata;
	:
Sint32 njUserMain(void)
{
 	:
 mdata = MDATA3;
 njSetCurrentMotion(MOTION, ff );
 njCnkSetCurrentShape(shape, NJD_CV_VN, ff );
 PushPopMotion( OBJECT );
 ff+=0.2f;
 if( ff >= (MOTION->nbFrame-1) ) ff=0.f;
 	:
}
void
PushPopMotion( NJS_CNK_OBJECT *cnkobj )
{
	Float	pos[3], scl[3];
	Angle	ang[3];
	Sint32	*vlist;
	
	do {
	njPushMatrix( NULL );
	
	if (mdata->p[0] != NULL) {
		njGetMotionTranslate( pos, spline_flg );
	} else {
		pos[0] = cnkobj->pos[0];
		pos[1] = cnkobj->pos[1];
		pos[2] = cnkobj->pos[2];
	}
	
	if (mdata->p[1] != NULL) {
		njGetMotionRotate( ang, spline_flg );
	} else {
		ang[0] = cnkobj->ang[0];
		ang[1] = cnkobj->ang[1];
		ang[2] = cnkobj->ang[2];
	}
	
	if (mdata->p[2] != NULL) {
		njGetMotionScale( scl, spline_flg );
	} else {
		scl[0] = cnkobj->scl[0];
		scl[1] = cnkobj->scl[1];
		scl[2] = cnkobj->scl[2];
	}
	
	njTranslate( NULL, pos[0], pos[1], pos[2] );
	njRotateZXY( NULL, ang[0], ang[1], ang[2] );
	njScale( NULL, scl[0], scl[1], scl[2] );
	njSetNextMotionNode();
	mdata++;
	if ( cnkobj->model != NULL ) vlist = cnkobj->model->vlist;
	
	if ( !(cnkobj->evalflags & NJD_EVAL_SHAPE_SKIP)) {
		if (njCnkGetShape(cnkobj, NULL, spline_flg)) cnkobj->model->vlist = (Sint32*)sbuf;
	}
	
	if( (cnkobj->model != NULL) && (!(cnkobj->evalflags & NJD_EVAL_HIDE)) ) {
		njCnkEasyDrawModel( cnkobj->model );
		cnkobj->model->vlist = vlist;
	}
	
	if( cnkobj->child != NULL )
		PushPopMotion( (NJS_CNK_OBJECT*)cnkobj->child );
	
	njPopMatrix( 1 );
	
	cnkobj = cnkobj->sibling;
	} while( cnkobj != NULL );
}
	:

参照

njCnkGetShape()

njCnkSetCurrentShape
COPYRIGHT © SEGA ENTERPRISES, LTD., 1998