SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLOptixPathtracer.h
Go to the documentation of this file.
1 /**
2  * \file SLOptixPathtracer.h
3  * \authors Nic Dorner
4  * \date October 2019
5  * \authors Nic Dorner
6  * \copyright http://opensource.org/licenses/GPL-3.0
7  * \remarks Please use clangformat to format the code. See more code style on
8  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
9 */
10 
11 #ifdef SL_HAS_OPTIX
12 # ifndef SLOPTIXPATHTRACER_H
13 # define SLOPTIXPATHTRACER_H
14 # include <SLOptixRaytracer.h>
15 # include <curand_kernel.h>
16 
17 class SLScene;
18 class SLSceneView;
19 class SLRay;
20 class SLMaterial;
21 class SLCamera;
22 
23 //-----------------------------------------------------------------------------
24 class SLOptixPathtracer : public SLOptixRaytracer
25 {
26 public:
27  SLOptixPathtracer();
28  ~SLOptixPathtracer();
29 
30  // setup path tracer
31  void setupOptix() override;
32  void setupScene(SLSceneView* sv, SLAssetManager* am) override;
33  void updateScene(SLSceneView* sv) override;
34 
35  // path tracer functions
36  SLbool render();
37 
38  SLbool getDenoiserEnabled() const { return _denoiserEnabled; }
39  SLint samples() const { return _samples; }
40 
41  void setDenoiserEnabled(SLbool denoiserEnabled) { _denoiserEnabled = denoiserEnabled; }
42  void samples(SLint samples) { _samples = samples; }
43 
44  SLfloat denoiserMS() const { return _denoiserMS; }
45 
46 protected:
47  SLint _samples;
48  SLOptixCudaBuffer<curandState> _curandBuffer = SLOptixCudaBuffer<curandState>();
49 
50 private:
51  OptixDenoiser _optixDenoiser;
52  OptixDenoiserSizes _denoiserSizes;
53  SLOptixCudaBuffer<void> _denoserState;
54  SLOptixCudaBuffer<void> _scratch;
55 
56  // Settings
57  SLbool _denoiserEnabled = true;
58  SLfloat _denoiserMS; //!< Denoiser time in ms
59 };
60 //-----------------------------------------------------------------------------
61 # endif // SLOPTIXPATHTRACER_H
62 #endif // SL_HAS_OPTIX
float SLfloat
Definition: SL.h:173
bool SLbool
Definition: SL.h:175
int SLint
Definition: SL.h:170
Toplevel holder of the assets meshes, materials, textures and shaders.
Active or visible camera node class.
Definition: SLCamera.h:54
Defines a standard CG material with textures and a shader program.
Definition: SLMaterial.h:56
Ray class with ray and intersection properties.
Definition: SLRay.h:40
The SLScene class represents the top level instance holding the scene structure.
Definition: SLScene.h:47
SceneView class represents a dynamic real time 3D view onto the scene.
Definition: SLSceneView.h:69