-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathcustomShaderBindingData.h
97 lines (83 loc) · 1.68 KB
/
customShaderBindingData.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#pragma once
#ifndef CUSTOMSHADERBINDINGDATA_H
#define CUSTOMSHADERBINDINGDATA_H
#ifndef _GFXDEVICE_H_
#include "gfx/gfxDevice.h"
#endif
struct CustomShaderBindingData
{
public:
enum UniformType
{
Float = 0,
Float2,
Float3,
Float4,
Texture2D,
Texture3D,
Cubemap,
Matrix2x2,
Matrix2x3,
Matrix2x4,
Matrix3x2,
Matrix3x3,
Matrix3x4,
Matrix4x2,
Matrix4x3,
Matrix4x4
};
private:
StringTableEntry targetedUniformName;
//ShaderConstHandles shaderConstHandle;
UniformType type;
F32 mFloat;
Point2F mFloat2;
Point3F mFloat3;
Point4F mFloat4;
//Image stuff
GFXTexHandle texture;
GFXSamplerStateDesc samplerState;
public:
void setFloat(StringTableEntry shaderConstName, F32 f)
{
targetedUniformName = shaderConstName;
mFloat = f;
type = Float;
}
F32 getFloat() { return mFloat; }
void setFloat2(StringTableEntry shaderConstName, Point2F f)
{
targetedUniformName = shaderConstName;
mFloat2 = f;
type = Float2;
}
Point2F getFloat2() { return mFloat2; }
void setFloat3(StringTableEntry shaderConstName, Point3F f)
{
targetedUniformName = shaderConstName;
mFloat3 = f;
type = Float3;
}
Point3F getFloat3() { return mFloat3; }
void setFloat4(StringTableEntry shaderConstName, Point4F f)
{
targetedUniformName = shaderConstName;
mFloat4 = f;
type = Float4;
}
Point4F getFloat4() { return mFloat4; }
void setTexture2D(StringTableEntry shaderConstName, GFXTexHandle f)
{
targetedUniformName = shaderConstName;
texture = f;
type = Texture2D;
}
GFXTexHandle getTexture2D() { return texture; }
StringTableEntry getHandleName() {
return targetedUniformName;
}
UniformType getType() {
return type;
}
};
#endif