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 | |
a1073ae2 |
19 | #include <Graphic3d_Mat4.hxx> |
20 | #include <Graphic3d_RenderTransparentMethod.hxx> |
bc8c79bb |
21 | #include <Graphic3d_RenderingMode.hxx> |
f978241f |
22 | #include <Graphic3d_StereoMode.hxx> |
eb85ed36 |
23 | #include <Graphic3d_ToneMappingMethod.hxx> |
f978241f |
24 | #include <Graphic3d_Vec4.hxx> |
bc8c79bb |
25 | |
26 | //! Helper class to store rendering parameters. |
27 | class Graphic3d_RenderingParams |
28 | { |
29 | public: |
4b1c8733 |
30 | //! Default pixels density. |
31 | static const unsigned int THE_DEFAULT_RESOLUTION = 72u; |
bc8c79bb |
32 | |
33 | //! Default ray-tracing depth. |
34 | static const Standard_Integer THE_DEFAULT_DEPTH = 3; |
35 | |
f978241f |
36 | //! Anaglyph filter presets. |
37 | enum Anaglyph |
38 | { |
39 | Anaglyph_RedCyan_Simple, //!< simple filter for Red-Cyan glasses (R+GB) |
40 | Anaglyph_RedCyan_Optimized, //!< optimized filter for Red-Cyan glasses (R+GB) |
41 | Anaglyph_YellowBlue_Simple, //!< simple filter for Yellow-Blue glasses (RG+B) |
42 | Anaglyph_YellowBlue_Optimized, //!< optimized filter for Yellow-Blue glasses (RG+B) |
43 | Anaglyph_GreenMagenta_Simple, //!< simple filter for Green-Magenta glasses (G+RB) |
44 | Anaglyph_UserDefined //!< use externally specified matrices |
45 | }; |
46 | |
bc8c79bb |
47 | public: |
48 | |
49 | //! Creates default rendering parameters. |
50 | Graphic3d_RenderingParams() |
189f85a3 |
51 | : Method (Graphic3d_RM_RASTERIZATION), |
a1073ae2 |
52 | TransparencyMethod (Graphic3d_RTM_BLEND_UNORDERED), |
53 | OitDepthFactor (0.0f), |
3c4b62a4 |
54 | NbMsaaSamples (0), |
56689b27 |
55 | RenderResolutionScale (1.0f), |
3c4b62a4 |
56 | // ray tracing parameters |
f978241f |
57 | IsGlobalIlluminationEnabled (Standard_False), |
f978241f |
58 | RaytracingDepth (THE_DEFAULT_DEPTH), |
189f85a3 |
59 | IsShadowEnabled (Standard_True), |
60 | IsReflectionEnabled (Standard_False), |
61 | IsAntialiasingEnabled (Standard_False), |
62 | IsTransparentShadowEnabled (Standard_False), |
f978241f |
63 | UseEnvironmentMapBackground (Standard_False), |
8c820969 |
64 | CoherentPathTracingMode (Standard_False), |
3a9b5dc8 |
65 | AdaptiveScreenSampling (Standard_False), |
66 | ShowSamplingTiles (Standard_False), |
b4327ba8 |
67 | TwoSidedBsdfModels (Standard_False), |
b09447ed |
68 | RadianceClampingValue (30.0), |
d877e610 |
69 | RebuildRayTracingShaders (Standard_False), |
4eaaf9d8 |
70 | NbRayTracingTiles (16 * 16), |
eb85ed36 |
71 | ToneMappingMethod (Graphic3d_ToneMappingMethod_Disabled), |
72 | Exposure (0.f), |
73 | WhitePoint (1.f), |
3c4b62a4 |
74 | // stereoscopic parameters |
f978241f |
75 | StereoMode (Graphic3d_StereoMode_QuadBuffer), |
76 | AnaglyphFilter (Anaglyph_RedCyan_Optimized), |
4b1c8733 |
77 | ToReverseStereo (Standard_False), |
78 | |
79 | Resolution (THE_DEFAULT_RESOLUTION) |
bc8c79bb |
80 | { |
f978241f |
81 | const Graphic3d_Vec4 aZero (0.0f, 0.0f, 0.0f, 0.0f); |
82 | AnaglyphLeft .SetRow (0, Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f)); |
83 | AnaglyphLeft .SetRow (1, aZero); |
84 | AnaglyphLeft .SetRow (2, aZero); |
85 | AnaglyphLeft .SetRow (3, aZero); |
86 | AnaglyphRight.SetRow (0, aZero); |
87 | AnaglyphRight.SetRow (1, Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f)); |
88 | AnaglyphRight.SetRow (2, Graphic3d_Vec4 (0.0f, 0.0f, 1.0f, 0.0f)); |
89 | AnaglyphRight.SetRow (3, aZero); |
bc8c79bb |
90 | } |
91 | |
75c262a9 |
92 | //! Returns resolution ratio. |
93 | Standard_ShortReal ResolutionRatio() const |
94 | { |
95 | return Resolution / static_cast<Standard_ShortReal> (THE_DEFAULT_RESOLUTION); |
96 | } |
97 | |
bc8c79bb |
98 | public: |
99 | |
a1073ae2 |
100 | Graphic3d_RenderingMode Method; //!< specifies rendering mode, Graphic3d_RM_RASTERIZATION by default |
101 | Graphic3d_RenderTransparentMethod TransparencyMethod; //!< specifies rendering method for transparent graphics |
102 | Standard_ShortReal OitDepthFactor; //!< scalar factor [0-1] controlling influence of depth of a fragment to its final coverage |
103 | Standard_Integer NbMsaaSamples; //!< number of MSAA samples (should be within 0..GL_MAX_SAMPLES, power-of-two number), 0 by default |
104 | Standard_ShortReal RenderResolutionScale; //!< rendering resolution scale factor, 1 by default; |
105 | //! incompatible with MSAA (e.g. NbMsaaSamples should be set to 0) |
106 | |
107 | Standard_Boolean IsGlobalIlluminationEnabled; //!< enables/disables global illumination effects (path tracing) |
108 | Standard_Integer SamplesPerPixel; //!< number of samples per pixel (SPP) |
109 | Standard_Integer RaytracingDepth; //!< maximum ray-tracing depth, 3 by default |
110 | Standard_Boolean IsShadowEnabled; //!< enables/disables shadows rendering, True by default |
111 | Standard_Boolean IsReflectionEnabled; //!< enables/disables specular reflections, False by default |
112 | Standard_Boolean IsAntialiasingEnabled; //!< enables/disables adaptive anti-aliasing, False by default |
113 | Standard_Boolean IsTransparentShadowEnabled; //!< enables/disables light propagation through transparent media, False by default |
114 | Standard_Boolean UseEnvironmentMapBackground; //!< enables/disables environment map background |
115 | Standard_Boolean CoherentPathTracingMode; //!< enables/disables 'coherent' tracing mode (single RNG seed within 16x16 image blocks) |
116 | Standard_Boolean AdaptiveScreenSampling; //!< enables/disables adaptive screen sampling mode for path tracing, FALSE by default |
117 | Standard_Boolean ShowSamplingTiles; //!< enables/disables debug mode for adaptive screen sampling, FALSE by default |
118 | Standard_Boolean TwoSidedBsdfModels; //!< forces path tracing to use two-sided versions of original one-sided scattering models |
119 | Standard_ShortReal RadianceClampingValue; //!< maximum radiance value used for clamping radiance estimation. |
120 | Standard_Boolean RebuildRayTracingShaders; //!< forces rebuilding ray tracing shaders at the next frame |
121 | Standard_Integer NbRayTracingTiles; //!< total number of screen tiles used in adaptive sampling mode (PT only) |
122 | |
eb85ed36 |
123 | Graphic3d_ToneMappingMethod ToneMappingMethod; //!< specifies tone mapping method for path tracing, Graphic3d_ToneMappingMethod_Disabled by default |
124 | Standard_ShortReal Exposure; //!< exposure value used for tone mapping (path tracing), 0.0 by default |
125 | Standard_ShortReal WhitePoint; //!< white point value used in filmic tone mapping (path tracing), 1.0 by default |
126 | |
a1073ae2 |
127 | Graphic3d_StereoMode StereoMode; //!< stereoscopic output mode, Graphic3d_StereoMode_QuadBuffer by default |
128 | Anaglyph AnaglyphFilter; //!< filter for anaglyph output, Anaglyph_RedCyan_Optimized by default |
129 | Graphic3d_Mat4 AnaglyphLeft; //!< left anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft; |
130 | Graphic3d_Mat4 AnaglyphRight; //!< right anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft; |
131 | Standard_Boolean ToReverseStereo; //!< flag to reverse stereo pair, FALSE by default |
132 | |
133 | unsigned int Resolution; //!< Pixels density (PPI), defines scaling factor for parameters like text size |
134 | //! (when defined in screen-space units rather than in 3D) to be properly displayed |
135 | //! on device (screen / printer). 72 is default value. |
136 | //! Note that using difference resolution in different Views in same Viewer |
137 | //! will lead to performance regression (for example, text will be recreated every time). |
bc8c79bb |
138 | }; |
139 | |
140 | #endif // _Graphic3d_RenderingParams_HeaderFile |