0028198: Add FPE signals enabling from CMake
[occt.git] / src / Graphic3d / Graphic3d_RenderingParams.hxx
CommitLineData
bc8c79bb 1// Created on: 2014-05-14
2// Created by: Denis BOGOLEPOV
3// Copyright (c) 2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _Graphic3d_RenderingParams_HeaderFile
17#define _Graphic3d_RenderingParams_HeaderFile
18
19#include <Graphic3d_RenderingMode.hxx>
f978241f 20#include <Graphic3d_StereoMode.hxx>
21#include <Graphic3d_Mat4.hxx>
22#include <Graphic3d_Vec4.hxx>
bc8c79bb 23
24//! Helper class to store rendering parameters.
25class Graphic3d_RenderingParams
26{
27public:
4b1c8733 28 //! Default pixels density.
29 static const unsigned int THE_DEFAULT_RESOLUTION = 72u;
bc8c79bb 30
31 //! Default ray-tracing depth.
32 static const Standard_Integer THE_DEFAULT_DEPTH = 3;
33
f978241f 34 //! Anaglyph filter presets.
35 enum Anaglyph
36 {
37 Anaglyph_RedCyan_Simple, //!< simple filter for Red-Cyan glasses (R+GB)
38 Anaglyph_RedCyan_Optimized, //!< optimized filter for Red-Cyan glasses (R+GB)
39 Anaglyph_YellowBlue_Simple, //!< simple filter for Yellow-Blue glasses (RG+B)
40 Anaglyph_YellowBlue_Optimized, //!< optimized filter for Yellow-Blue glasses (RG+B)
41 Anaglyph_GreenMagenta_Simple, //!< simple filter for Green-Magenta glasses (G+RB)
42 Anaglyph_UserDefined //!< use externally specified matrices
43 };
44
bc8c79bb 45public:
46
47 //! Creates default rendering parameters.
48 Graphic3d_RenderingParams()
189f85a3 49 : Method (Graphic3d_RM_RASTERIZATION),
3c4b62a4 50 NbMsaaSamples (0),
51 // ray tracing parameters
f978241f 52 IsGlobalIlluminationEnabled (Standard_False),
f978241f 53 RaytracingDepth (THE_DEFAULT_DEPTH),
189f85a3 54 IsShadowEnabled (Standard_True),
55 IsReflectionEnabled (Standard_False),
56 IsAntialiasingEnabled (Standard_False),
57 IsTransparentShadowEnabled (Standard_False),
f978241f 58 UseEnvironmentMapBackground (Standard_False),
8c820969 59 CoherentPathTracingMode (Standard_False),
3a9b5dc8 60 AdaptiveScreenSampling (Standard_False),
61 ShowSamplingTiles (Standard_False),
b4327ba8 62 TwoSidedBsdfModels (Standard_False),
d877e610 63 RebuildRayTracingShaders (Standard_False),
3c4b62a4 64 // stereoscopic parameters
f978241f 65 StereoMode (Graphic3d_StereoMode_QuadBuffer),
66 AnaglyphFilter (Anaglyph_RedCyan_Optimized),
4b1c8733 67 ToReverseStereo (Standard_False),
68
69 Resolution (THE_DEFAULT_RESOLUTION)
bc8c79bb 70 {
f978241f 71 const Graphic3d_Vec4 aZero (0.0f, 0.0f, 0.0f, 0.0f);
72 AnaglyphLeft .SetRow (0, Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f));
73 AnaglyphLeft .SetRow (1, aZero);
74 AnaglyphLeft .SetRow (2, aZero);
75 AnaglyphLeft .SetRow (3, aZero);
76 AnaglyphRight.SetRow (0, aZero);
77 AnaglyphRight.SetRow (1, Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
78 AnaglyphRight.SetRow (2, Graphic3d_Vec4 (0.0f, 0.0f, 1.0f, 0.0f));
79 AnaglyphRight.SetRow (3, aZero);
bc8c79bb 80 }
81
75c262a9 82 //! Returns resolution ratio.
83 Standard_ShortReal ResolutionRatio() const
84 {
85 return Resolution / static_cast<Standard_ShortReal> (THE_DEFAULT_RESOLUTION);
86 }
87
bc8c79bb 88public:
89
f978241f 90 Graphic3d_RenderingMode Method; //!< specifies rendering mode, Graphic3d_RM_RASTERIZATION by default
3c4b62a4 91 Standard_Integer NbMsaaSamples; //!< number of MSAA samples (should be within 0..GL_MAX_SAMPLES, power-of-two number), 0 by default
f978241f 92
93 Standard_Boolean IsGlobalIlluminationEnabled; //!< enables/disables global illumination effects (path tracing)
94 Standard_Integer SamplesPerPixel; //!< number of samples per pixel (SPP)
95 Standard_Integer RaytracingDepth; //!< maximum ray-tracing depth, 3 by default
96 Standard_Boolean IsShadowEnabled; //!< enables/disables shadows rendering, True by default
97 Standard_Boolean IsReflectionEnabled; //!< enables/disables specular reflections, False by default
98 Standard_Boolean IsAntialiasingEnabled; //!< enables/disables adaptive anti-aliasing, False by default
99 Standard_Boolean IsTransparentShadowEnabled; //!< enables/disables light propagation through transparent media, False by default
100 Standard_Boolean UseEnvironmentMapBackground; //!< enables/disables environment map background
8c820969 101 Standard_Boolean CoherentPathTracingMode; //!< enables/disables 'coherent' tracing mode (single RNG seed within 16x16 image blocks)
3a9b5dc8 102 Standard_Boolean AdaptiveScreenSampling; //!< enables/disables adaptive screen sampling mode for path tracing, FALSE by default
103 Standard_Boolean ShowSamplingTiles; //!< enables/disables debug mode for adaptive screen sampling, FALSE by default
b4327ba8 104 Standard_Boolean TwoSidedBsdfModels; //!< forces path tracing to use two-sided versions of original one-sided scattering models
d877e610 105 Standard_Boolean RebuildRayTracingShaders; //!< forces rebuilding ray tracing shaders at the next frame
f978241f 106
107 Graphic3d_StereoMode StereoMode; //!< stereoscopic output mode, Graphic3d_StereoMode_QuadBuffer by default
108 Anaglyph AnaglyphFilter; //!< filter for anaglyph output, Anaglyph_RedCyan_Optimized by default
109 Graphic3d_Mat4 AnaglyphLeft; //!< left anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft;
110 Graphic3d_Mat4 AnaglyphRight; //!< right anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft;
111 Standard_Boolean ToReverseStereo; //!< flag to reverse stereo pair, FALSE by default
189f85a3 112
4b1c8733 113 unsigned int Resolution; //!< Pixels density (PPI), defines scaling factor for parameters like text size
114 //!< (when defined in screen-space units rather than in 3D) to be properly displayed
115 //!< on device (screen / printer). 72 is default value.
116 //!< Note that using difference resolution in different Views in same Viewer
117 //!< will lead to performance regression (for example, text will be recreated every time).
118
bc8c79bb 119};
120
121#endif // _Graphic3d_RenderingParams_HeaderFile