複数個のアニメーションデータを読み込む場合も、必要数の ActTable を準備し、それぞれに対し OEMC_Micro3D_ActTable_loadMtraData() を利用します。
サンプルでは決定キーを押すごとにアクションが切り替わります。
/**
* cap.act[] はアクションデータ用配列
* cap.actIndex はアクションデータ選択用変数
*/
OEMC_Micro3D_ActTable_initialize( &cap.act[0], g_IAllocator );
OEMC_Micro3D_ActTable_initialize( &cap.act[1], g_IAllocator );
/* アクションデータを読み込む */
MemIstream_initialize( &mis, cap_back.addr, cap_back.size );
rval = OEMC_Micro3D_ActTable_loadMtraData(
MemIstream_initialize( &mis, cap_walk.addr, cap_walk.size );
rval = OEMC_Micro3D_ActTable_loadMtraData(
cap.actIndex = 0;
/* アクションデータの設定 */
int maxframe =
OEMC_Micro3D_ActTable_getNumFrames(
cap.currentFrame += 65536 * g_dif_time * 30 / 1000;
if ( maxframe != 0 ) {
OEMC_Micro3D_Figure_setPosture( &cap.fig,
/* アクションデータ切り替え */
cap.actIndex++;
if ( cap.actIndex > 1 )
* cap.act[] はアクションデータ用配列
* cap.actIndex はアクションデータ選択用変数
*/
OEMC_Micro3D_ActTable_initialize( &cap.act[0], g_IAllocator );
OEMC_Micro3D_ActTable_initialize( &cap.act[1], g_IAllocator );
/* アクションデータを読み込む */
MemIstream_initialize( &mis, cap_back.addr, cap_back.size );
rval = OEMC_Micro3D_ActTable_loadMtraData(
&cap.act[0], MemIstream_getIIstream( &mis ) );
if ( !rval )
return HI_FALSE;
MemIstream_initialize( &mis, cap_walk.addr, cap_walk.size );
rval = OEMC_Micro3D_ActTable_loadMtraData(
&cap.act[1], MemIstream_getIIstream( &mis ) );
if ( !rval )
return HI_FALSE;
cap.actIndex = 0;
/* アクションデータの設定 */
int maxframe =
OEMC_Micro3D_ActTable_getNumFrames(
&cap.act[cap.actIndex], cap.actID );
cap.currentFrame += 65536 * g_dif_time * 30 / 1000;
if ( maxframe != 0 ) {
if ( cap.currentFrame > maxframe )
} else {
cap.currentFrame -= maxframe;
cap.currentFrame = 0;
}OEMC_Micro3D_Figure_setPosture( &cap.fig,
&cap.act[cap.actIndex], cap.actID, cap.currentFrame );
/* アクションデータ切り替え */
cap.actIndex++;
if ( cap.actIndex > 1 )
cap.actIndex = 0;

SampleAnimation3D 実行画面
(左:歩きのアクション,右:バク宙のアクション)

