Technique.pkg 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. $#include "Graphics/Technique.h"
  2. enum PassLightingMode
  3. {
  4. LIGHTING_UNLIT,
  5. LIGHTING_PERVERTEX,
  6. LIGHTING_PERPIXEL
  7. };
  8. class Pass : public RefCounted
  9. {
  10. void SetBlendMode(BlendMode mode);
  11. void SetCullMode(CullMode mode);
  12. void SetDepthTestMode(CompareMode mode);
  13. void SetLightingMode(PassLightingMode mode);
  14. void SetDepthWrite(bool enable);
  15. void SetAlphaToCoverage(bool enable);
  16. void SetIsDesktop(bool enable);
  17. void SetVertexShader(const String name);
  18. void SetPixelShader(const String name);
  19. void SetVertexShaderDefines(const String defines);
  20. void SetPixelShaderDefines(const String defines);
  21. void SetVertexShaderDefineExcludes(const String excludes);
  22. void SetPixelShaderDefineExcludes(const String excludes);
  23. void ReleaseShaders();
  24. const String GetName() const;
  25. unsigned GetIndex() const;
  26. CullMode GetCullMode() const;
  27. BlendMode GetBlendMode() const;
  28. CompareMode GetDepthTestMode() const;
  29. PassLightingMode GetLightingMode() const;
  30. bool GetDepthWrite() const;
  31. bool GetAlphaToCoverage() const;
  32. bool IsDesktop() const;
  33. const String GetVertexShader() const;
  34. const String GetPixelShader() const;
  35. const String GetVertexShaderDefines() const;
  36. const String GetPixelShaderDefines() const;
  37. const String GetVertexShaderDefineExcludes() const;
  38. const String GetPixelShaderDefineExcludes() const;
  39. tolua_readonly tolua_property__get_set String name;
  40. tolua_readonly tolua_property__get_set unsigned index;
  41. tolua_property__get_set BlendMode blendMode;
  42. tolua_property__get_set CullMode cullMode;
  43. tolua_property__get_set CompareMode depthTestMode;
  44. tolua_property__get_set PassLightingMode lightingMode;
  45. tolua_property__get_set bool depthWrite;
  46. tolua_property__get_set bool alphaToCoverage;
  47. tolua_readonly tolua_property__is_set bool desktop;
  48. tolua_property__get_set String vertexShader;
  49. tolua_property__get_set String pixelShader;
  50. tolua_property__get_set String vertexShaderDefines;
  51. tolua_property__get_set String pixelShaderDefines;
  52. tolua_property__get_set String vertexShaderDefineExcludes;
  53. tolua_property__get_set String pixelShaderDefineExcludes;
  54. };
  55. class Technique : public Resource
  56. {
  57. void SetIsDesktop(bool enable);
  58. Pass* CreatePass(const String passName);
  59. void RemovePass(const String passName);
  60. void ReleaseShaders();
  61. tolua_outside Technique* TechniqueClone @ Clone(const String cloneName = String::EMPTY) const;
  62. bool HasPass(const String type) const;
  63. Pass* GetPass(const String type) const;
  64. Pass* GetSupportedPass(const String type) const;
  65. bool IsSupported() const;
  66. bool IsDesktop() const;
  67. unsigned GetNumPasses() const;
  68. tolua_outside const Vector<String>& TechniqueGetPassNames @ GetPassTypes() const;
  69. tolua_outside const PODVector<Pass*>& TechniqueGetPasses @ GetPasses() const;
  70. tolua_readonly tolua_property__is_set bool supported;
  71. tolua_readonly tolua_property__is_set bool desktop;
  72. tolua_readonly tolua_property__get_set unsigned numPasses;
  73. };
  74. ${
  75. static const Vector<String>& TechniqueGetPassNames(const Technique* technique)
  76. {
  77. static Vector<String> vector = technique->GetPassNames();
  78. return vector;
  79. }
  80. static const PODVector<Pass*>& TechniqueGetPasses(const Technique* technique)
  81. {
  82. static PODVector<Pass*> vector = technique->GetPasses();
  83. return vector;
  84. }
  85. static Technique* TechniqueClone(const Technique* technique, const String& cloneName = String::EMPTY)
  86. {
  87. if (!technique)
  88. return 0;
  89. SharedPtr<Technique> clonedTechniquePtr = technique->Clone(cloneName);
  90. Technique* clonedTechnique = clonedTechniquePtr.Get();
  91. clonedTechniquePtr.Detach();
  92. return clonedTechnique;
  93. }
  94. $}