1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025556: Visualization - support stereo pair formats recognized by consumer display devices

Graphic3d_StereoMode - add new enumeration for stereoscopic outputs:
- Graphic3d_StereoMode_QuadBuffer
- Graphic3d_StereoMode_Anaglyph
- Graphic3d_StereoMode_RowInterlaced
- Graphic3d_StereoMode_ColumnInterlaced
- Graphic3d_StereoMode_ChessBoard
- Graphic3d_StereoMode_SideBySide
- Graphic3d_StereoMode_OverUnder

Graphic3d_RenderingParams - add new options controlling stereo output:
- StereoMode
- ToReverseStereo
- AnaglyphFilter

OpenGl_ShaderManager - add predefined GLSL programs for new stereo outputs.
OpenGl_Workspace::Redraw() - do not implicitly disable stereo to allow stereo dump as is.
OpenGl_Caps - add flag swapInterval to control VSync.
OpenGl_Workspace::BufferDump() - handle cases with non-applicable GL_PACK_ROW_LENGTH.

CALL_DEF_WINDOW - drop unused fields; add fields "left" and "top"
to reverse stereo pair for interlaced output depending on window position.

Draw Harness, ViewerTest:
- Extend syntax of command vstereo to setup stereo.
- Extend vdump command to allow dump of stereoscopic pair in different formats.
- Extend command vcaps with option vsync.
- Use mouse scroll to zoom and adjust ZFocus in WinAPI.
- Use "/" and "*" to adjust IOD.

v3d/glsl/stereo - add test case for stereo modes.

Cocoa_LocalPool, OSD_EnvironmentIterator - fix compilation issues on OS X Snow Leopard.
This commit is contained in:
kgv
2015-06-20 16:08:12 +03:00
parent f809e94b93
commit f978241fb6
30 changed files with 1160 additions and 229 deletions

View File

@@ -30,6 +30,7 @@ Graphic3d_ShaderProgram.cxx
Graphic3d_ShaderVariable.hxx
Graphic3d_ShaderVariable.cxx
Graphic3d_ShaderVariable.lxx
Graphic3d_StereoMode.hxx
Graphic3d_MapOfStructure.hxx
Graphic3d_MapIteratorOfMapOfStructure.hxx
Graphic3d_IndexedMapOfAddress.hxx

View File

