VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtEffect.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 <string>
14 #include <boost/filesystem.hpp>
15 
16 namespace makVrv
17 {
21  {
22  public:
23 
25  {
26  VertexAttribPtrInfo(const void* p, unsigned int t, unsigned int s)
27  : pointer(p)
28  , type(t)
29  , size(s)
30  {
31  }
32 
33  const void* pointer; //Address
34  unsigned int type; //The OpenGL type of the attribute.
35  unsigned int size; //The OpenGL width of the attribute 1-4
36 
38  {
39  return pointer==rhs.pointer && type==rhs.type && size==rhs.size;
40  }
41  };
42 
44  DtEffect(const std::string& dataPath, const std::string& strDefines);
45 
47  virtual ~DtEffect();
48 
50  virtual void releaseResources();
51 
53  virtual void reloadShaders();
54 
56  bool enabled() const;
57 
58  //Start using the effect. Returns true if the effect is enabled.
59  bool enable();
60 
61  //Stop using the effect.
62  void disable();
63 
64  // Utility function
65  static std::string loadShaderSource(const std::string& strFileFolder,
66  const std::string& strFileName, const std::string& strDefines);
67 
68  protected:
70  virtual void initializeShaderSource() = 0;
71  virtual void updateUniformLocations() = 0;
72  virtual void updateUniforms() = 0;
73 
74  protected:
75 
77  bool compileShaders();
78 
80  static std::string preprocessShaderIncludes(const std::string& source,
81  const boost::filesystem::path& filename, int level,
82  const std::string& shaderFolderPath);
83 
85  static std::string loadShaderFile(const std::string& strFileName);
86 
87  protected:
88 
89  std::string myName;
91  unsigned int myProgram;
92  unsigned int myVertexShader;
93  unsigned int myFragmentShader;
94 
95  std::string myVertexShaderSource;
96  std::string myVertexShaderName;
98  std::string myFragmentShaderName;
100 
101  std::string myDataPath;
102  const std::string myDefines;
103  };
104 
109  {
110  public:
111 
113  {
115  {
116  }
117  };
118 
119  DtEffectCreator();
120  virtual ~DtEffectCreator();
121  virtual DtEffect* create(const std::string& dataPath, const std::string& strDefines, CreateParameters* params = 0) = 0;
122  };
123 
124 }
125 
std::string myDataPath
Definition: DtEffect.h:101
Abstract creator class for registering effects with a effects manager.
Definition: DtEffect.h:108
unsigned int myProgram
Definition: DtEffect.h:91
unsigned int myVertexShader
Definition: DtEffect.h:92
std::string myFragmentShaderName
Definition: DtEffect.h:98
DT_DLL_VRVCORE DtTaitBryan level(const DtCoordinateSystem &cs, const DtVector &localOrigin, double topoHeading)
Returns a level orientation with the topographic heading.
voidpf void uLong size
Definition: ioapi.h:39
std::string myVertexShaderName
Definition: DtEffect.h:96
bool operator==(const VertexAttribPtrInfo &rhs)
Definition: DtEffect.h:37
unsigned int size
Definition: DtEffect.h:35
VertexAttribPtrInfo(const void *p, unsigned int t, unsigned int s)
Definition: DtEffect.h:26
#define DT_DLL_VRVGRAPHICS
Contains DLL export macros.
Definition: vrvGraphics.h:19
unsigned int myFragmentShader
Definition: DtEffect.h:93
const std::string myDefines
Definition: DtEffect.h:102
Definition: DtEffect.h:24
const char * source
Definition: lz4.h:442
bool myEnabledFlag
Definition: DtEffect.h:90
std::string myGeometryShaderSource
Definition: DtEffect.h:99
unsigned int type
Definition: DtEffect.h:34
The base class for a programmable pipeline render effect.
Definition: DtEffect.h:20
virtual ~CreateParameters()
Definition: DtEffect.h:114
const void * pointer
Definition: DtEffect.h:33
std::string myName
Definition: DtEffect.h:89
std::string myVertexShaderSource
Definition: DtEffect.h:95
std::string myFragmentShaderSource
Definition: DtEffect.h:97

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)