DXライブラリで2画面
Posted: 2012年7月25日(水) 20:38
http://www.nicovideo.jp/watch/sm14325468
上の動画のように2画面または4画面で3D空間を撮影するにはどうしたらいいでしょうか?
上の動画のように2画面または4画面で3D空間を撮影するにはどうしたらいいでしょうか?
#include "DxLib.h"
int model;
int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int ){
ChangeWindowMode( TRUE ), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK );
model=MV1LoadModel("test.mqo");
while( ScreenFlip() == 0 && ProcessMessage() == 0 && ClearDrawScreen() == 0 ) {
MV1SetPosition(model,VGet(0.0f,0.0f,0.0f));
MV1DrawModel(model);
SetCameraPositionAndTarget_UpVecY(VGet(200.0f,0.0f,0.0f),VGet(0.0f,0.0f,0.0f));
SetDrawArea(0,0,320,480) ;
SetCameraScreenCenter(160.0f,240.0f);
SetCameraPositionAndTargetAndUpVec(VGet(0.0f,200.0f,0.0f),VGet(0.0f,0.0f,0.0f),VGet(1.0f,0.0f,0.0f));
SetDrawArea(320,0,640,480) ;
SetCameraScreenCenter(480.0f,240.0f);
}
DxLib_End();
return 0;
} 1回しか描画していないですからねヒューガ さんが書きました: これだと右半分にしか映りません・・・
ぱっと思いつくのは、MakeScreenで作った画像に対して描画してDrawExtendGraphで1/4のサイズで描画する方法ですね。ヒューガ さんが書きました: あと4画面の時はそのままだと自分が全て映らないのでカメラを離すというのではなく、
カメラとの距離はそのままで元の画面の1/4の大きさにしたいのですがどうすればいいでしょうか?
#include "DxLib.h"
int model;
int count;
int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int ){
ChangeWindowMode( TRUE ), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK );
model=MV1LoadModel("./F-22A/F-22A.pmd");
while( ScreenFlip() == 0 && ProcessMessage() == 0 && ClearDrawScreen() == 0 ) {
MV1SetPosition(model,VGet(0.0f,0.0f,0.0f));
MV1DrawModel(model);
if(count%2==0){SetCameraPositionAndTarget_UpVecY(VGet(200.0f,0.0f,0.0f),VGet(0.0f,0.0f,0.0f));
SetDrawArea(0,0,320,480) ;
SetCameraScreenCenter(160.0f,240.0f);}
if(count%2==1){SetCameraPositionAndTargetAndUpVec(VGet(0.0f,200.0f,0.0f),VGet(0.0f,0.0f,0.0f),VGet(1.0f,0.0f,0.0f));
SetDrawArea(320,0,640,480) ;
SetCameraScreenCenter(480.0f,240.0f);}
count++;
}
DxLib_End();
return 0;
}#include "DxLib.h"
int model;
int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int ){
ChangeWindowMode( TRUE ), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK );
model=MV1LoadModel("./F-22A/F-22A.pmd");
while( ScreenFlip() == 0 && ProcessMessage() == 0 && ClearDrawScreen() == 0 ) {
SetDrawArea(0,0,320,480) ;
SetCameraScreenCenter(160.0f,240.0f);
SetCameraPositionAndTarget_UpVecY(VGet(200.0f,0.0f,0.0f),VGet(0.0f,0.0f,0.0f));
MV1SetPosition(model,VGet(0.0f,0.0f,0.0f));
MV1DrawModel(model);
SetDrawArea(320,0,640,480) ;
SetCameraScreenCenter(480.0f,240.0f);
SetCameraPositionAndTargetAndUpVec(VGet(0.0f,200.0f,0.0f),VGet(0.0f,0.0f,0.0f),VGet(1.0f,0.0f,0.0f));
MV1SetPosition(model,VGet(0.0f,0.0f,0.0f));
MV1DrawModel(model);
}
DxLib_End();
return 0;
}それは無い物ねだりだと思います。ヒューガ さんが書きました:そのまま4分割するとカメラとの距離がそのままでは自機が元と同じようには映らないので、
そしてカメラとの距離はあまり動かしたくないというのもあります。
#include "DxLib.h"
int model;
int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int ){
ChangeWindowMode( TRUE ), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK );
model=MV1LoadModel("test.mqo");
while( ScreenFlip() == 0 && ProcessMessage() == 0 && ClearDrawScreen() == 0 ) {
MV1SetPosition(model,VGet(0.0f,0.0f,0.0f));
SetDrawArea(0,0,320,240) ;
SetCameraScreenCenter(160.0f,120.0f);
SetCameraPositionAndTarget_UpVecY(VGet(300.0f,0.0f,0.0f),VGet(0.0f,0.0f,0.0f));
MV1DrawModel(model);
SetDrawArea(320,0,640,240) ;
SetCameraScreenCenter(480.0f,120.0f);
SetCameraPositionAndTargetAndUpVec(VGet(0.0f,300.0f,0.0f),VGet(0.0f,0.0f,0.0f),VGet(1.0f,0.0f,0.0f));
MV1DrawModel(model);
SetDrawArea(0,240,320,480) ;
SetCameraScreenCenter(160.0f,360.0f);
SetCameraPositionAndTargetAndUpVec(VGet(0.0f,0.0f,300.0f),VGet(0.0f,0.0f,0.0f),VGet(0.0f,1.0f,0.0f));
MV1DrawModel(model);
SetDrawArea(320,240,640,480) ;
SetCameraScreenCenter(480.0f,360.0f);
SetCameraPositionAndTargetAndUpVec(VGet(0.0f,0.0f,-300.0f),VGet(0.0f,0.0f,0.0f),VGet(0.0f,1.0f,0.0f));
MV1DrawModel(model);
}
DxLib_End();
return 0;
}