Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2009-12-29 18:47:20 +0300
committerDalai Felinto <dfelinto@gmail.com>2009-12-29 18:47:20 +0300
commite37e3845a1d65501262f21a45b794a53c4c69a00 (patch)
tree763cc3add00a166a24b7be01939bd59d573613ea /source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
parent1cfb5ffb5dfc9fe10273c59d2cb1acffc303af25 (diff)
BGE: stereoscopic settings changes: (1) eye separation is the UI (2) focallength uses camera focallength
Now the default eye separation value is 0.10 (reasonable for games with 1 meter == 1 B.U. The focallength used is the camera focal length (DOF settings). It allow you to even use different focal lengths for different scenes (good for UI) In order to change it you can change the camera focal length or use Rasterizer.setFocalLength. If you use the Rasterizer method it will use this value for all the cameras. ToDo: - Blenderplayer settings - Update wiki documentation (any volunteer)? * Note to stereo fans: I don't have a real stereo environment to test it (other than cheap cyan-red glasses). If you can give it a try in a more robust system and report bugs or problems with BGE current system please let me know. I would be glad to help to make it work 100% by the time Blender 2.5 is out. For the record, BGE is using the method known as 'parallel axis asymmetric frustum perspective projection'. This method is well documented here: http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/stereographics/stereorender/
Diffstat (limited to 'source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp')
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index 336d80507e4..bbccb511249 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -73,7 +73,6 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas)
m_stereomode(RAS_STEREO_NOSTEREO),
m_curreye(RAS_STEREO_LEFTEYE),
m_eyeseparation(0.0),
- m_seteyesep(false),
m_focallength(0.0),
m_setfocallength(false),
m_noOfScanlines(32),
@@ -518,7 +517,6 @@ RAS_IRasterizer::StereoEye RAS_OpenGLRasterizer::GetEye()
void RAS_OpenGLRasterizer::SetEyeSeparation(const float eyeseparation)
{
m_eyeseparation = eyeseparation;
- m_seteyesep = true;
}
float RAS_OpenGLRasterizer::GetEyeSeparation()
@@ -902,26 +900,26 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
if(Stereo())
{
float near_div_focallength;
- // next 2 params should be specified on command line and in Blender publisher
+ float offset;
+
+ // if Rasterizer.setFocalLength is not called we use the camera focallength
if (!m_setfocallength)
- m_focallength = (focallength == 0.f) ? 1.5 * right // derived from example
- : focallength;
- if (!m_seteyesep)
- m_eyeseparation = m_focallength/30; // reasonable value...
+ m_focallength = focallength;
near_div_focallength = frustnear / m_focallength;
+ offset = 0.5 * m_eyeseparation * near_div_focallength;
switch(m_curreye)
{
case RAS_STEREO_LEFTEYE:
- left += 0.5 * m_eyeseparation * near_div_focallength;
- right += 0.5 * m_eyeseparation * near_div_focallength;
+ left += offset;
+ right += offset;
break;
case RAS_STEREO_RIGHTEYE:
- left -= 0.5 * m_eyeseparation * near_div_focallength;
- right -= 0.5 * m_eyeseparation * near_div_focallength;
+ left -= offset;
+ right -= offset;
break;
}
- // leave bottom, top, bottom and top untouched
+ // leave bottom and top untouched
}
glMatrixMode(GL_PROJECTION);