IBillboardSceneNode.h 3.9 KB

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