Yes, I can define the aspect ratio based on the view size
But after I set the aspect ratio directly, I can not see anything.
I don't know What kind of effects it will bring to my camera.
Code: Select all
//設備種類
irr::video::E_DRIVER_TYPE driverType=driver->getDriverType();
if(driverType=irr::video::EDT_OPENGL)
{
matProj.buildProjectionMatrixOrthoLH (width,height,zNear,zFar);
else
{
matProj.buildProjectionMatrixOrthoRH (width,height,zNear,zFar);
}
//create the top/side/view camera
//create the top view camera
if(!topcam)
topcam=smgr->addCameraSceneNode(camtarget);
topcam->setProjectionMatrix(matProj,true);
topcam->setPosition(irr::core::vector3df(0,0,zFar));
topcam->setUpVector(irr::core::vector3df(1,0,0));
//create the left view camera
if(!leftcam)
leftcam=smgr->addCameraSceneNode(camtarget);
leftcam->setProjectionMatrix(matProj,true);
leftcam->setPosition(irr::core::vector3df(-zFar,0,0));
leftcam->setUpVector(irr::core::vector3df(0,0,1));
//create the front view camera
if(!frontcam)
frontcam=smgr->addCameraSceneNode(camtarget);
frontcam->setProjectionMatrix(matProj,true);
frontcam->setPosition(irr::core::vector3df(0,zFar,0));
frontcam->setUpVector(irr::core::vector3df(0,0,1));
//create the perspective view camera
if(!perscam)
perscam=smgr->addCameraSceneNode(camtarget);
perscam->setProjectionMatrix(matProj,true);
perscam->setPosition(irr::core::vector3df(-zFar,-zFar,-zFar));
Code: Select all
case GUI_ID_SPLIT_VIEW:
{
bSplitView=!bSplitView;
menu->setItemChecked(SearchIndexForCommandId(menu,GUI_ID_SPLIT_VIEW),bSplitView);
menu->setItemEnabled(SearchIndexForCommandId(menu,GUI_ID_SWITCH_ACTIVATE_VIEW),bSplitView);
if(!bSplitView)
{
menu->setItemChecked(SearchIndexForCommandId(menu,GUI_ID_VIEW_GROUND),EnabledGround);
menu->setItemChecked(SearchIndexForCommandId(menu,GUI_ID_VIEW_YZWALL),EnabledYZWall);
menu->setItemChecked(SearchIndexForCommandId(menu,GUI_ID_VIEW_XZWALL),EnabledXZWall);
topcam->setAspectRatio(single_view_size.getWidth()/single_view_size.getHeight());
leftcam->setAspectRatio(single_view_size.getWidth()/single_view_size.getHeight());
frontcam->setAspectRatio(single_view_size.getWidth()/single_view_size.getHeight());
perscam->setAspectRatio(single_view_size.getWidth()/single_view_size.getHeight());
}
else
{
if(activeChildView==0)
{
menu->setItemChecked(SearchIndexForCommandId(menu,GUI_ID_VIEW_GROUND),EnabledGround_uv);
menu->setItemChecked(SearchIndexForCommandId(menu,GUI_ID_VIEW_YZWALL),EnabledYZWall_uv);
menu->setItemChecked(SearchIndexForCommandId(menu,GUI_ID_VIEW_XZWALL),EnabledXZWall_uv);
}
else if(activeChildView==1)
{
menu->setItemChecked(SearchIndexForCommandId(menu,GUI_ID_VIEW_GROUND),EnabledGround_lv);
menu->setItemChecked(SearchIndexForCommandId(menu,GUI_ID_VIEW_YZWALL),EnabledYZWall_lv);
menu->setItemChecked(SearchIndexForCommandId(menu,GUI_ID_VIEW_XZWALL),EnabledXZWall_lv);
}
topcam->setAspectRatio(upper_view_size.getWidth()/upper_view_size.getHeight());
leftcam->setAspectRatio(upper_view_size.getWidth()/upper_view_size.getHeight());
frontcam->setAspectRatio(upper_view_size.getWidth()/upper_view_size.getHeight());
perscam->setAspectRatio(upper_view_size.getWidth()/upper_view_size.getHeight());
}
break;
}