ILightSceneNode.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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_LIGHT_SCENE_NODE_H_INCLUDED
  5. #define IRR_I_LIGHT_SCENE_NODE_H_INCLUDED
  6. #include "ISceneNode.h"
  7. #include "SLight.h"
  8. namespace irr
  9. {
  10. namespace scene
  11. {
  12. //! Scene node which is a dynamic light.
  13. /** You can switch the light on and off by making it visible or not. It can be
  14. animated by ordinary scene node animators. If the light type is directional or
  15. spot, the direction of the light source is defined by the rotation of the scene
  16. node (assuming (0,0,1) as the local direction of the light).
  17. */
  18. class ILightSceneNode : public ISceneNode
  19. {
  20. public:
  21. //! constructor
  22. ILightSceneNode(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 light data associated with this ILightSceneNode
  26. /** \param light The new light data. */
  27. virtual void setLightData(const video::SLight& light) = 0;
  28. //! Gets the light data associated with this ILightSceneNode
  29. /** \return The light data. */
  30. virtual const video::SLight& getLightData() const = 0;
  31. //! Gets the light data associated with this ILightSceneNode
  32. /** \return The light data. */
  33. virtual video::SLight& getLightData() = 0;
  34. //! Sets if the node should be visible or not.
  35. /** All children of this node won't be visible either, when set
  36. to true.
  37. \param isVisible If the node shall be visible. */
  38. virtual void setVisible(bool isVisible) = 0;
  39. //! Sets the light's radius of influence.
  40. /** Outside this radius the light won't lighten geometry and cast no
  41. shadows. Setting the radius will also influence the attenuation, setting
  42. it to (0,1/radius,0). If you want to override this behavior, set the
  43. attenuation after the radius.
  44. NOTE: On OpenGL only the attenuation is set, there's no hard range.
  45. \param radius The new radius. */
  46. virtual void setRadius(f32 radius) = 0;
  47. //! Gets the light's radius of influence.
  48. /** \return The current radius. */
  49. virtual f32 getRadius() const = 0;
  50. //! Sets the light type.
  51. /** \param type The new type. */
  52. virtual void setLightType(video::E_LIGHT_TYPE type) = 0;
  53. //! Gets the light type.
  54. /** \return The current light type. */
  55. virtual video::E_LIGHT_TYPE getLightType() const = 0;
  56. //! Sets whether this light casts shadows.
  57. /** Enabling this flag won't automatically cast shadows, the meshes
  58. will still need shadow scene nodes attached. But one can enable or
  59. disable distinct lights for shadow casting for performance reasons.
  60. \param shadow True if this light shall cast shadows. */
  61. virtual void enableCastShadow(bool shadow=true) = 0;
  62. //! Check whether this light casts shadows.
  63. /** \return True if light would cast shadows, else false. */
  64. virtual bool getCastShadow() const = 0;
  65. };
  66. } // end namespace scene
  67. } // end namespace irr
  68. #endif