0026437: Visualization - Improve path tracing rendering engine
[occt.git] / src / Graphic3d / Graphic3d_RenderingParams.hxx
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>
20 #include <Graphic3d_StereoMode.hxx>
21 #include <Graphic3d_Mat4.hxx>
22 #include <Graphic3d_Vec4.hxx>
23
24 //! Helper class to store rendering parameters.
25 class Graphic3d_RenderingParams
26 {
27 public:
28
29   //! Default number of samples per pixel.
30   static const Standard_Integer THE_DEFAULT_SPP = 1;
31
32   //! Default ray-tracing depth.
33   static const Standard_Integer THE_DEFAULT_DEPTH = 3;
34
35   //! Anaglyph filter presets.
36   enum Anaglyph
37   {
38     Anaglyph_RedCyan_Simple,       //!< simple    filter for Red-Cyan      glasses (R+GB)
39     Anaglyph_RedCyan_Optimized,    //!< optimized filter for Red-Cyan      glasses (R+GB)
40     Anaglyph_YellowBlue_Simple,    //!< simple    filter for Yellow-Blue   glasses (RG+B)
41     Anaglyph_YellowBlue_Optimized, //!< optimized filter for Yellow-Blue   glasses (RG+B)
42     Anaglyph_GreenMagenta_Simple,  //!< simple    filter for Green-Magenta glasses (G+RB)
43     Anaglyph_UserDefined           //!< use externally specified matrices
44   };
45
46 public:
47
48   //! Creates default rendering parameters.
49   Graphic3d_RenderingParams()
50   : Method                      (Graphic3d_RM_RASTERIZATION),
51     IsGlobalIlluminationEnabled (Standard_False),
52     SamplesPerPixel             (THE_DEFAULT_SPP),
53     RaytracingDepth             (THE_DEFAULT_DEPTH),
54     IsShadowEnabled             (Standard_True),
55     IsReflectionEnabled         (Standard_False),
56     IsAntialiasingEnabled       (Standard_False),
57     IsTransparentShadowEnabled  (Standard_False),
58     UseEnvironmentMapBackground (Standard_False),
59     CoherentPathTracingMode     (Standard_False),
60
61     StereoMode (Graphic3d_StereoMode_QuadBuffer),
62     AnaglyphFilter (Anaglyph_RedCyan_Optimized),
63     ToReverseStereo (Standard_False)
64   {
65     const Graphic3d_Vec4 aZero (0.0f, 0.0f, 0.0f, 0.0f);
66     AnaglyphLeft .SetRow (0, Graphic3d_Vec4 (1.0f,  0.0f,  0.0f, 0.0f));
67     AnaglyphLeft .SetRow (1, aZero);
68     AnaglyphLeft .SetRow (2, aZero);
69     AnaglyphLeft .SetRow (3, aZero);
70     AnaglyphRight.SetRow (0, aZero);
71     AnaglyphRight.SetRow (1, Graphic3d_Vec4 (0.0f,  1.0f,  0.0f, 0.0f));
72     AnaglyphRight.SetRow (2, Graphic3d_Vec4 (0.0f,  0.0f,  1.0f, 0.0f));
73     AnaglyphRight.SetRow (3, aZero);
74   }
75
76 public:
77
78   Graphic3d_RenderingMode Method;                      //!< specifies rendering mode, Graphic3d_RM_RASTERIZATION by default
79
80   Standard_Boolean        IsGlobalIlluminationEnabled; //!< enables/disables global illumination effects (path tracing)
81   Standard_Integer        SamplesPerPixel;             //!< number of samples per pixel (SPP)
82   Standard_Integer        RaytracingDepth;             //!< maximum ray-tracing depth, 3 by default
83   Standard_Boolean        IsShadowEnabled;             //!< enables/disables shadows rendering, True by default
84   Standard_Boolean        IsReflectionEnabled;         //!< enables/disables specular reflections, False by default
85   Standard_Boolean        IsAntialiasingEnabled;       //!< enables/disables adaptive anti-aliasing, False by default
86   Standard_Boolean        IsTransparentShadowEnabled;  //!< enables/disables light propagation through transparent media, False by default
87   Standard_Boolean        UseEnvironmentMapBackground; //!< enables/disables environment map background
88   Standard_Boolean        CoherentPathTracingMode;     //!< enables/disables 'coherent' tracing mode (single RNG seed within 16x16 image blocks)
89
90   Graphic3d_StereoMode    StereoMode;                  //!< stereoscopic output mode, Graphic3d_StereoMode_QuadBuffer by default
91   Anaglyph                AnaglyphFilter;              //!< filter for anaglyph output, Anaglyph_RedCyan_Optimized by default
92   Graphic3d_Mat4          AnaglyphLeft;                //!< left  anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft;
93   Graphic3d_Mat4          AnaglyphRight;               //!< right anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft;
94   Standard_Boolean        ToReverseStereo;             //!< flag to reverse stereo pair, FALSE by default
95
96 };
97
98 #endif // _Graphic3d_RenderingParams_HeaderFile