VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtTritonShaderUniformManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2019 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvTriton/vrvTriton.h>
14 
16 
20 
21 #include <osg/Matrixf>
22 
23 #include <set>
24 
25 // avoid including glew
26 typedef int GLint;
27 
28 namespace osg
29 {
30  class State;
31 }
32 
33 namespace makVrv
34 {
35  class DtDe;
36  class DtTritonDrawable;
37 
41  {
42  public:
45 
46  protected:
51 
52  private:
59 
60  public:
63  virtual bool initShaderUniformHandles(GLint shader, int shaderType) const;
64 
67  virtual void updateCloudShadowUniforms(GLint shader, int shaderType
68  , GLboolean bIsCloudShadowActive
69  , unsigned int cloudshadowTextureUnit
70  , unsigned int cloudshadowTextureIndex
71  , const osg::Matrixf& textureViewProjMatrix
72  , unsigned int cloudshadowTextureUnit2
73  , unsigned int cloudshadowTextureIndex2
74  , const osg::Matrixf& textureViewProjMatrix2) const;
75 
78  virtual void updateViewingUniforms(GLint shader, int shaderType
79  , const Matrix4_32& view_matrix_32
80  , const Matrix4_32& view_inverse_transpose_matrix_32);
81 
84  virtual void updateLightingUniforms(osg::State &state
85  , const Vector2_uint32& tileSize
86  , const Vector2_uint32& maxDims
87  , int textureStartOffset
88  , GLint shader, int shaderType);
89 
92  virtual void updateOceanMaskingUniforms(GLint shader, int shaderType, unsigned int maskUnit, const DtVector4<double>& latLongMinMax);
93 
95  virtual void updateUpdateMatricesForSensorFX(GLint shader, int shaderType
96  , const osg::Matrixf& osgInverseViewMatrix, const osg::Matrixf& osgModelViewMatrix);
97 
100  void resetToValue(int shaderType, int val) const;
101 
102  protected:
104 
105  DtDe& myDe; // De reference
106 
107  // set to track which program ID's we've bound our interface blocks to, to avoid redundancies.
108  std::set<unsigned int> myProgramIds;
109 
111  //Arrays for caching the shader uniform handles. Mutable since they are
112  // updated in drawImplemtation of the DtTritonDrawable which osg requires to be const
113  mutable int myMutableViewPortSizeUniform[NUM_TRITON_SHADER_TYPES];
114 
115  mutable int myMutableColorRampTextureUniform[NUM_TRITON_SHADER_TYPES];
116 
117  mutable int myMutableModelViewMatrixUniform[NUM_TRITON_SHADER_TYPES];
118  mutable int myMutableModelViewInverseTransposeMatrixUniform[NUM_TRITON_SHADER_TYPES];
119 
120  mutable int myMutableLightGridTileDimUniform[NUM_TRITON_SHADER_TYPES];
121  mutable int myMutableLightGridMaxDimUniform[NUM_TRITON_SHADER_TYPES];
122 
123  mutable int myMutableCloudShadowTextureUniform[NUM_TRITON_SHADER_TYPES];
124  mutable int myMutableCloudShadowTextureUniform2[NUM_TRITON_SHADER_TYPES];
125  mutable int myMutableCloudShadowTexGenUniform[NUM_TRITON_SHADER_TYPES];
126  mutable int myMutableCloudShadowTexGenUniform2[NUM_TRITON_SHADER_TYPES];
127  mutable int myMutableCloudShadowActive[NUM_TRITON_SHADER_TYPES];
128 
129  mutable int myMutableOceanMaskTextureUnitUniform[NUM_TRITON_SHADER_TYPES];
130  mutable int myMutableLatLongMinMax[NUM_TRITON_SHADER_TYPES];
131 
132  mutable int myMutableOsgViewMatrixInverse[NUM_TRITON_SHADER_TYPES];
133  mutable int myMutableOsgModelViewMatrix[NUM_TRITON_SHADER_TYPES];
135  };
136 
140  {
141  protected:
144 
147 
148  private:
153 
154  public:
156  static DtTritonShaderUniformManagerCreator& instance(DtDe& de);
157 
159  static void registerInstance(DtDe& de,
161 
162  public:
164  virtual DtTritonShaderUniformManager* create(DtTritonDrawable* parentDrawable,
165  DtDe& de);
166  };
167 
168 
169 } // namespace makVrv
170 
Virtual base class.
Definition: DtVirtualBaseClass.h:22
2 dimensional vector
int GLint
Definition: DtBindingManager.h:24
4 dimensional vector
Contains DLL export macros.
class for managing the shader uniforms for triton, gets the shader ids and caches them between frames...
Definition: DtTritonShaderUniformManager.h:40
Contains makVrv::DtVirtualBaseClass class.
#define DT_DLL_VRVTRITON
Definition: vrvTriton.h:19
std::set< unsigned int > myProgramIds
Definition: DtTritonShaderUniformManager.h:108
#define NUM_TRITON_SHADER_TYPES
Definition: DtTritonConfig.h:5
DtTritonDrawable * myTritonDrawable
Definition: DtTritonShaderUniformManager.h:103
DtDe & myDe
Definition: DtTritonShaderUniformManager.h:105
DtTritonShaderUniformManager creator.
Definition: DtTritonShaderUniformManager.h:139
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
An OSG Drawable representing Triton&#39;s infinite ocean.
Definition: DtTritonDrawable.h:61
4 dimensional matrix

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)