RenderPath.pkg 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. $#include "RenderPath.h"
  2. /// Rendering path definition.
  3. class RenderPath
  4. {
  5. public:
  6. /// Clone the rendering path.
  7. // SharedPtr<RenderPath> Clone();
  8. tolua_outside RenderPath* RenderPathClone @ Clone();
  9. /// Clear existing data and load from an XML file. Return true if successful.
  10. bool Load(XMLFile* file);
  11. /// Append data from an XML file. Return true if successful.
  12. bool Append(XMLFile* file);
  13. /// Enable/disable commands and rendertargets by tag.
  14. void SetEnabled(const char* tag, bool active);
  15. /// Toggle enabled state of commands and rendertargets by tag.
  16. void ToggleEnabled(const char* tag);
  17. /// Assign rendertarget at index.
  18. void SetRenderTarget(unsigned index, const RenderTargetInfo& info);
  19. /// Add a rendertarget.
  20. void AddRenderTarget(const RenderTargetInfo& info);
  21. /// Remove a rendertarget by index.
  22. void RemoveRenderTarget(unsigned index);
  23. /// Remove a rendertarget by name.
  24. void RemoveRenderTarget(const char* name);
  25. /// Remove rendertargets by tag name.
  26. void RemoveRenderTargets(const char* tag);
  27. /// Assign command at index.
  28. void SetCommand(unsigned index, const RenderPathCommand& command);
  29. /// Add a command to the end of the list.
  30. void AddCommand(const RenderPathCommand& command);
  31. /// Insert a command at a position.
  32. void InsertCommand(unsigned index, const RenderPathCommand& command);
  33. /// Remove a command by index.
  34. void RemoveCommand(unsigned index);
  35. /// Remove commands by tag name.
  36. void RemoveCommands(const char* tag);
  37. /// Set a shader parameter in all commands that define it.
  38. void SetShaderParameter(const char* name, const Vector4& value);
  39. /// Return number of rendertargets.
  40. unsigned GetNumRenderTargets() const { return renderTargets_.Size(); }
  41. /// Return number of commands.
  42. unsigned GetNumCommands() const { return commands_.Size(); }
  43. /// Return a shader parameter (first appearance in any command.)
  44. const Vector4& GetShaderParameter(const char* name) const;
  45. };
  46. ${
  47. RenderPath* RenderPathClone(RenderPath* renderPath)
  48. {
  49. if (renderPath == 0)
  50. return 0;
  51. RenderPath* newRenderPath = new RenderPath();
  52. newRenderPath->renderTargets_ = renderPath->renderTargets_;
  53. newRenderPath->commands_ = renderPath->commands_;
  54. return newRenderPath;
  55. }
  56. $}