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 );
}
: