PixelLightAPI  .
SNPointLight.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNPointLight.h                                 *
00003  *
00004  *  Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLSCENE_POINTLIGHT_H__
00024 #define __PLSCENE_POINTLIGHT_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLMath/PlaneSet.h>
00032 #include "PLScene/Scene/SNLight.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLScene {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Classes                                               ]
00043 //[-------------------------------------------------------]
00044 /**
00045 *  @brief
00046 *    Omni directional point light scene node were light is emitted from a single point in space
00047 */
00048 class SNPointLight : public SNLight {
00049 
00050 
00051     //[-------------------------------------------------------]
00052     //[ Public definitions                                    ]
00053     //[-------------------------------------------------------]
00054     public:
00055         static PLS_API const float MinRange;    /**< Minimum point light range (0.0001) */
00056 
00057         /**
00058         *  @brief
00059         *    Scene node debug flags (SceneNode debug flags extension)
00060         */
00061         enum EDebugFlags {
00062             DebugNoScissorRectangle = 1<<8  /**< Do not draw the (pink) scissor rectangle */
00063         };
00064         pl_enum(EDebugFlags)
00065             pl_enum_base(SNLight::EDebugFlags)
00066             pl_enum_value(DebugNoScissorRectangle, "Do not draw the (pink) scissor rectangle")
00067         pl_enum_end
00068 
00069 
00070     //[-------------------------------------------------------]
00071     //[ RTTI interface                                        ]
00072     //[-------------------------------------------------------]
00073     pl_class(PLS_RTTI_EXPORT, SNPointLight, "PLScene", PLScene::SNLight, "Omni directional point light scene node were light is emitted from a single point in space")
00074         // Attributes
00075         pl_attribute(Range,         float,                      1.0f,   ReadWrite,  GetSet, "Light range",  "Min='0.0001'")
00076             // Overwritten SceneNode attributes
00077         pl_attribute(DebugFlags,    pl_flag_type(EDebugFlags),  0,      ReadWrite,  GetSet, "Flags",                    "")
00078         // Constructors
00079         pl_constructor_0(DefaultConstructor,    "Default constructor",  "")
00080     pl_class_end
00081 
00082 
00083     //[-------------------------------------------------------]
00084     //[ Public RTTI get/set functions                         ]
00085     //[-------------------------------------------------------]
00086     public:
00087         PLS_API virtual float GetRange() const;
00088         PLS_API virtual void SetRange(float fValue);
00089 
00090 
00091     //[-------------------------------------------------------]
00092     //[ Public functions                                      ]
00093     //[-------------------------------------------------------]
00094     public:
00095         /**
00096         *  @brief
00097         *    Default constructor
00098         */
00099         PLS_API SNPointLight();
00100 
00101         /**
00102         *  @brief
00103         *    Destructor
00104         */
00105         PLS_API virtual ~SNPointLight();
00106 
00107         /**
00108         *  @brief
00109         *    Returns the box plane set
00110         *
00111         *  @return
00112         *    Box plane set
00113         */
00114         PLS_API const PLMath::PlaneSet &GetBoxPlaneSet();
00115 
00116 
00117     //[-------------------------------------------------------]
00118     //[ Protected definitions                                 ]
00119     //[-------------------------------------------------------]
00120     protected:
00121         /**
00122         *  @brief
00123         *    Flags which hold ínternal light information
00124         */
00125         enum EInternalLightFlags {
00126             // Recalculate
00127             RecalculateBoxPlaneSet  = 1<<0  /**< Recalculation of box plane set required */
00128         };
00129 
00130 
00131     //[-------------------------------------------------------]
00132     //[ Protected data                                        ]
00133     //[-------------------------------------------------------]
00134     protected:
00135         PLCore::uint8 m_nInternalLightFlags;    /**< Internal light flags */
00136 
00137 
00138     //[-------------------------------------------------------]
00139     //[ Private functions                                     ]
00140     //[-------------------------------------------------------]
00141     private:
00142         /**
00143         *  @brief
00144         *    Makes the box plane set dirty
00145         */
00146         void DirtyBoxPlaneSet();
00147 
00148 
00149     //[-------------------------------------------------------]
00150     //[ Private event handlers                                ]
00151     //[-------------------------------------------------------]
00152     private:
00153         PLCore::EventHandler<> EventHandlerPosition;
00154 
00155 
00156     //[-------------------------------------------------------]
00157     //[ Private data                                          ]
00158     //[-------------------------------------------------------]
00159     private:
00160         float            m_fRange;          /**< Light range */
00161         PLMath::PlaneSet m_cBoxPlaneSet;    /**< Box plane set */
00162 
00163 
00164     //[-------------------------------------------------------]
00165     //[ Public virtual SNLight functions                      ]
00166     //[-------------------------------------------------------]
00167     public:
00168         PLS_API virtual bool IsRenderLight() const override;
00169         PLS_API virtual bool IsPointLight() const override;
00170 
00171 
00172     //[-------------------------------------------------------]
00173     //[ Protected virtual SceneNode functions                 ]
00174     //[-------------------------------------------------------]
00175     protected:
00176         PLS_API virtual void UpdateAABoundingBox() override;
00177         PLS_API virtual void GetBoundingSphere(PLMath::Sphere &cSphere) override;
00178         PLS_API virtual void GetContainerBoundingSphere(PLMath::Sphere &cSphere) override;
00179 
00180 
00181     //[-------------------------------------------------------]
00182     //[ Public virtual SceneNode functions                    ]
00183     //[-------------------------------------------------------]
00184     public:
00185         PLS_API virtual void DrawDebug(PLRenderer::Renderer &cRenderer, const VisNode *pVisNode = nullptr) override;
00186 
00187 
00188 };
00189 
00190 
00191 //[-------------------------------------------------------]
00192 //[ Namespace                                             ]
00193 //[-------------------------------------------------------]
00194 } // PLScene
00195 
00196 
00197 #endif // __PLSCENE_POINTLIGHT_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:03
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported