diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2015-06-29 16:45:27 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2015-06-29 16:45:27 +0300 |
commit | f12b1790a0f4bb26d99ca151f8794a179e151987 (patch) | |
tree | 39bb3cf3c85fbd8c91df5e867e38a477958004d9 /source/gameengine/Ketsji | |
parent | 3d12d4b94f9bff6ea810179e22a5e3e018541f31 (diff) |
Fix 73841 : Game Engine - Camera Lens Shift
This is essential for video projection, and the alternative until now was to manually change the projection matrix via Python.
( http://www.blender.org/manual/game_engine/camera/introduction.html#camera-lens-shift
- this page will be removed as soon as I commit this)
Also this is working for perspective and orto cameras BUT if the sensor is not AUTO it will only look correct in blenderplayer (this is an unrelated bug, but just in case someone runs into it while testing this, now you know why you got the issue).
Kudos for the BlenderVR project for supporting this feature development.
Differential Revision: https://developer.blender.org/D1379
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_Camera.cpp | 16 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Camera.h | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 4 |
3 files changed, 24 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 4456345e1d9..70bcf505f2e 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -224,6 +224,22 @@ short KX_Camera::GetSensorFit() const return m_camdata.m_sensor_fit; } +/** + * Gets the horizontal shift of the sensor - for camera matching. + */ +float KX_Camera::GetShiftHorizontal() const +{ + return m_camdata.m_shift_x; +} + +/** + * Gets the vertical shift of the sensor - for camera matching. + */ +float KX_Camera::GetShiftVertical() const +{ + return m_camdata.m_shift_y; +} + float KX_Camera::GetCameraNear() const { return m_camdata.m_clipstart; diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h index eeb836c44b8..41d0172f2cd 100644 --- a/source/gameengine/Ketsji/KX_Camera.h +++ b/source/gameengine/Ketsji/KX_Camera.h @@ -206,6 +206,10 @@ public: float GetSensorHeight() const; /** Gets the mode FOV is calculating from sensor dimensions */ short GetSensorFit() const; + /** Gets the horizontal shift of the sensor - for camera matching */ + float GetShiftHorizontal() const; + /** Gets the vertical shift of the sensor - for camera matching */ + float GetShiftVertical() const; /** Gets the near clip distance. */ float GetCameraNear() const; /** Gets the far clip distance. */ diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index be0cd8433f7..91963713dad 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -1159,6 +1159,8 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) nearfrust, farfrust, cam->GetSensorFit(), + cam->GetShiftHorizontal(), + cam->GetShiftVertical(), frustum ); if (!cam->GetViewport()) { @@ -1179,6 +1181,8 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) cam->GetSensorWidth(), cam->GetSensorHeight(), cam->GetSensorFit(), + cam->GetShiftHorizontal(), + cam->GetShiftVertical(), nearfrust, farfrust, frustum |