]> git.lizzy.rs Git - irrlicht.git/blobdiff - include/IVideoDriver.h
Add back lighting system
[irrlicht.git] / include / IVideoDriver.h
index ef8e38e1d13e3bf5d00aaa99d399988da7e8c69d..b2d000484095974a2d13edd383491380f86a5d66 100644 (file)
@@ -41,6 +41,7 @@ namespace video
        struct S3DVertex;\r
        struct S3DVertex2TCoords;\r
        struct S3DVertexTangents;\r
+       struct SLight;\r
        class IImageLoader;\r
        class IImageWriter;\r
        class IMaterialRenderer;\r
@@ -844,6 +845,48 @@ namespace video
                                        const core::position2d<s32>& end,\r
                                        SColor color=SColor(255,255,255,255)) =0;\r
 \r
+               //! Draws a shadow volume into the stencil buffer.\r
+               /** To draw a stencil shadow, do this: First, draw all geometry.\r
+               Then use this method, to draw the shadow volume. Then, use\r
+               IVideoDriver::drawStencilShadow() to visualize the shadow.\r
+               Please note that the code for the opengl version of the method\r
+               is based on free code sent in by Philipp Dortmann, lots of\r
+               thanks go to him!\r
+               \param triangles Array of 3d vectors, specifying the shadow\r
+               volume.\r
+               \param zfail If set to true, zfail method is used, otherwise\r
+               zpass.\r
+               \param debugDataVisible The debug data that is enabled for this\r
+               shadow node\r
+               */\r
+               virtual void drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail=true, u32 debugDataVisible=0) =0;\r
+\r
+               //! Fills the stencil shadow with color.\r
+               /** After the shadow volume has been drawn into the stencil\r
+               buffer using IVideoDriver::drawStencilShadowVolume(), use this\r
+               to draw the color of the shadow.\r
+               Please note that the code for the opengl version of the method\r
+               is based on free code sent in by Philipp Dortmann, lots of\r
+               thanks go to him!\r
+               \param clearStencilBuffer Set this to false, if you want to\r
+               draw every shadow with the same color, and only want to call\r
+               drawStencilShadow() once after all shadow volumes have been\r
+               drawn. Set this to true, if you want to paint every shadow with\r
+               its own color.\r
+               \param leftUpEdge Color of the shadow in the upper left corner\r
+               of screen.\r
+               \param rightUpEdge Color of the shadow in the upper right\r
+               corner of screen.\r
+               \param leftDownEdge Color of the shadow in the lower left\r
+               corner of screen.\r
+               \param rightDownEdge Color of the shadow in the lower right\r
+               corner of screen. */\r
+               virtual void drawStencilShadow(bool clearStencilBuffer=false,\r
+                       video::SColor leftUpEdge = video::SColor(255,0,0,0),\r
+                       video::SColor rightUpEdge = video::SColor(255,0,0,0),\r
+                       video::SColor leftDownEdge = video::SColor(255,0,0,0),\r
+                       video::SColor rightDownEdge = video::SColor(255,0,0,0)) =0;\r
+\r
                //! Draws a mesh buffer\r
                /** \param mb Buffer to draw */\r
                virtual void drawMeshBuffer(const scene::IMeshBuffer* mb) =0;\r
@@ -912,6 +955,33 @@ namespace video
                \return Amount of primitives drawn in the last frame. */\r
                virtual u32 getPrimitiveCountDrawn( u32 mode =0 ) const =0;\r
 \r
+               //! Deletes all dynamic lights which were previously added with addDynamicLight().\r
+               virtual void deleteAllDynamicLights() =0;\r
+\r
+               //! adds a dynamic light, returning an index to the light\r
+               //! \param light: the light data to use to create the light\r
+               //! \return An index to the light, or -1 if an error occurs\r
+               virtual s32 addDynamicLight(const SLight& light) =0;\r
+\r
+               //! Returns the maximal amount of dynamic lights the device can handle\r
+               /** \return Maximal amount of dynamic lights. */\r
+               virtual u32 getMaximalDynamicLightAmount() const =0;\r
+\r
+               //! Returns amount of dynamic lights currently set\r
+               /** \return Amount of dynamic lights currently set */\r
+               virtual u32 getDynamicLightCount() const =0;\r
+\r
+               //! Returns light data which was previously set by IVideoDriver::addDynamicLight().\r
+               /** \param idx Zero based index of the light. Must be 0 or\r
+               greater and smaller than IVideoDriver::getDynamicLightCount.\r
+               \return Light data. */\r
+               virtual const SLight& getDynamicLight(u32 idx) const =0;\r
+\r
+               //! Turns a dynamic light on or off\r
+               //! \param lightIndex: the index returned by addDynamicLight\r
+               //! \param turnOn: true to turn the light on, false to turn it off\r
+               virtual void turnLightOn(s32 lightIndex, bool turnOn) =0;\r
+\r
                //! Gets name of this video driver.\r
                /** \return Returns the name of the video driver, e.g. in case\r
                of the Direct3D8 driver, it would return "Direct3D 8.1". */\r