/usr/include/crystalspace-2.0/iengine/lightmgr.h is in libcrystalspace-dev 2.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | /*
Copyright (C) 2004 by Jorrit Tyberghein
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CS_IENGINE_LIGHTMGR_H__
#define __CS_IENGINE_LIGHTMGR_H__
/**\file
* Light manager
*/
/**
* \addtogroup engine3d_light
* @{ */
#include "csutil/flags.h"
#include "csutil/ref.h"
#include "csutil/scf.h"
#include "csutil/weakref.h"
#include "iengine/light.h"
#include "iutil/array.h"
struct iLight;
struct iMeshWrapper;
struct iSector;
class csFrustum;
class csBox3;
class csReversibleTransform;
/**
*
*/
enum csLightQueryFlags
{
// Flags for returned info
CS_LIGHTQUERY_GET_LIGHT = 0x0001,
// Flags for where to get the info from
CS_LIGHTQUERY_GET_ALL_SECTORS = 0x0010,
CS_LIGHTQUERY_GET_TYPE_STATIC = 0x0100,
CS_LIGHTQUERY_GET_TYPE_DYNAMIC = 0x0200,
CS_LIGHTQUERY_GET_TYPE_ALL =
CS_LIGHTQUERY_GET_TYPE_STATIC | CS_LIGHTQUERY_GET_TYPE_DYNAMIC,
// Some presets
CS_LIGHTQUERY_GET_ALL = 0xFFFF
};
/**
*
*/
struct csLightInfluence
{
iLight* light;
/**
* Other useful information in one handy package
* @{ */
csLightType type;
csFlags flags;
csLightDynamicType dynamicType;
/// @}
/**
* Light intensity (taking into account color and attenuation) at the
* closest point on the supplied bounding box.
*/
float perceivedIntensity;
csLightInfluence () : light (0), type (CS_LIGHT_POINTLIGHT),
dynamicType (CS_LIGHT_DYNAMICTYPE_DYNAMIC), perceivedIntensity (0) {}
inline friend bool operator == (const csLightInfluence& r1, const csLightInfluence& r2)
{
return (r1.light == r2.light);
}
};
/**
*
*/
struct iLightInfluenceArray : public iArrayChangeAll<csLightInfluence>
{ SCF_IARRAYCHANGEALL_INTERFACE(iLightInfluenceArray); };
/**
*
*/
struct iLightInfluenceCallback : public virtual iBase
{
SCF_INTERFACE(iLightInfluenceCallback,1,0,0);
/**
*
*/
virtual void LightInfluence (const csLightInfluence& li) = 0;
};
/**
* An engine (3D or iso) can implement this interface for the benefit
* of mesh objects so that they can request lighting information from
* the engine. The 'logObject' parameter given to these functions is
* the logical parent that is set in the mesh objects.
* The engine must attempt to give this information as efficiently as
* possible. That means only recalculating this lighting information
* when needed (i.e. light moves, object moves, ...).
* <p>
* The engine registers an implementation of this object in the object
* registry with the "iLightManager" name.
*
* Main creators of instances implementing this interface:
* - 3D engine
*
* Main ways to get pointers to this interface:
* - csQueryRegistry<iLightManager>
*
* Main users of this interface:
* - render managers
*/
struct iLightManager : public virtual iBase
{
SCF_INTERFACE(iLightManager,5,0,1);
/**
* Return all 'relevant' light that hit this object. Depending on
* implementation in the engine this can simply mean a list of all lights
* that affect the object or it can be a list of the N most relevant lights
* (with N a parameter set by the user on that object).
* \param logObject logObject is the mesh wrapper.
* \param lightArray lightArray is the array to fill with the relevant lights.
* \param maxLights maxLights is the maximum number of lights that you (as
* the caller of this function) are interested in. Even with this set the
* light manager may still return an array containing more lights. You just
* have to ignore the additional lights then. If you don't want to limit
* the number of lights you can set maxLights to -1.
* \param flags flags provided by csLightQueryFlags
*/
virtual void GetRelevantLights (iMeshWrapper* meshObject,
iLightInfluenceArray* lightArray, int maxLights, uint flags = CS_LIGHTQUERY_GET_ALL) = 0;
/**
* Return all 'relevant' light that hit this object. Depending on
* implementation in the engine this can simply mean a list of all lights
* that affect the object or it can be a list of the N most relevant lights
* (with N a parameter set by the user on that object).
* \param logObject logObject is the mesh wrapper.
* \param lightCallback lightCallback is a callback function to call for
* every encountered influencing light source.
* \param maxLights maxLights is the maximum number of lights that you (as
* the caller of this function) are interested in. Even with this set the
* light manager may still return an array containing more lights. You just
* have to ignore the additional lights then. If you don't want to limit
* the number of lights you can set maxLights to -1.
* \param flags flags provided by csLightQueryFlags
*/
virtual void GetRelevantLights (iMeshWrapper* meshObject,
iLightInfluenceCallback* lightCallback, int maxLights,
uint flags = CS_LIGHTQUERY_GET_ALL) = 0;
/**
* Return all 'relevant' lights for a given sector.
* \param sector is the sector to check for.
* \param lightArray lightArray is the array to fill with the relevant lights.
* \param maxLights maxLights is the maximum number of lights that you (as
* the caller of this function) are interested in. Even with this set the
* light manager may still return an array containing more lights. You just
* have to ignore the additional lights then. If you don't want to limit
* the number of lights you can set maxLights to -1.
* \param flags flags provided by csLightQueryFlags
*/
virtual void GetRelevantLights (iSector* sector,
iLightInfluenceArray* lightArray, int maxLights,
uint flags = CS_LIGHTQUERY_GET_ALL) = 0;
/**
* Return all 'relevant' lights for a given sector.
* \param sector is the sector to check for.
* \param lightCallback lightCallback is a callback function to call for
* every encountered influencing light source.
* \param maxLights maxLights is the maximum number of lights that you (as
* the caller of this function) are interested in. Even with this set the
* light manager may still return an array containing more lights. You just
* have to ignore the additional lights then. If you don't want to limit
* the number of lights you can set maxLights to -1.
* \param flags flags provided by csLightQueryFlags
*/
virtual void GetRelevantLights (iSector* sector,
iLightInfluenceCallback* lightCallback, int maxLights,
uint flags = CS_LIGHTQUERY_GET_ALL) = 0;
/**
* Return all 'relevant' lights that intersects a giving bounding box within
* a specified sector.
* \param sector is the sector to check for.
* \param boundingBox is the bounding box to use when querying lights.
* \param lightArray lightArray is the array to fill with the relevant lights.
* \param maxLights maxLights is the maximum number of lights that you (as
* the caller of this function) are interested in. Even with this set the
* light manager may still return an array containing more lights. You just
* have to ignore the additional lights then. If you don't want to limit
* the number of lights you can set maxLights to -1.
* \param bboxToWorld Optional transformation from bounding box to world
* space. 'this' space is bounding box space, 'other' space is world space.
* Not specifying the transformation has the same effect as specifying
* an identity transform.
* \param flags flags provided by csLightQueryFlags
*/
virtual void GetRelevantLights (iSector* sector, const csBox3& boundingBox,
iLightInfluenceArray* lightArray, int maxLights,
const csReversibleTransform* bboxToWorld = 0,
uint flags = CS_LIGHTQUERY_GET_ALL) = 0;
/**
* Return all 'relevant' light/sector influence objects for a given sector.
* \param sector is the sector to check for.
* \param boundingBox is the bounding box to use when querying lights.
* \param lightCallback lightCallback is a callback function to call for
* every encountered influencing light source.
* \param maxLights maxLights is the maximum number of lights that you (as
* the caller of this function) are interested in. Even with this set the
* light manager may still return an array containing more lights. You just
* have to ignore the additional lights then. If you don't want to limit
* the number of lights you can set maxLights to -1.
* \param bboxToWorld Optional transformation from bounding box to world
* space. 'this' space is bounding box space, 'other' space is world space.
* Not specifying the transformation has the same effect as specifying
* an identity transform.
* \param flags flags provided by csLightQueryFlags
*/
virtual void GetRelevantLights (iSector* sector, const csBox3& boundingBox,
iLightInfluenceCallback* lightCallback, int maxLights,
const csReversibleTransform* bboxToWorld = 0,
uint flags = CS_LIGHTQUERY_GET_ALL) = 0;
/**
* Free a light influence array earlier allocated by GetRelevantLights
* \param Array The light influences array returned by GetRelevantLights().
*/
virtual void FreeInfluenceArray (csLightInfluence* Array) = 0;
/**
* Return all 'relevant' light that hit this object. Depending on
* implementation in the engine this can simply mean a list of all lights
* that affect the object or it can be a list of the N most relevant lights
* (with N a parameter set by the user on that object).
* \param meshObject The mesh wrapper.
* \param boundingBox The bounding box to be used when querying lights.
* \param lightArray Returns a pointer to an arry with the influences of the
* relevant lights. Must be freed with FreeInfluenceArray() after use.
* \param numLights The number of lights returned in \a lightArray.
* \param maxLights The maximum number of lights that you (as
* the caller of this function) are interested in.
* \param flags Flags provided by csLightQueryFlags.
*/
virtual void GetRelevantLights (iMeshWrapper* meshObject,
csLightInfluence*& lightArray, size_t& numLights,
size_t maxLights = (size_t)~0,
uint flags = CS_LIGHTQUERY_GET_ALL) = 0;
/**
* Return all 'relevant' lights for a given sector.
* \param sector is the sector to check for.
* \param boundingBox The bounding box to be used when querying lights.
* \param lightArray Returns a pointer to an arry with the influences of the
* relevant lights. Must be freed with FreeInfluenceArray() after use.
* \param numLights The number of lights returned in \a lightArray.
* \param maxLights The maximum number of lights that you (as
* the caller of this function) are interested in.
* \param flags Flags provided by csLightQueryFlags.
*/
virtual void GetRelevantLights (iSector* sector,
csLightInfluence*& lightArray,
size_t& numLights, size_t maxLights = (size_t)~0,
uint flags = CS_LIGHTQUERY_GET_ALL) = 0;
/**
* Return all 'relevant' lights that intersects a giving bounding box within
* a specified sector.
* \param sector is the sector to check for.
* \param boundingBox The bounding box to be used when querying lights.
* \param lightArray Returns a pointer to an arry with the influences of the
* relevant lights. Must be freed with FreeInfluenceArray() after use.
* \param numLights The number of lights returned in \a lightArray.
* \param maxLights The maximum number of lights that you (as
* the caller of this function) are interested in.
* \param bboxToWorld Optional transformation from bounding box to world
* space. 'this' space is bounding box space, 'other' space is world space.
* Not specifying the transformation has the same effect as specifying
* an identity transform.
* \param flags Flags provided by csLightQueryFlags.
*/
virtual void GetRelevantLights (iSector* sector,
const csBox3& boundingBox, csLightInfluence*& lightArray,
size_t& numLights, size_t maxLights = (size_t)~0,
const csReversibleTransform* bboxToWorld = 0,
uint flags = CS_LIGHTQUERY_GET_ALL) = 0;
/**
* Return all 'relevant' lights that intersects a giving bounding box within
* a specified sector. The returned lights are sorted by the intensity at
* the closest point on(or in) the box.
* \param sector is the sector to check for.
* \param boundingBox The bounding box to be used when querying lights.
* \param lightArray Returns a pointer to an arry with the influences of the
* relevant lights. Must be freed with FreeInfluenceArray() after use.
* \param numLights The number of lights returned in \a lightArray.
* \param maxLights The maximum number of lights that you (as
* the caller of this function) are interested in.
* \param bboxToWorld Optional transformation from bounding box to world
* space. 'this' space is bounding box space, 'other' space is world space.
* Not specifying the transformation has the same effect as specifying
* an identity transform.
* \param flags Flags provided by csLightQueryFlags.
*/
virtual void GetRelevantLightsSorted (iSector* sector,
const csBox3& boundingBox, csLightInfluence*& lightArray,
size_t& numLights, size_t maxLights = (size_t)~0,
const csReversibleTransform* bboxToWorld = 0,
uint flags = CS_LIGHTQUERY_GET_ALL) = 0;
};
/** @} */
#endif // __CS_IENGINE_LIGHTMGR_H__
|