diff --git a/source/terrain/Camera.cpp b/source/terrain/Camera.cpp index 0d29112dd6..a94a55bcc7 100755 --- a/source/terrain/Camera.cpp +++ b/source/terrain/Camera.cpp @@ -15,35 +15,32 @@ CCamera::CCamera () { -#ifdef WIDEASPECT - m_ViewPort.m_Width = 1440; - m_ViewPort.m_Height = 900; -#else - m_ViewPort.m_Width = 1600; - m_ViewPort.m_Height = 1200; -#endif + // set viewport to something anything should handle, but should be initialised + // to window size before use m_ViewPort.m_X = 0; m_ViewPort.m_Y = 0; + m_ViewPort.m_Width = 800; + m_ViewPort.m_Height = 600; } CCamera::~CCamera () { } - + void CCamera::SetProjection (float nearp, float farp, float fov) { float h, w, Q; - + m_NearPlane = nearp; m_FarPlane = farp; m_FOV = fov; - + float Aspect = (float)m_ViewPort.m_Width/(float)m_ViewPort.m_Height; w = 1/tanf (fov*0.5f*Aspect); h = 1/tanf (fov*0.5f); Q = m_FarPlane / (m_FarPlane - m_NearPlane); - + m_ProjMat.SetZero (); m_ProjMat._11 = w; m_ProjMat._22 = h; @@ -61,7 +58,7 @@ void CCamera::UpdateFrustum () CMatrix3D MatView; MatView = m_Orientation.GetTranspose (); - + MatFinal = m_ProjMat * MatView; //get the RIGHT plane