理屈は良く分かりませんが CBackGround::Init 内の以下の行をコメントにすると動作しました。
> SetUseASyncLoadFlag( TRUE );
おそらくDXライブラリの非同期読み込みにバグがあるのではないかと思います。
//- 以下、テストコード ("SimpleModel.mqo"を使用)-//
// 十字キーを使用してモデルの中心座標を画面外にするとモデル全体が描画されなくなります
#include "DxLib.h"
struct CAMERA_INFO {
VECTOR position; // Relative to Target
VECTOR target;
VECTOR head;
};
void init_camera( CAMERA_INFO& camera ) {
camera.position = VGet( 0.0f, 0.0f, -800.0f );
camera.target = VGet( 0.0f, 0.0f, 0.0f );
camera.head = VGet( 0.0f, 1.0f, 0.0f );
}
int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
{
// const float rot_rate = PHI_F * 2.0f / 60.0f;
const float move_rate = 5.0f;
ChangeWindowMode( TRUE );
SetWindowText( "DxLib:" DXLIB_VERSION_STR );
if ( DxLib_Init( ) == -1 ) return -1;
int white = GetColor( 255, 255, 255 );
SetUseASyncLoadFlag( TRUE );
int mh = MV1LoadModel( "SimpleModel.mqo" );
SetUseASyncLoadFlag( FALSE );
while ( ProcessMessage() == 0 && GetASyncLoadNum() != 0 )
;
SetDrawScreen( DX_SCREEN_BACK );
CAMERA_INFO camera;
init_camera( camera );
while ( ProcessMessage( ) == 0 && CheckHitKey( KEY_INPUT_ESCAPE ) == 0 ) {
ClearDrawScreen( );
if ( CheckHitKey( KEY_INPUT_SPACE ) ) {
init_camera( camera );
}
else {
if ( CheckHitKey( KEY_INPUT_UP ) ) {
camera.target = VAdd( camera.target, VScale( VNorm( camera.head ), move_rate ) );
}
if ( CheckHitKey( KEY_INPUT_DOWN ) ) {
camera.target = VAdd( camera.target, VScale( VNorm( camera.head ), -move_rate ) );
}
if ( CheckHitKey( KEY_INPUT_LEFT ) ) {
camera.target = VAdd( camera.target, VScale( VNorm( VCross( camera.position, camera.head ) ), -move_rate ) );
}
if ( CheckHitKey( KEY_INPUT_RIGHT ) ) {
camera.target = VAdd( camera.target, VScale( VNorm( VCross( camera.position, camera.head ) ), move_rate ) );
}
if ( CheckHitKey( KEY_INPUT_Z ) ) {
camera.target = VAdd( camera.target, VScale( VNorm( camera.position ), -move_rate ) );
}
if ( CheckHitKey( KEY_INPUT_X ) ) {
camera.target = VAdd( camera.target, VScale( VNorm( camera.position ), move_rate ) );
}
}
SetCameraPositionAndTargetAndUpVec( VAdd( camera.target, camera.position ), camera.target, camera.head );
DrawLine3D( VGet( 0.0f, 0.0f, 0.0f ), VGet( 1000.0f, 0.0f, 0.0f ), GetColor( 255, 0, 0 ) );
DrawLine3D( VGet( 0.0f, 0.0f, 0.0f ), VGet( 0.0f, 1000.0f, 0.0f ), GetColor( 0, 255, 0 ) );
DrawLine3D( VGet( 0.0f, 0.0f, 0.0f ), VGet( 0.0f, 0.0f, 1000.0f ), GetColor( 0, 0, 255 ) );
MV1DrawModel( mh );
DrawFormatString( 0, 0, white, "position x=%f y=%f z=%f size=%f", camera.position.x, camera.position.y, camera.position.z, VSize( camera.position ) );
DrawFormatString( 0, 20, white, "target x=%f y=%f z=%f size=%f", camera.target.x, camera.target.y, camera.target.z, VSize( camera.target ) );
DrawFormatString( 0, 40, white, "head x=%f y=%f z=%f size=%f", camera.head.x, camera.head.y, camera.head.z, VSize( camera.head ) );
ScreenFlip( );
}
DxLib_End( );
return 0;
}