RenderPath.pkg 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. $#include "Graphics/RenderPath.h"
  2. enum RenderCommandType
  3. {
  4. CMD_NONE = 0,
  5. CMD_CLEAR,
  6. CMD_SCENEPASS,
  7. CMD_QUAD,
  8. CMD_FORWARDLIGHTS,
  9. CMD_LIGHTVOLUMES,
  10. CMD_RENDERUI
  11. };
  12. struct RenderPathCommand
  13. {
  14. RenderPathCommand();
  15. void Load(const XMLElement& element);
  16. void SetTextureName(TextureUnit unit, const String name);
  17. void SetShaderParameter(const String name, const Variant& value);
  18. void RemoveShaderParameter(const String name);
  19. void SetNumOutputs(unsigned num);
  20. void SetOutputName(unsigned index, const String name);
  21. void SetDepthStencilName(const String name);
  22. const String GetTextureName(TextureUnit unit) const;
  23. const Variant& GetShaderParameter(const String name) const;
  24. unsigned GetNumOutputs() const;
  25. const String GetOutputName(unsigned index) const;
  26. const String GetDepthStencilName() const;
  27. String tag_ @ tag;
  28. RenderCommandType type_ @ type;
  29. RenderCommandSortMode sortMode_ @ sortMode;
  30. String pass_ @ pass;
  31. String metadata_ @ metadata;
  32. String vertexShaderName_ @ vertexShaderName;
  33. String pixelShaderName_ @ pixelShaderName;
  34. String vertexShaderDefines_ @ vertexShaderDefines;
  35. String pixelShaderDefines_ @ pixelShaderDefines;
  36. unsigned clearFlags_ @ clearFlags;
  37. Color clearColor_ @ clearColor;
  38. float clearDepth_ @ clearDepth;
  39. unsigned clearStencil_ @ clearStencil;
  40. bool enabled_ @ enabled;
  41. bool useFogColor_ @ useFogColor;
  42. bool markToStencil_ @ markToStencil;
  43. bool useLitBase_ @ useLitBase;
  44. bool vertexLights_ @ vertexLights;
  45. };
  46. class RenderPath
  47. {
  48. // SharedPtr<RenderPath> Clone();
  49. tolua_outside RenderPath* RenderPathClone @ Clone();
  50. bool Load(XMLFile* file);
  51. bool Append(XMLFile* file);
  52. void SetEnabled(const String tag, bool active);
  53. void ToggleEnabled(const String tag);
  54. void SetRenderTarget(unsigned index, const RenderTargetInfo& info);
  55. void AddRenderTarget(const RenderTargetInfo& info);
  56. void RemoveRenderTarget(const String name);
  57. void RemoveRenderTarget(unsigned index);
  58. void RemoveRenderTargets(const String tag);
  59. void SetCommand(unsigned index, const RenderPathCommand& command);
  60. void AddCommand(const RenderPathCommand& command);
  61. void InsertCommand(unsigned index, const RenderPathCommand& command);
  62. void RemoveCommand(unsigned index);
  63. void RemoveCommands(const String tag);
  64. void SetShaderParameter(const String name, const Variant& value);
  65. unsigned GetNumRenderTargets() const;
  66. unsigned GetNumCommands() const;
  67. RenderPathCommand* GetCommand(unsigned index);
  68. const Variant& GetShaderParameter(const String name) const;
  69. };
  70. ${
  71. static RenderPath* RenderPathClone(RenderPath* renderPath)
  72. {
  73. if (!renderPath)
  74. return 0;
  75. SharedPtr<RenderPath> clonedRenderPathPtr = renderPath->Clone();
  76. RenderPath* clonedRenderPath = clonedRenderPathPtr.Get();
  77. clonedRenderPathPtr.Detach();
  78. return clonedRenderPath;
  79. }
  80. $}