]> git.lizzy.rs Git - irrlicht.git/blobdiff - source/Irrlicht/CLightSceneNode.h
Add back lighting system
[irrlicht.git] / source / Irrlicht / CLightSceneNode.h
diff --git a/source/Irrlicht/CLightSceneNode.h b/source/Irrlicht/CLightSceneNode.h
new file mode 100644 (file)
index 0000000..8417a5b
--- /dev/null
@@ -0,0 +1,102 @@
+// Copyright (C) 2002-2012 Nikolaus Gebhardt\r
+// This file is part of the "Irrlicht Engine".\r
+// For conditions of distribution and use, see copyright notice in irrlicht.h\r
+\r
+#ifndef IRR_C_LIGHT_SCENE_NODE_H_INCLUDED\r
+#define IRR_C_LIGHT_SCENE_NODE_H_INCLUDED\r
+\r
+#include "ILightSceneNode.h"\r
+\r
+namespace irr\r
+{\r
+namespace scene\r
+{\r
+\r
+//! Scene node which is a dynamic light. You can switch the light on and off by\r
+//! making it visible or not, and let it be animated by ordinary scene node animators.\r
+class CLightSceneNode : public ILightSceneNode\r
+{\r
+public:\r
+\r
+       //! constructor\r
+       CLightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,\r
+               const core::vector3df& position, video::SColorf color, f32 range);\r
+\r
+       //! pre render event\r
+       virtual void OnRegisterSceneNode() override;\r
+\r
+       //! render\r
+       virtual void render() override;\r
+\r
+       //! set node light data from light info\r
+       virtual void setLightData(const video::SLight& light) override;\r
+\r
+       //! \return Returns the light data.\r
+       virtual const video::SLight& getLightData() const override;\r
+\r
+       //! \return Returns the light data.\r
+       virtual video::SLight& getLightData() override;\r
+\r
+       //! Sets if the node should be visible or not.\r
+       /** All children of this node won't be visible either, when set\r
+       to true.\r
+       \param isVisible If the node shall be visible. */\r
+       virtual void setVisible(bool isVisible) override;\r
+\r
+       //! returns the axis aligned bounding box of this node\r
+       virtual const core::aabbox3d<f32>& getBoundingBox() const override;\r
+\r
+       //! Returns type of the scene node\r
+       virtual ESCENE_NODE_TYPE getType() const override { return ESNT_LIGHT; }\r
+\r
+       //! Creates a clone of this scene node and its children.\r
+       virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) override;\r
+\r
+       //! Sets the light's radius of influence.\r
+       /** Outside this radius the light won't lighten geometry and cast no\r
+       shadows. Setting the radius will also influence the attenuation, setting\r
+       it to (0,1/radius,0). If you want to override this behavior, set the\r
+       attenuation after the radius.\r
+       \param radius The new radius. */\r
+       virtual void setRadius(f32 radius) override;\r
+\r
+       //! Gets the light's radius of influence.\r
+       /** \return The current radius. */\r
+       virtual f32 getRadius() const override;\r
+\r
+       //! Sets the light type.\r
+       /** \param type The new type. */\r
+       virtual void setLightType(video::E_LIGHT_TYPE type) override;\r
+\r
+       //! Gets the light type.\r
+       /** \return The current light type. */\r
+       virtual video::E_LIGHT_TYPE getLightType() const override;\r
+\r
+       //! Sets whether this light casts shadows.\r
+       /** Enabling this flag won't automatically cast shadows, the meshes\r
+       will still need shadow scene nodes attached. But one can enable or\r
+       disable distinct lights for shadow casting for performance reasons.\r
+       \param shadow True if this light shall cast shadows. */\r
+       virtual void enableCastShadow(bool shadow=true) override;\r
+\r
+       //! Check whether this light casts shadows.\r
+       /** \return True if light would cast shadows, else false. */\r
+       virtual bool getCastShadow() const override;\r
+\r
+       //! Updates the absolute position based on the relative and the parents position\r
+       virtual void updateAbsolutePosition() override;\r
+\r
+private:\r
+\r
+       video::SLight LightData;\r
+       core::aabbox3d<f32> BBox;\r
+       s32 DriverLightIndex;\r
+       bool LightIsOn;\r
+       void doLightRecalc();\r
+};\r
+\r
+\r
+} // end namespace scene\r
+} // end namespace irr\r
+\r
+#endif\r