IBillboardSceneNode.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #pragma once
  5. #include "ISceneNode.h"
  6. namespace irr
  7. {
  8. namespace scene
  9. {
  10. class ICameraSceneNode;
  11. class IMeshBuffer;
  12. //! A billboard scene node.
  13. /** A billboard is like a 3d sprite: A 2d element,
  14. which always looks to the camera. It is usually used for explosions, fire,
  15. lensflares, particles and things like that.
  16. */
  17. class IBillboardSceneNode : public ISceneNode
  18. {
  19. public:
  20. //! Constructor
  21. IBillboardSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id,
  22. const core::vector3df &position = core::vector3df(0, 0, 0)) :
  23. ISceneNode(parent, mgr, id, position) {}
  24. //! Sets the size of the billboard, making it rectangular.
  25. virtual void setSize(const core::dimension2d<f32> &size) = 0;
  26. //! Sets the size of the billboard with independent widths of the bottom and top edges.
  27. /** \param[in] height The height of the billboard.
  28. \param[in] bottomEdgeWidth The width of the bottom edge of the billboard.
  29. \param[in] topEdgeWidth The width of the top edge of the billboard.
  30. */
  31. virtual void setSize(f32 height, f32 bottomEdgeWidth, f32 topEdgeWidth) = 0;
  32. //! Returns the size of the billboard.
  33. /** This will return the width of the bottom edge of the billboard.
  34. Use getWidths() to retrieve the bottom and top edges independently.
  35. \return Size of the billboard.
  36. */
  37. virtual const core::dimension2d<f32> &getSize() const = 0;
  38. //! Gets the size of the the billboard and handles independent top and bottom edge widths correctly.
  39. /** \param[out] height The height of the billboard.
  40. \param[out] bottomEdgeWidth The width of the bottom edge of the billboard.
  41. \param[out] topEdgeWidth The width of the top edge of the billboard.
  42. */
  43. virtual void getSize(f32 &height, f32 &bottomEdgeWidth, f32 &topEdgeWidth) const = 0;
  44. //! Set the color of all vertices of the billboard
  45. /** \param[in] overallColor Color to set */
  46. virtual void setColor(const video::SColor &overallColor) = 0;
  47. //! Set the color of the top and bottom vertices of the billboard
  48. /** \param[in] topColor Color to set the top vertices
  49. \param[in] bottomColor Color to set the bottom vertices */
  50. virtual void setColor(const video::SColor &topColor,
  51. const video::SColor &bottomColor) = 0;
  52. //! Gets the color of the top and bottom vertices of the billboard
  53. /** \param[out] topColor Stores the color of the top vertices
  54. \param[out] bottomColor Stores the color of the bottom vertices */
  55. virtual void getColor(video::SColor &topColor,
  56. video::SColor &bottomColor) const = 0;
  57. //! Get the real boundingbox used by the billboard, which can depend on the active camera.
  58. /** The boundingbox returned will use absolute coordinates.
  59. The billboard orients itself toward the camera and some only update in render().
  60. So we don't know the real boundingboxes before that. Which would be too late for culling.
  61. That is why the usual getBoundingBox will return a "safe" boundingbox which is guaranteed
  62. to contain the billboard. While this function can return the real one. */
  63. virtual const core::aabbox3d<f32> &getTransformedBillboardBoundingBox(const irr::scene::ICameraSceneNode *camera) = 0;
  64. //! Get the amount of mesh buffers.
  65. /** \return Amount of mesh buffers (IMeshBuffer) in this mesh. */
  66. virtual u32 getMeshBufferCount() const = 0;
  67. //! Get pointer to a mesh buffer.
  68. /** NOTE: Positions and normals of this meshbuffers are re-calculated before rendering.
  69. So this is mainly useful to access/modify the uv-coordinates.
  70. \param nr: Zero based index of the mesh buffer.
  71. \return Pointer to the mesh buffer or 0 if there is no such mesh buffer. */
  72. virtual IMeshBuffer *getMeshBuffer(u32 nr) const = 0;
  73. };
  74. } // end namespace scene
  75. } // end namespace irr