VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtLightComputeProgram.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2023 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
14 #include <vrvMath/DtVector2.h>
15 #include <vrvMath/DtVector3.h>
16 #include <vrvMath/DtVector4.h>
17 #include <vrvMath/DtMatrix4.h>
18 
20 
21 #include <atomic>
22 #include <array>
23 
24 namespace makVrv
25 {
26  class DtDe;
27  class DtGlBuffer;
28  class DtLight;
29  class DtTileSpaceLightGrid;
30  class DtGlProgram;
31  class DtGlShader;
32 
33  #define CPU_SIDE_COMPILATION 1
34  #include <../data/shaders/lights/DtLightIndexData.h>
35  #include <../data/shaders/lights/DtLightIntersectionData.h>
36  #include <../data/shaders/lights/DtLightIndexBufferInfo.h>
37  #undef CPU_SIDE_COMPILATION
38 
40  class DtLightComputeProgramShaderConstants;
41 
47  {
48  public:
51 
53  virtual ~DtLightComputeProgram();
54  private:
56  DtLightComputeProgram() = delete;
60  DtLightComputeProgram& operator=(const DtLightComputeProgram&) = delete;
61 
62  public:
64  virtual void slot_reloadShader(void);
65 
68  virtual bool failedCompilation(void) const;
69 
71  virtual void execute(const DtTileSpaceLightGrid* tileSpaceLightGrid
72  , const int tileLightIndexTotalCount
73  , const size_t lightCount
74  , const int numChunks
75  , const Matrix4_64& projectionMatrix
76  , const Vector3_64& vWorldEye
77  , const Vector3_64& vWorldCenter
78  , const Vector3_64& vWorldUp
79  , const Vector2_uint32& viewportSize
80  , const int viewOffset
81  , const unsigned int sensorMask);
82 
83  protected:
85  virtual void initializeShadersIfNecessary(void);
86 
88  virtual void deleteShaders(void);
89  protected:
90  static const int theNumLightSourceComputeShaders = 2;
91 
92  std::array<DtGlProgram*, theNumLightSourceComputeShaders> myComputePrograms;
93 
94  std::array<DtLightComputeProgramShaderConstants*, theNumLightSourceComputeShaders> myLightSourceComputeShaderConstants;
95 
96  std::array<DtGlBuffer*, theNumLightSourceComputeShaders> myGpuShaderUbo;
97  std::array<int, theNumLightSourceComputeShaders> myGpuShaderUboBinding;
98 
99  static const std::array<std::string, theNumLightSourceComputeShaders> theLightSourcesComputeShaderFilePaths;
100  static const std::string theLightingFunctionsShaderFilePath;
101 
103 
105 
107 
108  // We cannot delete shaders from the cull thread, so setting this true
109  // signals the main thread to do that.
110  std::atomic<bool> myDeleteShaders;
111 
113  };
114 
115 }
std::atomic< bool > myDeleteShaders
Definition: DtLightComputeProgram.h:110
DtDe & myDe
Definition: DtLightComputeProgram.h:104
int myWorkGroupLocalSizeX
Definition: DtLightComputeProgram.h:112
2 dimensional vector
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
4 dimensional vector
3 dimensional vector
std::array< int, theNumLightSourceComputeShaders > myGpuShaderUboBinding
Definition: DtLightComputeProgram.h:97
static const std::string theLightingFunctionsShaderFilePath
Definition: DtLightComputeProgram.h:100
std::array< DtGlBuffer *, theNumLightSourceComputeShaders > myGpuShaderUbo
Definition: DtLightComputeProgram.h:96
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
Class doing all the heavy lifting in regards of forward+ lighting.
Definition: DtTileSpaceLightGrid.h:42
static const std::array< std::string, theNumLightSourceComputeShaders > theLightSourcesComputeShaderFilePaths
Definition: DtLightComputeProgram.h:99
Base class to provide boost signal/slot management.
std::array< DtLightComputeProgramShaderConstants *, theNumLightSourceComputeShaders > myLightSourceComputeShaderConstants
Definition: DtLightComputeProgram.h:94
std::array< DtGlProgram *, theNumLightSourceComputeShaders > myComputePrograms
Definition: DtLightComputeProgram.h:92
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:72
bool myShadersFailedToCompile
Definition: DtLightComputeProgram.h:102
DtSignalConnectionManager myConnections
Definition: DtLightComputeProgram.h:106
4 dimensional matrix
Class that encapsulates the 2 pass (setup, sort) computation of lights affecting the screen space til...
Definition: DtLightComputeProgram.h:46

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)