customShaderBindingData.h 1.8 KB

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