Skip to content

Commit

Permalink
fix #5175
Browse files Browse the repository at this point in the history
  • Loading branch information
rtri committed Mar 17, 2016
1 parent 6408f6a commit c82e075
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 135 deletions.
8 changes: 4 additions & 4 deletions rts/Game/Camera.cpp
Expand Up @@ -103,7 +103,7 @@ void CCamera::Update(bool updateDirs, bool updateMats, bool updatePort)
if (updateDirs)
UpdateDirsFromRot(rot);
if (updateMats)
UpdateMatrices();
UpdateMatrices(globalRendering->viewSizeX, globalRendering->viewSizeY, globalRendering->aspectRatio);
if (updatePort)
UpdateViewPort(globalRendering->viewPosX, 0, globalRendering->viewSizeX, globalRendering->viewSizeY);

Expand Down Expand Up @@ -154,15 +154,15 @@ void CCamera::UpdateFrustum()
}
}

void CCamera::UpdateMatrices()
void CCamera::UpdateMatrices(unsigned int vsx, unsigned int vsy, float var)
{
// recalculate the projection transform
switch (projType) {
case PROJTYPE_PERSP: {
gluPerspectiveSpring(globalRendering->aspectRatio, frustumScales.z, frustumScales.w);
gluPerspectiveSpring(var, frustumScales.z, frustumScales.w);
} break;
case PROJTYPE_ORTHO: {
glOrthoScaledSpring(globalRendering->viewSizeX, globalRendering->viewSizeY, frustumScales.z, frustumScales.w);
glOrthoScaledSpring(vsx, vsy, frustumScales.z, frustumScales.w);
} break;
default: {
assert(false);
Expand Down
2 changes: 1 addition & 1 deletion rts/Game/Camera.h
Expand Up @@ -188,7 +188,7 @@ class CCamera
public:
void UpdateViewRange();
void UpdateFrustum();
void UpdateMatrices();
void UpdateMatrices(unsigned int vsx, unsigned int vsy, float var);
void UpdateViewPort(int px, int py, int sx, int sy);

private:
Expand Down

0 comments on commit c82e075

Please sign in to comment.