mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0026676: Visualization, Ray Tracing - correct rendering if stereo pair
- Fixed interpolation of ray direction vector for asymmetric frustum (stereo left/right eye). Unnecessary normalization of direction vector affecting the frustum's geometry was removed. - Fixed usage of projection type argument passed when rendering immediate graphics with stereo projection.
This commit is contained in:
parent
c357e42610
commit
b0dc79bc7d
@ -1722,17 +1722,13 @@ void OpenGl_View::updateCamera (const OpenGl_Mat4& theOrientation,
|
|||||||
|
|
||||||
aDirect = aDirect - aOrigin;
|
aDirect = aDirect - aOrigin;
|
||||||
|
|
||||||
GLdouble aInvLen = 1.0 / sqrt (aDirect.x() * aDirect.x() +
|
|
||||||
aDirect.y() * aDirect.y() +
|
|
||||||
aDirect.z() * aDirect.z());
|
|
||||||
|
|
||||||
theOrigins[aOriginIndex++] = OpenGl_Vec3 (static_cast<GLfloat> (aOrigin.x()),
|
theOrigins[aOriginIndex++] = OpenGl_Vec3 (static_cast<GLfloat> (aOrigin.x()),
|
||||||
static_cast<GLfloat> (aOrigin.y()),
|
static_cast<GLfloat> (aOrigin.y()),
|
||||||
static_cast<GLfloat> (aOrigin.z()));
|
static_cast<GLfloat> (aOrigin.z()));
|
||||||
|
|
||||||
theDirects[aDirectIndex++] = OpenGl_Vec3 (static_cast<GLfloat> (aDirect.x() * aInvLen),
|
theDirects[aDirectIndex++] = OpenGl_Vec3 (static_cast<GLfloat> (aDirect.x()),
|
||||||
static_cast<GLfloat> (aDirect.y() * aInvLen),
|
static_cast<GLfloat> (aDirect.y()),
|
||||||
static_cast<GLfloat> (aDirect.z() * aInvLen));
|
static_cast<GLfloat> (aDirect.z()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,7 @@ void OpenGl_View::Redraw()
|
|||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
aCtx->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_LEFT : GL_BACK);
|
aCtx->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_LEFT : GL_BACK);
|
||||||
#endif
|
#endif
|
||||||
if (!redrawImmediate (aProjectType, aMainFbos[0], anImmFbos[0]))
|
if (!redrawImmediate (Graphic3d_Camera::Projection_MonoLeftEye, aMainFbos[0], anImmFbos[0]))
|
||||||
{
|
{
|
||||||
toSwap = false;
|
toSwap = false;
|
||||||
}
|
}
|
||||||
@ -400,7 +400,7 @@ void OpenGl_View::Redraw()
|
|||||||
redraw (Graphic3d_Camera::Projection_MonoRightEye, aMainFbos[1]);
|
redraw (Graphic3d_Camera::Projection_MonoRightEye, aMainFbos[1]);
|
||||||
myBackBufferRestored = Standard_True;
|
myBackBufferRestored = Standard_True;
|
||||||
myIsImmediateDrawn = Standard_False;
|
myIsImmediateDrawn = Standard_False;
|
||||||
if (!redrawImmediate (aProjectType, aMainFbos[1], anImmFbos[1]))
|
if (!redrawImmediate (Graphic3d_Camera::Projection_MonoRightEye, aMainFbos[1], anImmFbos[1]))
|
||||||
{
|
{
|
||||||
toSwap = false;
|
toSwap = false;
|
||||||
}
|
}
|
||||||
|
31
tests/bugs/vis/bug26676
Normal file
31
tests/bugs/vis/bug26676
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "CR26676"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# 0026676: Visualization, Ray Tracing - correct rendering if stereo pair
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
vinit View1 w=400 h=400
|
||||||
|
vclear
|
||||||
|
|
||||||
|
box b 1 2 50
|
||||||
|
vraytrace 0
|
||||||
|
vaxo
|
||||||
|
vsetdispmode 1
|
||||||
|
vdisplay b
|
||||||
|
vcamera -persp
|
||||||
|
vfit
|
||||||
|
vrotate 0 -1.2 0
|
||||||
|
vzoom 1.2
|
||||||
|
|
||||||
|
vstereo -anaglyph redCyan
|
||||||
|
vcamera -iod
|
||||||
|
vcamera -iod 0.3
|
||||||
|
|
||||||
|
vraytrace 1
|
||||||
|
|
||||||
|
vselect 200 350
|
||||||
|
|
||||||
|
vdump ${imagedir}/${casename}.png -stereo blend
|
Loading…
x
Reference in New Issue
Block a user