iengine/lightmgr.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2004 by Jorrit Tyberghein 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_IENGINE_LIGHTMGR_H__ 00020 #define __CS_IENGINE_LIGHTMGR_H__ 00021 00029 #include "csutil/flags.h" 00030 #include "csutil/ref.h" 00031 #include "csutil/scf.h" 00032 #include "csutil/weakref.h" 00033 00034 #include "iengine/light.h" 00035 #include "iutil/array.h" 00036 00037 struct iLight; 00038 struct iMeshWrapper; 00039 struct iSector; 00040 class csFrustum; 00041 class csBox3; 00042 class csReversibleTransform; 00043 00047 enum csLightQueryFlags 00048 { 00049 // Flags for returned info 00050 CS_LIGHTQUERY_GET_LIGHT = 0x0001, 00051 00052 // Flags for where to get the info from 00053 CS_LIGHTQUERY_GET_ALL_SECTORS = 0x0010, 00054 00055 CS_LIGHTQUERY_GET_TYPE_STATIC = 0x0100, 00056 CS_LIGHTQUERY_GET_TYPE_DYNAMIC = 0x0200, 00057 CS_LIGHTQUERY_GET_TYPE_ALL = 00058 CS_LIGHTQUERY_GET_TYPE_STATIC | CS_LIGHTQUERY_GET_TYPE_DYNAMIC, 00059 00060 // Some presets 00061 CS_LIGHTQUERY_GET_ALL = 0xFFFF 00062 }; 00063 00067 struct csLightInfluence 00068 { 00069 iLight* light; 00073 csLightType type; 00074 csFlags flags; 00075 csLightDynamicType dynamicType; 00077 00081 float perceivedIntensity; 00082 00083 csLightInfluence () : light (0), type (CS_LIGHT_POINTLIGHT), 00084 dynamicType (CS_LIGHT_DYNAMICTYPE_DYNAMIC), perceivedIntensity (0) {} 00085 00086 inline friend bool operator == (const csLightInfluence& r1, const csLightInfluence& r2) 00087 { 00088 return (r1.light == r2.light); 00089 } 00090 }; 00091 00095 struct iLightInfluenceArray : public iArrayChangeAll<csLightInfluence> 00096 { SCF_IARRAYCHANGEALL_INTERFACE(iLightInfluenceArray); }; 00097 00101 struct iLightInfluenceCallback : public virtual iBase 00102 { 00103 SCF_INTERFACE(iLightInfluenceCallback,1,0,0); 00104 00108 virtual void LightInfluence (const csLightInfluence& li) = 0; 00109 }; 00110 00132 struct iLightManager : public virtual iBase 00133 { 00134 SCF_INTERFACE(iLightManager,5,0,1); 00135 00150 virtual void GetRelevantLights (iMeshWrapper* meshObject, 00151 iLightInfluenceArray* lightArray, int maxLights, uint flags = CS_LIGHTQUERY_GET_ALL) = 0; 00152 00168 virtual void GetRelevantLights (iMeshWrapper* meshObject, 00169 iLightInfluenceCallback* lightCallback, int maxLights, 00170 uint flags = CS_LIGHTQUERY_GET_ALL) = 0; 00171 00183 virtual void GetRelevantLights (iSector* sector, 00184 iLightInfluenceArray* lightArray, int maxLights, 00185 uint flags = CS_LIGHTQUERY_GET_ALL) = 0; 00186 00199 virtual void GetRelevantLights (iSector* sector, 00200 iLightInfluenceCallback* lightCallback, int maxLights, 00201 uint flags = CS_LIGHTQUERY_GET_ALL) = 0; 00202 00220 virtual void GetRelevantLights (iSector* sector, const csBox3& boundingBox, 00221 iLightInfluenceArray* lightArray, int maxLights, 00222 const csReversibleTransform* bboxToWorld = 0, 00223 uint flags = CS_LIGHTQUERY_GET_ALL) = 0; 00224 00242 virtual void GetRelevantLights (iSector* sector, const csBox3& boundingBox, 00243 iLightInfluenceCallback* lightCallback, int maxLights, 00244 const csReversibleTransform* bboxToWorld = 0, 00245 uint flags = CS_LIGHTQUERY_GET_ALL) = 0; 00246 00251 virtual void FreeInfluenceArray (csLightInfluence* Array) = 0; 00252 00267 virtual void GetRelevantLights (iMeshWrapper* meshObject, 00268 csLightInfluence*& lightArray, size_t& numLights, 00269 size_t maxLights = (size_t)~0, 00270 uint flags = CS_LIGHTQUERY_GET_ALL) = 0; 00271 00283 virtual void GetRelevantLights (iSector* sector, 00284 csLightInfluence*& lightArray, 00285 size_t& numLights, size_t maxLights = (size_t)~0, 00286 uint flags = CS_LIGHTQUERY_GET_ALL) = 0; 00287 00304 virtual void GetRelevantLights (iSector* sector, 00305 const csBox3& boundingBox, csLightInfluence*& lightArray, 00306 size_t& numLights, size_t maxLights = (size_t)~0, 00307 const csReversibleTransform* bboxToWorld = 0, 00308 uint flags = CS_LIGHTQUERY_GET_ALL) = 0; 00309 00327 virtual void GetRelevantLightsSorted (iSector* sector, 00328 const csBox3& boundingBox, csLightInfluence*& lightArray, 00329 size_t& numLights, size_t maxLights = (size_t)~0, 00330 const csReversibleTransform* bboxToWorld = 0, 00331 uint flags = CS_LIGHTQUERY_GET_ALL) = 0; 00332 }; 00333 00337 #endif // __CS_IENGINE_LIGHTMGR_H__ 00338
Generated for Crystal Space 2.1 by doxygen 1.6.1