@@ -17,6 +17,9 @@
#define _Graphic3d_RenderingParams_HeaderFile
#include <Graphic3d_RenderingMode.hxx>
#include <Graphic3d_StereoMode.hxx>
#include <Graphic3d_Mat4.hxx>
#include <Graphic3d_Vec4.hxx>
//! Helper class to store rendering parameters.
class Graphic3d_RenderingParams
@@ -29,51 +32,64 @@ public:
//! Default ray-tracing depth.
static const Standard_Integer THE_DEFAULT_DEPTH = 3;
//! Anaglyph filter presets.
enum Anaglyph
{
Anaglyph_RedCyan_Simple, //!< simple filter for Red-Cyan glasses (R+GB)
Anaglyph_RedCyan_Optimized, //!< optimized filter for Red-Cyan glasses (R+GB)
Anaglyph_YellowBlue_Simple, //!< simple filter for Yellow-Blue glasses (RG+B)
Anaglyph_YellowBlue_Optimized, //!< optimized filter for Yellow-Blue glasses (RG+B)
Anaglyph_GreenMagenta_Simple, //!< simple filter for Green-Magenta glasses (G+RB)
Anaglyph_UserDefined //!< use externally specified matrices
};
public:
//! Creates default rendering parameters.
Graphic3d_RenderingParams()
: Method (Graphic3d_RM_RASTERIZATION),
RaytracingDepth (THE_DEFAULT_DEPTH),
IsGlobalIlluminationEnabled (Standard_False),
SamplesPerPixel (THE_DEFAULT_SPP),
RaytracingDepth (THE_DEFAULT_DEPTH),
IsShadowEnabled (Standard_True),
IsReflectionEnabled (Standard_False),
IsAntialiasingEnabled (Standard_False),
IsTransparentShadowEnabled (Standard_False),
IsGlobalIlluminationEnabled (Standard_False),
UseEnvironmentMapBackground (Standard_False)
UseEnvironmentMapBackground (Standard_False),
StereoMode (Graphic3d_StereoMode_QuadBuffer),
AnaglyphFilter (Anaglyph_RedCyan_Optimized),
ToReverseStereo (Standard_False)
{
//
const Graphic3d_Vec4 aZero (0.0f, 0.0f, 0.0f, 0.0f);
AnaglyphLeft .SetRow (0, Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f));
AnaglyphLeft .SetRow (1, aZero);
AnaglyphLeft .SetRow (2, aZero);
AnaglyphLeft .SetRow (3, aZero);
AnaglyphRight.SetRow (0, aZero);
AnaglyphRight.SetRow (1, Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
AnaglyphRight.SetRow (2, Graphic3d_Vec4 (0.0f, 0.0f, 1.0f, 0.0f));
AnaglyphRight.SetRow (3, aZero);
}
public:
//! Specifies rendering mode.
Graphic3d_RenderingMode Method;
Graphic3d_RenderingMode Method; //!< specifies rendering mode, Graphic3d_RM_RASTERIZATION by default
//! Maximum ray-tracing depth.
Standard_Integer RaytracingDepth;
Standard_Boolean IsGlobalIlluminationEnabled; //!< enables/disables global illumination effects (path tracing)
Standard_Integer SamplesPerPixel; //!< number of samples per pixel (SPP)
Standard_Integer RaytracingDepth; //!< maximum ray-tracing depth, 3 by default
Standard_Boolean IsShadowEnabled; //!< enables/disables shadows rendering, True by default
Standard_Boolean IsReflectionEnabled; //!< enables/disables specular reflections, False by default
Standard_Boolean IsAntialiasingEnabled; //!< enables/disables adaptive anti-aliasing, False by default
Standard_Boolean IsTransparentShadowEnabled; //!< enables/disables light propagation through transparent media, False by default
Standard_Boolean UseEnvironmentMapBackground; //!< enables/disables environment map background
//! Number of samples per pixel (SPP).
Standard_Integer SamplesPerPixel;
//! Enables/disables shadows rendering.
Standard_Boolean IsShadowEnabled;
//! Enables/disables specular reflections.
Standard_Boolean IsReflectionEnabled;
//! Enables/disables adaptive anti-aliasing.
Standard_Boolean IsAntialiasingEnabled;
//! Enables/disables light propagation through transparent media.
Standard_Boolean IsTransparentShadowEnabled;
//! Enables/disables global illumination effects (uses path tracing).
Standard_Boolean IsGlobalIlluminationEnabled;
//! Enables/disables environment map background (instead of OCCT background).
Standard_Boolean UseEnvironmentMapBackground;
Graphic3d_StereoMode StereoMode; //!< stereoscopic output mode, Graphic3d_StereoMode_QuadBuffer by default
Anaglyph AnaglyphFilter; //!< filter for anaglyph output, Anaglyph_RedCyan_Optimized by default
Graphic3d_Mat4 AnaglyphLeft; //!< left anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft;
Graphic3d_Mat4 AnaglyphRight; //!< right anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft;
Standard_Boolean ToReverseStereo; //!< flag to reverse stereo pair, FALSE by default
};

View File

@@ -0,0 +1,33 @@
// Created on: 2015-06-05
// Created by: Kirill Gavrilov
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_StereoMode_HeaderFile
#define _Graphic3d_StereoMode_HeaderFile
//! This enumeration defines the list of stereoscopic output modes.
enum Graphic3d_StereoMode
{
Graphic3d_StereoMode_QuadBuffer, //!< OpenGL QuadBuffer
Graphic3d_StereoMode_Anaglyph, //!< Anaglyph glasses, the type should be specified in addition
Graphic3d_StereoMode_RowInterlaced, //!< Row-interlaced stereo
Graphic3d_StereoMode_ColumnInterlaced, //!< Column-interlaced stereo
Graphic3d_StereoMode_ChessBoard, //!< chess-board stereo for DLP TVs
Graphic3d_StereoMode_SideBySide, //!< horizontal pair
Graphic3d_StereoMode_OverUnder, //!< vertical pair
Graphic3d_StereoMode_SoftPageFlip, //!< software PageFlip for shutter glasses, should NOT be used!
Graphic3d_StereoMode_NB //!< the number of modes
};
#endif // _Graphic3d_StereoMode_HeaderFile