ParticleRenderer.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #pragma once
  16. #include <OgreString.h>
  17. #include <OgreStringInterface.h>
  18. #include "ParticlePool.h"
  19. class ParticleTechnique;
  20. class VisualParticle;
  21. /**
  22. * A particle renderer.
  23. */
  24. class ParticleRenderer : public Ogre::StringInterface{
  25. public:
  26. /**
  27. * Constructor.
  28. */
  29. ParticleRenderer();
  30. /**
  31. * Destructor.
  32. */
  33. virtual ~ParticleRenderer();
  34. /**
  35. * Copies the renderer attributes to other renderer.
  36. *
  37. * @param renderer[out] The renderer to copy the attributes to.
  38. */
  39. virtual void CopyAttributesTo(ParticleRenderer* renderer);
  40. /**
  41. * Toggles renderer initialization state.
  42. *
  43. * @param renderer_initialised[in] True to mark the renderer as
  44. * initialized, false to mark it as not initialized.
  45. */
  46. void SetRendererInitialised(bool renderer_initialised);
  47. /**
  48. * Checks the renderer initialization status.
  49. *
  50. * @return True if the renderer is initialized, false if not.
  51. */
  52. bool IsRendererInitialised() const;
  53. /**
  54. * Sets the renderer type.
  55. *
  56. * @param renderer_type[in] The renderer type.
  57. */
  58. void SetRendererType(Ogre::String renderer_type);
  59. /**
  60. * Retrieves the renderer type.
  61. *
  62. * @return The renderer type.
  63. */
  64. const Ogre::String& GetRendererType() const;
  65. /**
  66. * Sets the renderer parent technique.
  67. *
  68. * @param parent_technique[in] Parent technique for the renderer.
  69. */
  70. void SetParentTechnique(ParticleTechnique* parent_technique);
  71. /**
  72. * Sets the renderer particle technique.
  73. *
  74. * @return The renderer particle technique.
  75. */
  76. const ParticleTechnique* GetParentTechnique() const;
  77. /**
  78. * Toggles the visibility of the particle renderer.
  79. *
  80. * @param visible[in] True to make th renderer visibible, false to make
  81. * it invisible.
  82. */
  83. virtual void SetVisible(bool visible = true) = 0;
  84. /**
  85. * Initializes the renderer.
  86. */
  87. virtual void Initialize() = 0;
  88. /**
  89. * Adds the particle to the scene render queue.
  90. *
  91. * @param queue[] Unused
  92. * @param pool[in] The particle pool.
  93. */
  94. virtual void UpdateRenderQueue(
  95. Ogre::RenderQueue* queue,
  96. ParticlePool<VisualParticle>& pool
  97. ) = 0;
  98. protected:
  99. /**
  100. * Indicates if the renderer has been initialized.
  101. */
  102. bool renderer_initialized_;
  103. /**
  104. * The type of renderer.
  105. */
  106. Ogre::String renderer_type_;
  107. /**
  108. * The renderer particle tchnique.
  109. */
  110. ParticleTechnique* parent_technique_;
  111. };