/************************************************************************* Positions the GeometryBuffer based graph *************************************************************************/ void CustomShapesDrawingSample::positionCustomGeometryFPSGraph() { CEGUI::Renderer* renderer = CEGUI::System::getSingleton().getRenderer(); const CEGUI::Rectf scrn(glm::vec2(0, 0), renderer->getDisplaySize()); d_FPSGraphGeometryBuffer->setClippingRegion(scrn); d_FPSGraphGeometryBuffer->setTranslation(glm::vec3(250.0f, 250.0f, 0.0f)); }
Layer2D::Layer2D():m_pRootBuff(&CEGUI::System::getSingleton().getGUISheet()->getGeometryBuffer()),m_pCustomBuff(0), m_IsMatrixValid(false) { CEGUI::Renderer *pCEGUIRender = CEGUI::System::getSingleton().getRenderer(); const CEGUI::Rect scrn(CEGUI::Vector2(0, 0), pCEGUIRender->getDisplaySize()); //render::Interface *pInterface = render::Interface::GetInstance(); //LPDIRECT3DDEVICE9 pDevice = pInterface->GetDevice(); //m_p2DBuff = new CEGUI::Direct3D9GeometryBuffer(pDevice); m_pRootBuff->setClippingRegion(scrn); }
void Layer2D::SetupView() { CEGUI::Renderer *pRender = CEGUI::System::getSingleton().getRenderer(); float width = pRender->getDisplaySize().d_width; float height = pRender->getDisplaySize().d_height; if (!m_IsMatrixValid) { const float fov = 0.523598776f; const float w = width; const float h = height; const float aspect = w / h; const float midx = w * 0.5f; const float midy = h * 0.5f; float fviewDistance = midx / (aspect * 0.267949192431123f); D3DXVECTOR3 eye(midx, midy, -fviewDistance); D3DXVECTOR3 at(midx, midy, 1); D3DXVECTOR3 up(0, -1, 0); D3DXMATRIX tmp; D3DXMatrixMultiply(&m_matrix, D3DXMatrixLookAtRH(&m_matrix, &eye, &at, &up), D3DXMatrixPerspectiveFovRH(&tmp, fov, aspect, fviewDistance * 0.5f, fviewDistance * 2.0f)); m_IsMatrixValid = true; } render::Interface *pInterface = render::Interface::GetInstance(); LPDIRECT3DDEVICE9 pDevice = pInterface->GetDevice(); D3DVIEWPORT9 vp; vp.X = static_cast<DWORD>(0); vp.Y = static_cast<DWORD>(0); vp.Width = static_cast<DWORD>(width); vp.Height = static_cast<DWORD>(height); vp.MinZ = 0.0f; vp.MaxZ = 1.0f; pDevice->SetViewport(&vp); pDevice->SetTransform(D3DTS_PROJECTION, &m_matrix); }