From 9d18fd1188e1a3e2d5a58fada0a26ae4107dcfe7 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Mon, 12 Oct 2015 23:18:18 +0200 Subject: BGE: support camera scale, can be negative. Camera scale was previously ignored in the BGE. It is now injected in the modelview matrix as a scale of the scene coordinates in the camera local reference. This is equivalent to a zoom: A scale of 2 multiplies the coordinates by 2 => only the points with coordinates less then 0.5 before the scale will fall in the frustrum => equivalent to a zoom. Anisotropic scale is supported (different scale in x, y, z) Negative scale is also supported. As an odd number of negative scale flips the normals of the objects, the OGL front face setting is also flipped to compensate. A Y negative scale of -1 produces a vertical flip at OGL level. --- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/gameengine/Ketsji/KX_KetsjiEngine.cpp') diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index c9b868d4ff6..0cdaa28d528 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -1203,7 +1203,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) MT_Transform camtrans(cam->GetWorldToCamera()); MT_Matrix4x4 viewmat(camtrans); - m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->GetCameraData()->m_perspective); + m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->NodeGetLocalScaling(), cam->GetCameraData()->m_perspective); cam->SetModelviewMatrix(viewmat); // The following actually reschedules all vertices to be -- cgit v1.2.3