原因が分かりました。スケールが違いました。
qube.xを100倍するとqube.mqoと同じ大きさです。
コード:
#include"DXlib.h"
int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
{
ChangeWindowMode( TRUE ), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK );
int model1 = MV1LoadModel( "qube.mqo" );
int model2 = MV1LoadModel( "qube.x" );
MV1SetScale(model2,VGet(100,100,100)); // model2が1/100の大きさだった。
// モデルの回転
float rotY = 0.0f;
// カメラ設定
SetCameraNearFar(10.0f,10000.0f);
float cposx = 0.0f;
while( ScreenFlip() == 0 && ProcessMessage() == 0 && ClearDrawScreen() == 0 ) {
// カメラ設定
if( 1==CheckHitKey(KEY_INPUT_LEFT) ) cposx-=5;
if( 1==CheckHitKey(KEY_INPUT_RIGHT) ) cposx+=5;
SetCameraPositionAndTarget_UpVecY(VGet(cposx,500.0f,-500.0f),VGet(0.0f,0.0f,0.0f));
// 表示
MV1SetPosition( model1, VGet( 150.0f, 0.0f, 350.0f ) );
MV1SetRotationXYZ( model1, VGet( 0.0f, rotY, 0.0f ) );
MV1DrawModel( model1 );
MV1SetPosition( model2, VGet( -150.0f, 0.0f, 350.0f ) );
MV1SetRotationXYZ( model2, VGet( 0.0f, rotY, 0.0f ) );
MV1DrawModel( model2 );
// 回転
rotY += PHI / 180.0f;
}
DxLib_End();
return 0;
}
おまけ。ちょっと遊んでみた。
コード:
#include"DXlib.h"
int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
{
ChangeWindowMode( TRUE ), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK );
int model1 = MV1LoadModel( "qube.mqo" );
int model2 = MV1LoadModel( "qube.x" );
MV1SetScale(model2,VGet(5,5,5)); // model2が1/100の大きさだった。
// モデルの回転
float rotY = 0.0f;
// 初期設定
SetUseZBuffer3D(TRUE);
SetWriteZBuffer3D(TRUE);
SetCameraNearFar(10.0f,10000.0f);
VECTOR cam = VGet(0.0f,500.0f,-500.0f);
while( ScreenFlip() == 0 && ProcessMessage() == 0 && ClearDrawScreen() == 0 ) {
// カメラ設定
if( 1==CheckHitKey(KEY_INPUT_LEFT) ) cam.x-=5;
if( 1==CheckHitKey(KEY_INPUT_RIGHT) ) cam.x+=5;
if( 1==CheckHitKey(KEY_INPUT_LSHIFT) || 1==CheckHitKey(KEY_INPUT_RSHIFT) ) {
if( 1==CheckHitKey(KEY_INPUT_UP) ) cam.z+=5;
if( 1==CheckHitKey(KEY_INPUT_DOWN) ) cam.z-=5;
} else {
if( 1==CheckHitKey(KEY_INPUT_UP) ) cam.y+=5;
if( 1==CheckHitKey(KEY_INPUT_DOWN) ) cam.y-=5;
}
SetCameraPositionAndTarget_UpVecY(cam,VGet(0.0f,0.0f,0.0f));
// グリッド
for( float x=-1000 ; x<=1000 ; x+=100 ) {
DrawLine3D( VGet(x,0,-1000),VGet(x,0,1000),GetColor(255,255,255));
DrawLine3D( VGet(-1000,0,x),VGet(1000,0,x),GetColor(255,255,255));
}
// 表示
MV1SetPosition( model1, VGet( 200.0f, 0.0f, 300.0f ) );
MV1SetRotationXYZ( model1, VGet( 0.0f, rotY, 0.0f ) );
MV1DrawModel( model1 );
MV1SetPosition( model2, VGet( -200.0f, 0.0f, 300.0f ) );
MV1SetRotationXYZ( model2, VGet( 0.0f, rotY, 0.0f ) );
MV1DrawModel( model2 );
// 回転
rotY += PHI / 180.0f;
}
DxLib_End();
return 0;
}