Esempio n. 1
0
void ParaEngine::CViewportManager::UpdateLayout()
{
	if (GetLayout() == VIEW_LAYOUT_STEREO_LEFT_RIGHT)
	{
		int nHalfWidth = (int)(GetWidth() / 2);
		CViewport* pUIViewportLeft = CreateGetViewPort(0);
		pUIViewportLeft->SetPosition("_ml", 0, 0, nHalfWidth, 0);
		CViewport* pMainSceneViewportLeft = CreateGetViewPort(1);
		pMainSceneViewportLeft->SetPosition("_ml", 0, 0, nHalfWidth, 0);

		CViewport* pUIViewportRight = CreateGetViewPort(2);
		pUIViewportRight->SetPosition("_mr", 0, 0, nHalfWidth, 0);
		CViewport* pMainSceneViewportRight = CreateGetViewPort(3);
		pMainSceneViewportRight->SetPosition("_mr", 0, 0, nHalfWidth, 0);
	}
}
Esempio n. 2
0
void ParaEngine::CViewportManager::SetLayout(VIEWPORT_LAYOUT nLayout, CSceneObject* pMainScene, CGUIRoot* pGUIRoot)
{
	if (!pMainScene)
		pMainScene = CGlobals::GetScene();
	if (!pGUIRoot)
		pGUIRoot = CGlobals::GetGUI();
	if (m_nLayout == nLayout && GetViewportCount() != 0)
		return;
	// clear layout
	SetViewportCount(0);

	m_nLayout = nLayout;
	if (nLayout == VIEW_LAYOUT_STEREO_LEFT_RIGHT)
	{
		int nHalfWidth = (int)(GetWidth() / 2);
		CViewport* pUIViewportLeft = CreateGetViewPort(0);
		pUIViewportLeft->SetIdentifier("left_GUI");
		pUIViewportLeft->SetGUIRoot(pGUIRoot);
		pUIViewportLeft->SetPosition("_ml", 0, 0, nHalfWidth, 0);
		pUIViewportLeft->SetZOrder(100);
		pUIViewportLeft->SetEyeMode(STEREO_EYE_LEFT);
		CViewport* pMainSceneViewportLeft = CreateGetViewPort(1);
		pMainSceneViewportLeft->SetIdentifier("left_scene");
		pMainSceneViewportLeft->SetScene(pMainScene);
		pMainSceneViewportLeft->SetPosition("_ml", 0, 0, nHalfWidth, 0);
		pMainSceneViewportLeft->SetEyeMode(STEREO_EYE_LEFT);

		CViewport* pUIViewportRight = CreateGetViewPort(2);
		pUIViewportRight->SetIdentifier("right_GUI");
		pUIViewportRight->SetGUIRoot(pGUIRoot);
		pUIViewportRight->SetPosition("_mr", 0, 0, nHalfWidth, 0);
		pUIViewportRight->SetZOrder(101);
		pUIViewportRight->SetEyeMode(STEREO_EYE_RIGHT);
		CViewport* pMainSceneViewportRight = CreateGetViewPort(3);
		pMainSceneViewportRight->SetIdentifier("right_scene");
		pMainSceneViewportRight->SetScene(pMainScene);
		pMainSceneViewportRight->SetPosition("_mr", 0, 0, nHalfWidth, 0);
		pMainSceneViewportRight->SetZOrder(1);
		pMainSceneViewportRight->SetEyeMode(STEREO_EYE_RIGHT);

		SetViewportCount(4);
	}
	else if (nLayout == VIEW_LAYOUT_STEREO_RED_BLUE)
	{
		CViewport* pUIViewport = CreateGetViewPort(0);
		pUIViewport->SetIdentifier("GUI");
		pUIViewport->SetGUIRoot(pGUIRoot);
		pUIViewport->SetPosition("_fi", 0, 0, 0, 0);
		pUIViewport->SetZOrder(100);
		pUIViewport->SetEyeMode(STEREO_EYE_NORMAL);
		CViewport* pMainSceneViewportLeft = CreateGetViewPort(1);
		pMainSceneViewportLeft->SetIdentifier("left_scene");
		pMainSceneViewportLeft->SetScene(pMainScene);
		pMainSceneViewportLeft->SetPosition("_fi", 0, 0, 0, 0);
		pMainSceneViewportLeft->SetEyeMode(STEREO_EYE_LEFT);
		pMainSceneViewportLeft->SetRenderTargetName("_LeftViewRT"); // use private render target

		CViewport* pMainSceneViewportRight = CreateGetViewPort(2);
		pMainSceneViewportRight->SetIdentifier("right_scene");
		pMainSceneViewportRight->SetScene(pMainScene);
		pMainSceneViewportRight->SetPosition("_fi", 0, 0, 0, 0);
		pMainSceneViewportRight->SetZOrder(1);
		pMainSceneViewportRight->SetEyeMode(STEREO_EYE_RIGHT);

		// final full screen quad
		CViewport* pFinalViewPort = CreateGetViewPort(3);
		pFinalViewPort->SetIdentifier("final_composite");
		pFinalViewPort->SetPosition("_fi", 0, 0, 0, 0);
		pFinalViewPort->SetEyeMode(STEREO_EYE_NORMAL);
		pFinalViewPort->SetZOrder(99); // before GUI
		pFinalViewPort->SetPipelineOrder(PIPELINE_3D_SCENE);
		SetViewportCount(4);
	}
	else // if (nLayout == VIEW_LAYOUT_DEFAULT)
	{
		CViewport* pUIViewport = CreateGetViewPort(0);
		pUIViewport->SetIdentifier("GUI");
		pUIViewport->SetGUIRoot(pGUIRoot);
		pUIViewport->SetPosition("_fi", 0, 0, 0, 0);
		pUIViewport->SetZOrder(100);
		pUIViewport->SetEyeMode(STEREO_EYE_NORMAL);
		CViewport* pMainSceneViewport = CreateGetViewPort(1);
		pMainSceneViewport->SetIdentifier("scene");
		pMainSceneViewport->SetScene(pMainScene);
		pMainSceneViewport->SetPosition("_fi", 0, 0, 0, 0);
		pMainSceneViewport->SetEyeMode(STEREO_EYE_NORMAL);
		SetViewportCount(2);
	}
}