VR-Vantage 3.1 API Documentation
Home
Modules
Namespaces
Classes
Files
Libraries
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
vrvGraphics
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>
13
#include <
vrvGraphics/vrvGraphics.h
>
14
#include <boost/filesystem.hpp>
15
16
namespace
makVrv
17
{
20
class
DT_DLL_VRVGRAPHICS
DtEffect
21
{
22
public
:
23
24
struct
VertexAttribPtrInfo
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
37
bool
operator==
(
const
VertexAttribPtrInfo
& rhs)
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
;
90
bool
myEnabledFlag
;
91
unsigned
int
myProgram
;
92
unsigned
int
myVertexShader
;
93
unsigned
int
myFragmentShader
;
94
95
std::string
myVertexShaderSource
;
96
std::string
myVertexShaderName
;
97
std::string
myFragmentShaderSource
;
98
std::string
myFragmentShaderName
;
99
std::string
myGeometryShaderSource
;
100
101
std::string
myDataPath
;
102
const
std::string
myDefines
;
103
};
104
108
class
DT_DLL_VRVGRAPHICS
DtEffectCreator
109
{
110
public
:
111
112
class
CreateParameters
113
{
114
virtual
~
CreateParameters
()
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
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (
www.mak.com
)