Torque3D Documentation / _generateds / customShaderBindingData.h

customShaderBindingData.h

Engine/source/materials/customShaderBindingData.h

More...

Classes:

Public Defines

Detailed Description

Public Defines

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