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/VideoTexture/ImageRender.cpp | |
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/VideoTexture/ImageRender.cpp')
-rw-r--r-- | source/gameengine/VideoTexture/ImageRender.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp index 0850995eaaf..797313366cd 100644 --- a/source/gameengine/VideoTexture/ImageRender.cpp +++ b/source/gameengine/VideoTexture/ImageRender.cpp @@ -240,6 +240,8 @@ void ImageRender::Render() float lens = m_camera->GetLens(); float sensor_x = m_camera->GetSensorWidth(); float sensor_y = m_camera->GetSensorHeight(); + float shift_x = m_camera->GetShiftHorizontal(); + float shift_y = m_camera->GetShiftVertical(); bool orthographic = !m_camera->GetCameraData()->m_perspective; float nearfrust = m_camera->GetCameraNear(); float farfrust = m_camera->GetCameraFar(); @@ -260,6 +262,8 @@ void ImageRender::Render() m_camera->GetScale(), aspect_ratio, m_camera->GetSensorFit(), + shift_x, + shift_y, frustrum ); @@ -274,6 +278,8 @@ void ImageRender::Render() sensor_x, sensor_y, RAS_SENSORFIT_AUTO, + shift_x, + shift_y, aspect_ratio, frustrum); |