VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtHdrDrawableRenderData.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 
14 
17 
18 #include <osg/Drawable>
19 #include <osg/Texture>
20 #include <osg/Texture2D>
21 
22 namespace osg
23 {
24  class RenderInfo;
25  class Camera;
26  class State;
27 }
28 
29 namespace makVrv
30 {
31  class DtDe;
32 
33  class DtGlTexture;
34  class DtGlBuffer;
35  class DtGlProgram;
36 
37  class DtHdrDrawable;
38  struct DtHdrOptions;
39 
42 
45 
47  template <>
48  inline const char* creatorTypeName<DtHdrDrawableRenderData>(void) { return "DtHdrDrawableRenderDataCreator"; }
49 
54  {
55  public:
58 
60  virtual ~DtHdrDrawableRenderData();
61 
63  DtHdrDrawableRenderData() = delete;
65  DtHdrDrawableRenderData& operator=(const DtHdrDrawableRenderData& rhs) = delete;
66 
67  public:
69  virtual void initShaders();
70 
72  virtual void execute(osg::RenderInfo& renderInfo);
73 
75  virtual void cleanupGpuMemory();
76 
78  virtual void setInputTexture(osg::Texture* inputTex);
79 
81  virtual float localHdrOutputScale();
82 
83  protected:
85  DtHdrDrawableRenderData(DtDe& de, const DtHdrOptions& options, DtHdrDrawable* parent, osg::Texture*& lensFlareTexture);
86  protected:
88  virtual void initRenderTextures(const osg::Camera* osgCamera);
89 
91  virtual void downSample(DtGlTexture* src, DtGlTexture* dest, osg::State* state);
92 
95  virtual void downsample4x(DtGlTexture* src, DtGlTexture* dest, osg::State* state);
96 
98  virtual void extractHL(DtGlTexture* src, DtGlTexture* dest, osg::State* state);
99 
101  virtual void runPass(HDR_PASS prog, DtGlTexture* src, DtGlTexture* dest,
102  osg::State* state);
103 
105  virtual void blur(DtGlTexture* src, DtGlTexture* dest, DtGlTexture* temp,
106  int blurWidth, osg::State* state);
107 
109  virtual void getBufferPyramidSize(BUFFER_PYRAMID level, int* w, int* h);
110 
112  virtual void genStarStreak(int streak, float dir, float length);
113 
115  virtual void genGhostImage(const float* ghost_modulation1st, const float* ghost_modulation2nd, osg::State* state);
116 
118  virtual void composeEffect(void);
119 
122  virtual void toneMappingPass(osg::State* state);
123 
125  virtual void calculateLuminance(const osg::Camera* osgCamera);
126 
128  virtual float adaptiveLuminance(const osg::Camera* osgCamera);
129 
131  virtual bool adaptiveLuminanceCompute(const osg::Camera* osgCamera);
132 
134  virtual float adaptiveLuminanceRead(const osg::Camera* osgCamera);
135 
137  virtual float regularLuminance(const osg::Camera* osgCamera);
138 
140  virtual float silverLiningLuminance(const osg::Camera* osgCamera);
141 
143  virtual void computeColorModulationRedShift(float* color, float r, float g, float b, int num);
144  virtual void computeColorModulation(float* color, float r, float g, float b, int num);
145  virtual void computeColorModulationCoefficients();
146 
148  virtual void createComputeProgramIfNecessary(HDR_PASS pass, const std::string& name);
149  virtual void createBlurProgramsIfNecessary();
150 
153  virtual std::string preprocessorDefinesString(HDR_PASS pass);
154 
156  virtual unsigned int inputTextureId(unsigned int& target, const DtGlTexture* src, osg::State* state);
157 
159  virtual void streakPass0(int streak, float dec, const float step[2], float stride);
160  virtual void streakPass1(int streak, float dec, const float step[2], float stride);
161  virtual void streakPass2(int streak, float dec, const float step[2], float stride);
162 
164  virtual void ghostPass0(const float* ghost_modulation1st);
165  virtual void ghostPass1(const float* ghost_modulation2nd);
166 
168  virtual void gaussianBlurComposePass(void);
169  virtual void starStreakCompose(void);
170  virtual void finalGlarePass(void);
171 
173  virtual void initializeUniformLocations(HDR_PASS pass);
175  virtual void zeroOutUniformLocations();
176 
178  virtual void createToneMappingProgramIfNecessary(void);
179 
181  virtual void slot_hdrResolutionScaleChanged(int val);
182  protected:
184 
186 
188 
189  std::array<DtGlProgram*, PROGSIZE> myShaders;
190 
191  float myStarModulation1st[16];
192  float myStarModulation2nd[16];
193  float myStarModulation3rd[16];
194 
195  float myFilmicGhostModulation1st[16];
196  float myFilmicGhostModulation2nd[16];
197  float myCameraGhostModulation1st[16];
198  float myCameraGhostModulation2nd[16];
199 
200  float myHoriModulation1st[16];
201  float myHoriModulation2nd[16];
202  float myHoriModulation3rd[16];
203 
208 
211  DtGlTexture* myComposebuffer[LEVEL_TOTAL];
212  DtGlTexture* myBlurbufferA[LEVEL_TOTAL];
213  DtGlTexture* myBlurbufferB[LEVEL_TOTAL];
214 
215  DtGlTexture* myStreakbufferA[8];
216  DtGlTexture* myStreakbufferB[8];
218 
221 
223 
225 
226  unsigned int myLumNextBuffer;
227  const float* myLumNextBufferPtr;
228 
230 
234 
237 
240 
243 
247 
249 
252 
255 
257 
258  double myLastHdrFrameTime = -1;
259 
260  DtHdrDrawable* myParent = nullptr;
261 
262  // Signals and slots
264 
267  };
268 }
float myLastLuminanceValue
Definition: DtHdrDrawableRenderData.h:256
DtGlTexture * myGhost1stBuffer
Definition: DtHdrDrawableRenderData.h:219
int myGaussianBlurComposeCoeffLoc
Definition: DtHdrDrawableRenderData.h:244
This class encapsulates all the (lazily) created OpenGL objects that are required for doing hdr...
Definition: DtHdrDrawableRenderData.h:53
DtGlTexture * myLumcurrent
Definition: DtHdrDrawableRenderData.h:224
DT_DLL_VRVCORE DtTaitBryan level(const DtCoordinateSystem &cs, const DtVector &localOrigin, double topoHeading)
Returns a level orientation with the topographic heading.
int myExtractHlTresholdAndScalarLoc
locations of various uniforms in the shaders
Definition: DtHdrDrawableRenderData.h:236
float myAspectRatio
Definition: DtHdrDrawableRenderData.h:187
int myBlurTexLoc
Definition: DtHdrDrawableRenderData.h:251
DtGlTexture * myGhost2ndBuffer
Definition: DtHdrDrawableRenderData.h:220
int myStarStreakStepSizeAndStrideLoc
Definition: DtHdrDrawableRenderData.h:238
DtVirtualBaseClassCreator< DtHdrDrawableRenderData, const DtHdrOptions &, DtHdrDrawable *, osg::Texture *& > DtHdrDrawableRenderDataCreator
creator
Definition: DtHdrDrawableRenderData.h:41
const DtHdrOptions & myOptions
Definition: DtHdrDrawableRenderData.h:185
int myGhostImageColorCoeffLoc
Definition: DtHdrDrawableRenderData.h:242
structure to hold all the HDR settings so they can more easily be passed to the drawable.
Definition: DtHdrTypes.h:54
std::array< DtGlProgram *, PROGSIZE > myShaders
Definition: DtHdrDrawableRenderData.h:189
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
int myGhostImageScalarLoc
Definition: DtHdrDrawableRenderData.h:241
DtGlTexture * myGlareBuffer
Definition: DtHdrDrawableRenderData.h:222
HDR_PASS
Definition: DtHdrTypes.h:18
unsigned int myLumNextBuffer
Definition: DtHdrDrawableRenderData.h:226
friend DtHdrDrawableRenderDataCreator
only friend can create
Definition: DtHdrDrawableRenderData.h:57
int myScalesBlurTexLuminanceSaturationLoc
Definition: DtHdrDrawableRenderData.h:253
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
#define DT_DLL_VRVPOSTPROCESSOR
Definition: vrvPostProcessor.h:19
BUFFER_PYRAMID
Definition: DtHdrTypes.h:41
double myLastAdpativeLumFrameTime
need to keep track of the previous frame time in draw implementation so this needs to be mutable...
Definition: DtHdrDrawableRenderData.h:233
int myElapsedTimeLoc
Definition: DtHdrDrawableRenderData.h:248
Contains DLL export macros.
int mySceneTexLoc
Definition: DtHdrDrawableRenderData.h:250
Base class to provide boost signal/slot management.
const float * myLumNextBufferPtr
Definition: DtHdrDrawableRenderData.h:227
DtGlTexture * myStreakbufferFinal
Definition: DtHdrDrawableRenderData.h:217
int myStarStreakColorCoeffLoc
Definition: DtHdrDrawableRenderData.h:239
DT_DLL_VRVCORE double length(const makVrv::DtCoordinateSystem &, const std::vector< DtVector > &vertices)
Returns the total distance of a segmented line defined by the provided vector of vertices. Coordinates are in local database coordinates. The coordinate system is used to convert between the local database coordinates and geocentric. All distance is in 2D – the Z value is ignored.
osg::ref_ptr< osg::Texture > myLensMask
Definition: DtHdrDrawableRenderData.h:265
Definition: DtHdrTypes.h:49
const char * creatorTypeName< DtHdrDrawableRenderData >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtHdrDrawableRenderData.h:48
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
int myStarStreakComposeNumSamplersLoc
Definition: DtHdrDrawableRenderData.h:245
int myFinalGlarecomposeMixCoeffLoc
Definition: DtHdrDrawableRenderData.h:246
A helper classes for creating a RTT target, optionally including depth buffer.
Definition: DtGlTexture.h:20
DtDe & myDe
Definition: DtHdrDrawableRenderData.h:183
class used to render hdr during the post processor camera draw
Definition: DtHdrDrawable.h:76
char * dest
Definition: lz4.h:440
DtSignalConnectionManager myConnections
Definition: DtHdrDrawableRenderData.h:263
osg::ref_ptr< osg::Texture > myInputTex
Definition: DtHdrDrawableRenderData.h:266
DtGlTexture * myInitialBuffer
Definition: DtHdrDrawableRenderData.h:229
int myBlurAmountGammaEnablePassThroughLoc
Definition: DtHdrDrawableRenderData.h:254

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)