Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/GameView.cpp
Show First 20 Lines • Show All 356 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
SViewPort vp; | SViewPort vp; | ||||
vp.m_X = 0; | vp.m_X = 0; | ||||
vp.m_Y = 0; | vp.m_Y = 0; | ||||
vp.m_Width = g_xres; | vp.m_Width = g_xres; | ||||
vp.m_Height = g_yres; | vp.m_Height = g_yres; | ||||
m->ViewCamera.SetViewPort(vp); | m->ViewCamera.SetViewPort(vp); | ||||
m->ViewCamera.SetProjection(m->ViewNear, m->ViewFar, m->ViewFOV); | m->ViewCamera.SetPerspective(m->ViewNear, m->ViewFar, m->ViewFOV); | ||||
SetupCameraMatrixSmooth(m, &m->ViewCamera.m_Orientation); | SetupCameraMatrixSmooth(m, &m->ViewCamera.m_Orientation); | ||||
m->ViewCamera.UpdateFrustum(); | m->ViewCamera.UpdateFrustum(); | ||||
m->CullCamera = m->ViewCamera; | m->CullCamera = m->ViewCamera; | ||||
g_Renderer.SetSceneCamera(m->ViewCamera, m->CullCamera); | g_Renderer.SetSceneCamera(m->ViewCamera, m->CullCamera); | ||||
} | } | ||||
CGameView::~CGameView() | CGameView::~CGameView() | ||||
{ | { | ||||
UnloadResources(); | UnloadResources(); | ||||
delete m; | delete m; | ||||
} | } | ||||
void CGameView::SetViewport(const SViewPort& vp) | void CGameView::SetViewport(const SViewPort& vp) | ||||
{ | { | ||||
m->ViewCamera.SetViewPort(vp); | m->ViewCamera.SetViewPort(vp); | ||||
m->ViewCamera.SetProjection(m->ViewNear, m->ViewFar, m->ViewFOV); | m->ViewCamera.SetPerspective(m->ViewNear, m->ViewFar, m->ViewFOV); | ||||
} | } | ||||
CObjectManager& CGameView::GetObjectManager() | CObjectManager& CGameView::GetObjectManager() | ||||
{ | { | ||||
return m->ObjectManager; | return m->ObjectManager; | ||||
} | } | ||||
CCamera* CGameView::GetCamera() | CCamera* CGameView::GetCamera() | ||||
▲ Show 20 Lines • Show All 490 Lines • ▼ Show 20 Lines | if (m->ConstrainCamera) | ||||
if (nearPoint.Y < limit) | if (nearPoint.Y < limit) | ||||
m->PosY.AddSmoothly(limit - nearPoint.Y); | m->PosY.AddSmoothly(limit - nearPoint.Y); | ||||
} | } | ||||
*/ | */ | ||||
m->RotateY.Wrap(-(float)M_PI, (float)M_PI); | m->RotateY.Wrap(-(float)M_PI, (float)M_PI); | ||||
// Update the camera matrix | // Update the camera matrix | ||||
m->ViewCamera.SetProjection(m->ViewNear, m->ViewFar, m->ViewFOV); | m->ViewCamera.SetPerspective(m->ViewNear, m->ViewFar, m->ViewFOV); | ||||
SetupCameraMatrixSmooth(m, &m->ViewCamera.m_Orientation); | SetupCameraMatrixSmooth(m, &m->ViewCamera.m_Orientation); | ||||
m->ViewCamera.UpdateFrustum(); | m->ViewCamera.UpdateFrustum(); | ||||
} | } | ||||
CVector3D CGameView::GetCameraPivot() const | CVector3D CGameView::GetCameraPivot() const | ||||
{ | { | ||||
return GetSmoothPivot(m->ViewCamera); | return GetSmoothPivot(m->ViewCamera); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | |||||
float CGameView::GetFOV() const | float CGameView::GetFOV() const | ||||
{ | { | ||||
return m->ViewFOV; | return m->ViewFOV; | ||||
} | } | ||||
void CGameView::SetCameraProjection() | void CGameView::SetCameraProjection() | ||||
{ | { | ||||
m->ViewCamera.SetProjection(m->ViewNear, m->ViewFar, m->ViewFOV); | m->ViewCamera.SetPerspective(m->ViewNear, m->ViewFar, m->ViewFOV); | ||||
} | } | ||||
InReaction game_view_handler(const SDL_Event_* ev) | InReaction game_view_handler(const SDL_Event_* ev) | ||||
{ | { | ||||
// put any events that must be processed even if inactive here | // put any events that must be processed even if inactive here | ||||
if (!g_app_has_focus || !g_Game || !g_Game->IsGameStarted() || g_Game->GetView()->GetCinema()->IsEnabled()) | if (!g_app_has_focus || !g_Game || !g_Game->IsGameStarted() || g_Game->GetView()->GetCinema()->IsEnabled()) | ||||
return IN_PASS; | return IN_PASS; | ||||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator