VR-Vantage
Loading...
Searching...
No Matches
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
16namespace 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
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
96 std::string myVertexShaderName;
100
101 std::string myDataPath;
102 const std::string myDefines;
103 };
104
109 {
110 public:
111
113 {
115 {
116 }
117 };
118
121 virtual DtEffect* create(const std::string& dataPath, const std::string& strDefines, CreateParameters* params = 0) = 0;
122 };
123
124}
125
virtual ~CreateParameters()
Definition DtEffect.h:114
virtual DtEffect * create(const std::string &dataPath, const std::string &strDefines, CreateParameters *params=0)=0
Definition DtEffect.h:21
const std::string myDefines
Definition DtEffect.h:102
static std::string loadShaderFile(const std::string &strFileName)
Used by loadShaderSource() and preprocessIncludes() to load a shader file.
virtual void updateUniforms()=0
std::string myFragmentShaderName
Definition DtEffect.h:98
DtEffect(const std::string &dataPath, const std::string &strDefines)
CTOR.
std::string myName
Definition DtEffect.h:89
static std::string loadShaderSource(const std::string &strFileFolder, const std::string &strFileName, const std::string &strDefines)
unsigned int myFragmentShader
Definition DtEffect.h:93
virtual void releaseResources()
Release and HW resources of the effect.
virtual void initializeShaderSource()=0
Virtual abstract Interface.
bool compileShaders()
Compile the shaders.
std::string myFragmentShaderSource
Definition DtEffect.h:97
std::string myVertexShaderSource
Definition DtEffect.h:95
static std::string preprocessShaderIncludes(const std::string &source, const boost::filesystem::path &filename, int level, const std::string &shaderFolderPath)
Preprocess shader includes (recursive).
bool myEnabledFlag
Definition DtEffect.h:90
virtual void reloadShaders()
Reloads any shaders associated with the effect.
bool enabled() const
Is the effect enabled.
std::string myVertexShaderName
Definition DtEffect.h:96
virtual void updateUniformLocations()=0
virtual ~DtEffect()
DTORs.
std::string myGeometryShaderSource
Definition DtEffect.h:99
unsigned int myVertexShader
Definition DtEffect.h:92
unsigned int myProgram
Definition DtEffect.h:91
std::string myDataPath
Definition DtEffect.h:101
#define DT_DLL_VRVGRAPHICS
Contains DLL export macros.
Definition vrvGraphics.h:19
const char * source
Definition lz4.h:442
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16
VertexAttribPtrInfo(const void *p, unsigned int t, unsigned int s)
Definition DtEffect.h:26
unsigned int size
Definition DtEffect.h:35
bool operator==(const VertexAttribPtrInfo &rhs)
Definition DtEffect.h:37
unsigned int type
Definition DtEffect.h:34
const void * pointer
Definition DtEffect.h:33