diff options
-rw-r--r-- | source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 11 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 25 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.h | 5 |
3 files changed, 25 insertions, 16 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 91382669d5c..e3c8c894033 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -359,25 +359,22 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c } // some blender stuff - float camzoom; + float camzoom = 1.0f; int draw_letterbox = 0; - + if (rv3d->persp==RV3D_CAMOB) { if (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */ - camzoom = 1.0f; draw_letterbox = 1; } else { camzoom = 1.0f / BKE_screen_view3d_zoom_to_fac(rv3d->camzoom); } } - else { - camzoom = 2.0; - } rasterizer->SetDrawingMode(drawtype); ketsjiengine->SetCameraZoom(camzoom); - + ketsjiengine->SetCameraOverrideZoom(2.0f); + // if we got an exitcode 3 (KX_EXIT_REQUEST_START_OTHER_GAME) load a different file if (exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME || exitrequested == KX_EXIT_REQUEST_RESTART_GAME) { diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index f42e3e104ac..5f36a980a53 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -146,6 +146,7 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system) m_overrideCamUseOrtho(false), m_overrideCamNear(0.0), m_overrideCamFar(0.0), + m_overrideCamZoom(1.0f), m_stereo(false), m_curreye(0), @@ -976,6 +977,11 @@ void KX_KetsjiEngine::SetCameraOverrideLens(float lens) m_overrideCamLens = lens; } +void KX_KetsjiEngine::SetCameraOverrideZoom(float camzoom) +{ + m_overrideCamZoom = camzoom; +} + void KX_KetsjiEngine::GetSceneViewport(KX_Scene *scene, KX_Camera* cam, RAS_Rect& area, RAS_Rect& viewport) { // In this function we make sure the rasterizer settings are upto @@ -1154,6 +1160,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) farfrust = m_overrideCamFar; } + float camzoom = override_camera ? m_overrideCamZoom : m_cameraZoom; if (orthographic) { RAS_FramingManager::ComputeOrtho( @@ -1169,10 +1176,10 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) frustum ); if (!cam->GetViewport()) { - frustum.x1 *= m_cameraZoom; - frustum.x2 *= m_cameraZoom; - frustum.y1 *= m_cameraZoom; - frustum.y2 *= m_cameraZoom; + frustum.x1 *= camzoom; + frustum.x2 *= camzoom; + frustum.y1 *= camzoom; + frustum.y2 *= camzoom; } projmat = m_rasterizer->GetOrthoMatrix( frustum.x1, frustum.x2, frustum.y1, frustum.y2, frustum.camnear, frustum.camfar); @@ -1194,10 +1201,10 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) ); if (!cam->GetViewport()) { - frustum.x1 *= m_cameraZoom; - frustum.x2 *= m_cameraZoom; - frustum.y1 *= m_cameraZoom; - frustum.y2 *= m_cameraZoom; + frustum.x1 *= camzoom; + frustum.x2 *= camzoom; + frustum.y1 *= camzoom; + frustum.y2 *= camzoom; } projmat = m_rasterizer->GetFrustumMatrix( frustum.x1, frustum.x2, frustum.y1, frustum.y2, frustum.camnear, frustum.camfar, focallength); @@ -1242,7 +1249,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) //render all the font objects for this scene scene->RenderFonts(); - + if (scene->GetPhysicsEnvironment()) scene->GetPhysicsEnvironment()->DebugDrawWorld(); } diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h index 04e09c8db15..ec855be3212 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h @@ -140,6 +140,8 @@ private: float m_overrideCamNear; float m_overrideCamFar; float m_overrideCamLens; + /// Default camera zoom. + float m_overrideCamZoom; bool m_stereo; int m_curreye; @@ -266,6 +268,7 @@ public: void GetSceneViewport(KX_Scene* scene, KX_Camera* cam, RAS_Rect& area, RAS_Rect& viewport); + /// Sets zoom for camera objects, useful only with extend and scale framing mode. void SetCameraZoom(float camzoom); void EnableCameraOverride(const STR_String& forscene); @@ -275,6 +278,8 @@ public: void SetCameraOverrideViewMatrix(const MT_CmMatrix4x4& mat); void SetCameraOverrideClipping(float near, float far); void SetCameraOverrideLens(float lens); + /// Sets zoom for default camera, = 2 in embedded mode. + void SetCameraOverrideZoom(float camzoom); // Update animations for object in this scene void UpdateAnimations(KX_Scene *scene); |