[790] | 1 | #pragma once
|
---|
| 2 |
|
---|
| 3 | #include "Ogre.h"
|
---|
| 4 | #include "OgreTechniqueGroup.h"
|
---|
| 5 | #include "OgreRenderable.h"
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | using namespace Ogre;
|
---|
| 9 |
|
---|
[2240] | 10 | /**
|
---|
| 11 | @brief Structure to store path map cluster information for a subentity.
|
---|
| 12 | */
|
---|
[2185] | 13 | struct PathMapClusters
|
---|
| 14 | {
|
---|
[2240] | 15 | /**
|
---|
| 16 | @brief the number of clusters this subentity belongs to
|
---|
| 17 | */
|
---|
[2185] | 18 | unsigned int count;
|
---|
[2240] | 19 | /**
|
---|
| 20 | @brief the indices of the cluster this subentity belongs to.
|
---|
| 21 | */
|
---|
[2185] | 22 | unsigned int* clusters;
|
---|
[2240] | 23 | /**
|
---|
| 24 | @brief the name of the path map file this subentity uses
|
---|
| 25 | */
|
---|
[2185] | 26 | String pathMapTextureFilename;
|
---|
[2240] | 27 | /**
|
---|
| 28 | @brief the resolution of the path map file.
|
---|
| 29 | */
|
---|
[2185] | 30 | unsigned int pathMapResolution;
|
---|
| 31 | };
|
---|
| 32 |
|
---|
[2240] | 33 | /**
|
---|
| 34 | @brief Structure of a path map entry point.
|
---|
| 35 | */
|
---|
[2185] | 36 | struct PathMapEntryPoint
|
---|
| 37 | {
|
---|
[2240] | 38 | /**
|
---|
| 39 | @brief the position of the entry point.
|
---|
| 40 | */
|
---|
[2185] | 41 | Vector3 position;
|
---|
[2240] | 42 | /**
|
---|
| 43 | @brief the normal of the entry point.
|
---|
| 44 | */
|
---|
[2185] | 45 | Vector3 normal;
|
---|
[2240] | 46 | /**
|
---|
| 47 | @brief the probability of the entry point.
|
---|
| 48 | */
|
---|
[2200] | 49 | float prob;
|
---|
[2420] | 50 | int clusterID;
|
---|
[2185] | 51 | };
|
---|
[2240] | 52 |
|
---|
[790] | 53 | /**
|
---|
| 54 | @brief Implementation of IlluminationManager in an OGRE environment.
|
---|
| 55 | */
|
---|
[874] | 56 | class OgreIlluminationManager: public FrameListener
|
---|
[790] | 57 | {
|
---|
| 58 | protected:
|
---|
| 59 | /**
|
---|
| 60 | @brief Protected constructor (OgreIlluminationManager is a singleton).
|
---|
| 61 | */
|
---|
| 62 | OgreIlluminationManager();
|
---|
| 63 | /**
|
---|
| 64 | @brief Protected destructor.
|
---|
| 65 | */
|
---|
| 66 | virtual ~OgreIlluminationManager();
|
---|
| 67 |
|
---|
| 68 | /**
|
---|
| 69 | @brief Searches for visible renderables with valid TechniqueGroups in a renderqueue.
|
---|
| 70 |
|
---|
| 71 | @param rq pointer to the RenderQueue instance to search in
|
---|
| 72 | */
|
---|
| 73 | void fillVisibleList( RenderQueue * rq);
|
---|
[836] | 74 | /**
|
---|
| 75 | @brief creates a specific type of RenderTechnique for a Renderable's pass.
|
---|
[790] | 76 |
|
---|
[836] | 77 | It searches all registered RenderTechniqueFactories.
|
---|
| 78 | */
|
---|
| 79 | void createTechnique(IllumTechniqueParams* params, Pass* pass, OgreRenderable* rend, OgreSharedRuns* sRuns);
|
---|
[2397] | 80 | bool needMaterialCopyForTechnique(IllumTechniqueParams* params);
|
---|
[790] | 81 | /**
|
---|
[836] | 82 | @brief A helper function to find the renderable object attached to a particle system (ONLY BILLBOARDSETS ARE SUPPORTED).
|
---|
| 83 |
|
---|
| 84 | @param system pointer to the ParticleSystem instance to search in
|
---|
| 85 | @return pointer the connected BillboardSet instance
|
---|
| 86 | */
|
---|
| 87 | BillboardSet* findRenderableInParticleSystem(ParticleSystem* system);
|
---|
[2240] | 88 | /**
|
---|
| 89 | @brief Fires preAllUpdates for registered UpdateListeners.
|
---|
| 90 |
|
---|
| 91 | This is called in each frame before updating the RenderTechniques.
|
---|
| 92 | */
|
---|
[1055] | 93 | void preAllUpdates();
|
---|
[2240] | 94 | /**
|
---|
| 95 | @brief Fires postAllUpdates for registered UpdateListeners.
|
---|
| 96 |
|
---|
| 97 | This is called in each frame after updating the RenderTechniques.
|
---|
| 98 | */
|
---|
[1055] | 99 | void postAllUpdates();
|
---|
[836] | 100 |
|
---|
| 101 | /**
|
---|
| 102 | @brief registered RenderTechniqueFactories
|
---|
| 103 | */
|
---|
| 104 | std::list<RenderTechniqueFactory*> techniqueFactories;
|
---|
| 105 | /**
|
---|
[790] | 106 | @brief The maximum bounding sphere radius that groupped objects ( see SharedRuns class ) can have
|
---|
| 107 | @see canJoin
|
---|
| 108 | @see joinRuns
|
---|
| 109 | */
|
---|
| 110 | float maxRad;
|
---|
[2240] | 111 | /**
|
---|
| 112 | @brief Size of the focusing map.
|
---|
| 113 |
|
---|
| 114 | This map is used if the shadow maps should be focused.
|
---|
| 115 | */
|
---|
[1103] | 116 | unsigned int focusingMapSize;
|
---|
[2240] | 117 | /**
|
---|
| 118 | @brief Size of the shadow maps.
|
---|
| 119 | */
|
---|
[2333] | 120 | unsigned int shadowMapSizePoint;
|
---|
| 121 | unsigned int shadowMapSizeSpot;
|
---|
| 122 | unsigned int shadowMapSizeDirectional;
|
---|
[2240] | 123 | /**
|
---|
| 124 | @brief Size of area lights for soft shadows.
|
---|
| 125 | */
|
---|
[2189] | 126 | float areaLightRadius;
|
---|
[2240] | 127 | /**
|
---|
| 128 | @brief Sets if light space perspective shadow mapping should be used.
|
---|
| 129 | */
|
---|
[2333] | 130 | bool useLISPSMPoint;
|
---|
| 131 | bool useLISPSMSpot;
|
---|
| 132 | bool useLISPSMDirectional;
|
---|
[2240] | 133 | /**
|
---|
| 134 | @brief Sets if the shadow maps should be blurred.
|
---|
| 135 |
|
---|
| 136 | Used in variance shadow mapping.
|
---|
| 137 | */
|
---|
[2333] | 138 | bool blurSMPoint;
|
---|
| 139 | bool blurSMSpot;
|
---|
| 140 | bool blurSMDirectional;
|
---|
[2240] | 141 | /**
|
---|
| 142 | @brief Sets if shadow maps should be focused.
|
---|
| 143 | */
|
---|
[2333] | 144 | bool focusingSMPoint;
|
---|
| 145 | bool focusingSMSpot;
|
---|
| 146 | bool focusingSMDirectional;
|
---|
[2240] | 147 | /**
|
---|
| 148 | @brief The material name that should be used during rendering the shadow maps.
|
---|
| 149 |
|
---|
| 150 | There are several predefined materials that can be used to render shadow maps:
|
---|
| 151 | - GTP/Basic/Depth : writes projected depth values of front facing polygons
|
---|
| 152 | - GTP/Basic/DepthCCW : writes projected depth values of back facing polygons
|
---|
| 153 | - GTP/Basic/Distance : writes distance values (from eyepoint) of front facing polygons
|
---|
| 154 | - GTP/Basic/DistanceCCW : writes distance values (from eyepoint) of back facing polygons
|
---|
| 155 | - GTP/Basic/Distance_Normalized : writes normalized distance values
|
---|
| 156 | (distance values devided by projection farplane - which is set to the attenuation range in case of shadow maps) of front facing polygons
|
---|
| 157 | - GTP/Basic/Distance_NormalizedCCW : writes normalized distance values of back facing polygons
|
---|
| 158 |
|
---|
| 159 | The default material is GTP/Basic/Distance_NormalizedCCW.
|
---|
| 160 | Recommended materials for different light types:
|
---|
| 161 | - spot and point lights : GTP/Basic/Distance_NormalizedCCW or GTP/Basic/Distance_Normalized
|
---|
| 162 | - directional lights : GTP/Basic/Depth or GTP/Basic/DepthCCW
|
---|
| 163 | */
|
---|
[2333] | 164 | String shadowMapMaterialNamePoint;
|
---|
| 165 | String shadowMapMaterialNameSpot;
|
---|
| 166 | String shadowMapMaterialNameDirectional;
|
---|
[2240] | 167 | /**
|
---|
| 168 | @brief Size of the phase texture.
|
---|
| 169 | */
|
---|
[1425] | 170 | unsigned int phaseTextureSize;
|
---|
[2240] | 171 | /**
|
---|
| 172 | @brief Stores maximum bounding radius values for each rendering run type.
|
---|
| 173 | */
|
---|
[1055] | 174 | std::map<RenderingRunType,float> maxRads;
|
---|
[2240] | 175 | /**
|
---|
| 176 | @brief Stores PathMapClusters structures for each subentity.
|
---|
| 177 |
|
---|
| 178 | The String key is the name of the subentity.
|
---|
| 179 | */
|
---|
[2185] | 180 | std::map<String, PathMapClusters> pathMapClusters;
|
---|
[2240] | 181 | /**
|
---|
| 182 | @brief PathMapEntryPoint list.
|
---|
| 183 | */
|
---|
[2185] | 184 | std::vector<PathMapEntryPoint> pathMapEntryPoints;
|
---|
[2240] | 185 | /**
|
---|
| 186 | @brief Stores cluster size for each path map cluster.
|
---|
| 187 | */
|
---|
[2185] | 188 | std::vector<unsigned int> pathMapClusterLengths;
|
---|
[790] | 189 | /**
|
---|
| 190 | @brief The camera attached to the player.
|
---|
| 191 | */
|
---|
| 192 | Camera* mainCamera;
|
---|
| 193 | /**
|
---|
| 194 | @brief The viewport of the player camera.
|
---|
| 195 | */
|
---|
| 196 | Viewport* mainViewport;
|
---|
| 197 | /**
|
---|
| 198 | @brief VisibleFinderVisitor instance.
|
---|
| 199 |
|
---|
| 200 | Used for adding visible renderables with valid TechniqueGroups to the visibleObjects vector.
|
---|
| 201 | */
|
---|
| 202 | class VisibleFinderVisitor* visitor;
|
---|
| 203 | /**
|
---|
| 204 | @brief The one and only OgreIlluminationManager instance.
|
---|
| 205 | */
|
---|
| 206 | static OgreIlluminationManager* instance;
|
---|
| 207 | /**
|
---|
| 208 | @brief Vector containing visible renderables with valid TechniqueGroups that must be refreshed.
|
---|
| 209 | */
|
---|
| 210 | std::vector<const Renderable*> visibleObjects;
|
---|
| 211 | /**
|
---|
| 212 | @brief List containing SharedRuns roots.
|
---|
| 213 |
|
---|
| 214 | It is the IlluminationManager's task to find the SharedRuns which can be joined.
|
---|
| 215 | Only the root SharedRuns needs to be checked.
|
---|
| 216 | */
|
---|
| 217 | std::list<SharedRuns*> sharedRunRoots;
|
---|
| 218 | /**
|
---|
| 219 | @brief Group of RenderingRuns that are used globaly.
|
---|
| 220 |
|
---|
| 221 | Some RenderingRuns have only one instance per application (for example scene depth map).
|
---|
| 222 | These resources are shared between all RenderTechniques.
|
---|
| 223 | */
|
---|
| 224 | OgreSharedRuns globalSharedRuns;
|
---|
| 225 | /**
|
---|
| 226 | @brief Stores groups of RenderingRuns that are attached to individual light sources.
|
---|
| 227 |
|
---|
| 228 | These resources need separate instances for each lightsource ( for example depth shadow maps).
|
---|
| 229 | They are grouped by the name of the lightsource.
|
---|
| 230 | */
|
---|
| 231 | std::map<String, OgreSharedRuns*> perLightRuns;
|
---|
[2240] | 232 | /**
|
---|
| 233 | @brief
|
---|
| 234 | */
|
---|
[1055] | 235 | std::map<GlobalTargetType, GlobalUseRenderTarget*> globalTargets;
|
---|
[2240] | 236 | /**
|
---|
| 237 | @brief Stores registered UpdateListeners.
|
---|
| 238 | */
|
---|
[1055] | 239 | std::vector<UpdateListener*> updateListeners;
|
---|
| 240 |
|
---|
[2333] | 241 | bool joinRuns;
|
---|
| 242 |
|
---|
[790] | 243 | public:
|
---|
[2333] | 244 |
|
---|
| 245 | void joinSharedRuns(bool join){joinRuns = join;}
|
---|
[2240] | 246 | /**
|
---|
| 247 | @brief Registers an UpdateListener instance. @see UpdateListener
|
---|
| 248 | */
|
---|
[1055] | 249 | void addUpdateListener(UpdateListener* l){updateListeners.push_back(l);}
|
---|
[790] | 250 | /**
|
---|
[836] | 251 | @brief registers a RenderTechniqueFactory
|
---|
| 252 | */
|
---|
| 253 | void addRenderTechniqueFactory(RenderTechniqueFactory* factory)
|
---|
| 254 | {
|
---|
| 255 | techniqueFactories.push_back(factory);
|
---|
| 256 | }
|
---|
| 257 | /**
|
---|
[790] | 258 | @brief retirieves the maximum bounding sphere radius with two SharedRuns can be joined.
|
---|
[2240] | 259 |
|
---|
| 260 | Only valid fi all run types use the same radius. This can be set with calling setMaxJoinRadius().
|
---|
| 261 | @see setMaxJoinRadius
|
---|
[790] | 262 | */
|
---|
| 263 | float getMaxJoinRadius(){return maxRad;}
|
---|
[2240] | 264 | /**
|
---|
| 265 | @brief Retirieves the maximum shared bounding sphere radius for a given run type.
|
---|
| 266 | */
|
---|
[1055] | 267 | float getMaxJoinRadius(RenderingRunType type){return maxRads[type];}
|
---|
[790] | 268 | /**
|
---|
[2240] | 269 | @brief sets the maximum bounding sphere radius with two SharedRuns can be joined for all run type.
|
---|
[790] | 270 | */
|
---|
[1055] | 271 | void setMaxJoinRadius(float rad)
|
---|
| 272 | {
|
---|
| 273 | std::map<RenderingRunType,float> ::iterator it = maxRads.begin();
|
---|
| 274 | std::map<RenderingRunType,float> ::iterator itend = maxRads.end();
|
---|
| 275 |
|
---|
| 276 | maxRad = rad;
|
---|
| 277 |
|
---|
| 278 | while(it != itend)
|
---|
| 279 | {
|
---|
| 280 | (*it).second = maxRad;
|
---|
| 281 | it++;
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | }
|
---|
[2240] | 285 | /**
|
---|
| 286 | @brief Sets the maximum shared bounding sphere radius for a given run type.
|
---|
| 287 | */
|
---|
[1055] | 288 | void setMaxJoinRadius(RenderingRunType type, float rad){maxRads[type] = rad;}
|
---|
[2240] | 289 | /**
|
---|
| 290 | @see focusingMapSize
|
---|
| 291 | */
|
---|
[1103] | 292 | void setFocusingMapSize(unsigned int size){focusingMapSize = size;}
|
---|
[2240] | 293 | /**
|
---|
| 294 | @see phaseTextureSize
|
---|
| 295 | */
|
---|
[1425] | 296 | void setPhaseTextureSize(unsigned int size){phaseTextureSize = size;}
|
---|
[2240] | 297 | /**
|
---|
| 298 | @see shadowMapSize
|
---|
| 299 | */
|
---|
[2333] | 300 | void setShadowMapSize(unsigned int size)
|
---|
| 301 | {
|
---|
| 302 | shadowMapSizeDirectional = size;
|
---|
| 303 | shadowMapSizePoint = size;
|
---|
| 304 | shadowMapSizeSpot = size;
|
---|
| 305 | }
|
---|
| 306 | void setShadowMapSize(Light::LightTypes type, unsigned int size)
|
---|
| 307 | {
|
---|
| 308 | switch(type)
|
---|
| 309 | {
|
---|
| 310 | case Light::LT_DIRECTIONAL:
|
---|
| 311 | shadowMapSizeDirectional = size;break;
|
---|
| 312 | case Light::LT_POINT:
|
---|
| 313 | shadowMapSizePoint = size;break;
|
---|
| 314 | case Light::LT_SPOTLIGHT:
|
---|
| 315 | shadowMapSizeSpot = size;break;
|
---|
| 316 | }
|
---|
| 317 | }
|
---|
[790] | 318 | /**
|
---|
| 319 | @brief Returns the one and only OgreIlluminationManager instance.
|
---|
| 320 | */
|
---|
| 321 | static OgreIlluminationManager& getSingleton();
|
---|
| 322 | /**
|
---|
| 323 | @brief The function to be called to render one frame.
|
---|
| 324 |
|
---|
| 325 | This is the main refreshing function. It seasrches for visible objects, manages shared runs, updates render techniques and
|
---|
| 326 | finally renders the scene to framebuffer.
|
---|
| 327 |
|
---|
| 328 | @param frameNumber current framenumber
|
---|
| 329 | @param rt the rendertarget window. Needed to find the viewports that need to be refresh.
|
---|
| 330 | */
|
---|
| 331 | void update(unsigned long frameNumber, RenderTarget* rt);
|
---|
| 332 | /**
|
---|
[949] | 333 | @brief searches for RenderTechniques in materials and creates them for all objects.
|
---|
[836] | 334 | */
|
---|
| 335 | void initTechniques();
|
---|
| 336 | /**
|
---|
[949] | 337 | @brief searches for RenderTechniques in materials and creates them for an Entity.
|
---|
| 338 | */
|
---|
| 339 | void initTechniques(Entity* e);
|
---|
| 340 | /**
|
---|
[1055] | 341 | @brief searches for RenderTechniques in materials and creates them for a Billboardset.
|
---|
| 342 | */
|
---|
| 343 | void initTechniques(BillboardSet* bbs, ParticleSystem* sys);
|
---|
| 344 | /**
|
---|
[790] | 345 | @brief Returns a pointer to the player camera.
|
---|
| 346 |
|
---|
| 347 | @return pointer to the main player camera. Needed by RenderTechnique and RenderingRun classes.
|
---|
| 348 | */
|
---|
| 349 | Camera* getMainCamera(){return mainCamera;}
|
---|
| 350 | /**
|
---|
| 351 | @brief Returns a pointer to the viewport attached to the player camera.
|
---|
| 352 |
|
---|
| 353 | @return pointer to the viewport. Needed by RenderTechnique and RenderingRun classes.
|
---|
| 354 | */
|
---|
| 355 | Viewport* getMainViewport(){return mainViewport;}
|
---|
| 356 | /**
|
---|
| 357 | @brief Sets the player camera.
|
---|
| 358 |
|
---|
| 359 | @param camera pointer to the main player camera
|
---|
| 360 | */
|
---|
| 361 | void setMainCamera(Camera* camera){mainCamera = camera;}
|
---|
| 362 | /**
|
---|
| 363 | @brief Sets the viewport attached to the player camera.
|
---|
| 364 |
|
---|
| 365 | @param viewport pointer to the viewport
|
---|
| 366 | */
|
---|
| 367 | void setMainViewport(Viewport* viewport){mainViewport = viewport;}
|
---|
| 368 | /**
|
---|
| 369 | @brief The function to be called when a shared run is splitted.
|
---|
| 370 |
|
---|
| 371 | @param old pointer to the SharedRuns instance that is split
|
---|
| 372 | @param new1 pointer to one of the SharedRuns instance that remain after split
|
---|
| 373 | @param new2 pointer to the other SharedRuns instance that remain after split
|
---|
| 374 | */
|
---|
| 375 | void sharedRunSplit(SharedRuns* old, SharedRuns* new1, SharedRuns* new2);
|
---|
| 376 | /**
|
---|
| 377 | @brief The function to be called when two shared runs are joined.
|
---|
| 378 |
|
---|
| 379 | @param old1 pointer to one of the SharedRuns instance that are joined
|
---|
| 380 | @param old2 pointer to the other SharedRuns instance that are joined
|
---|
| 381 | @param newsr pointer to the resulting parent SharedRuns instance
|
---|
| 382 | */
|
---|
| 383 | void sharedRunJoin(SharedRuns* old1, SharedRuns* old2, SharedRuns* newsr);
|
---|
| 384 | /**
|
---|
| 385 | @brief Joins shared runs if needed.
|
---|
| 386 |
|
---|
| 387 | Searches the registered shared run roots and join them if necessary (they are close enough).
|
---|
| 388 | */
|
---|
| 389 | void joinSharedRuns();
|
---|
| 390 | /**
|
---|
| 391 | @brief Register a shared run object.
|
---|
| 392 |
|
---|
| 393 | Only called when new techniques are created.
|
---|
| 394 |
|
---|
| 395 | @param runs pointer to the SharedRuns instance to add
|
---|
| 396 | */
|
---|
| 397 | void addSharedRuns(SharedRuns* runs);
|
---|
| 398 | /**
|
---|
| 399 | @brief Searches for the nearest object groups (SharedRuns) that are caustic casters from a given point.
|
---|
| 400 |
|
---|
| 401 | @param position the point to obtain distances from
|
---|
| 402 | @param nearestcasters vector to put the nearest caustic caster SharedRuns to
|
---|
| 403 | @param maxCount the maximum number of nearest casters to search for
|
---|
| 404 | */
|
---|
| 405 | void getNearestCausticCasters(Vector3 position, std::vector<OgreSharedRuns*>* nearestcasters, unsigned int maxCount);
|
---|
| 406 | /**
|
---|
| 407 | @brief Creates a global RenderingRun of the given type.
|
---|
| 408 |
|
---|
| 409 | If a RenderingRun with the given type already exist there is nothing to do.
|
---|
| 410 |
|
---|
| 411 | @param runType type enum of the RenderingRun to create
|
---|
| 412 | */
|
---|
| 413 | void createGlobalRun(RenderingRunType runType);
|
---|
| 414 | /**
|
---|
| 415 | @brief Returns the global RendderingRun with the given type
|
---|
| 416 |
|
---|
| 417 | @param runType type enum of the RenderingRun to retrieve
|
---|
| 418 |
|
---|
| 419 | @return pointer to the RenderingRun, NULL if no RenderingRun with the given type exists
|
---|
| 420 | */
|
---|
| 421 | RenderingRun* getGlobalRun(RenderingRunType runType);
|
---|
[1055] | 422 |
|
---|
[2240] | 423 | // These GlobalUseRenderTargets are only used in fire render technique. Maybe it could be solved with global rendering runs too.
|
---|
[1055] | 424 | GlobalUseRenderTarget* getGlobalTarget(GlobalTargetType type);
|
---|
| 425 | void addGlobalTarget(GlobalTargetType type, GlobalUseRenderTarget* target);
|
---|
[2240] | 426 |
|
---|
[790] | 427 | /**
|
---|
| 428 | @brief Updates a global RenderingRun with the given type.
|
---|
| 429 |
|
---|
| 430 | @param runType type enum of the RenderingRun to update
|
---|
| 431 | @param frameNum current framenumber
|
---|
| 432 | */
|
---|
| 433 | void updateGlobalRun(RenderingRunType runType, unsigned long frameNum);
|
---|
| 434 | /**
|
---|
| 435 | @brief Creates a RenderingRun attached to a lightsource with the given type.
|
---|
| 436 |
|
---|
| 437 | @param lightName name of the lightsource
|
---|
| 438 | @param runType type enum of the RenderingRun to create
|
---|
| 439 | */
|
---|
| 440 | void createPerLightRun(String lightName, RenderingRunType runType);
|
---|
| 441 | /**
|
---|
| 442 | @brief Retuns a RenderingRun attached to a lightsource with the given type.
|
---|
| 443 |
|
---|
| 444 | @param lightName name of the lightsource
|
---|
| 445 | @param runType type enum of the RenderingRun to return
|
---|
| 446 |
|
---|
| 447 | @return pointer to the RenderingRun, NULL if no RenderingRun with the given type exists
|
---|
| 448 | */
|
---|
| 449 | RenderingRun* getPerLightRun(String lightName, RenderingRunType runType);
|
---|
| 450 | /**
|
---|
| 451 | @brief Updates a RenderingRun attached to a lightsource with the given type.
|
---|
| 452 |
|
---|
| 453 | @param lightName name of the lightsource
|
---|
| 454 | @param runType type enum of the RenderingRun to update
|
---|
| 455 | @param frameNum current framenumber
|
---|
| 456 | */
|
---|
| 457 | void updatePerLightRun(String lightName, RenderingRunType runType, unsigned long frameNum);
|
---|
[2240] | 458 | /**
|
---|
| 459 | @brief Saves the phase texture to the given file.
|
---|
| 460 | */
|
---|
[1425] | 461 | void savePhaseTextureToFile(String filename);
|
---|
[2240] | 462 | /**
|
---|
| 463 | @brief Frame listener event handler function.
|
---|
| 464 |
|
---|
| 465 | Inherited from FrameListener. Called at the beginning of each frame.
|
---|
| 466 | */
|
---|
[874] | 467 | bool frameStarted(const FrameEvent& evt)
|
---|
| 468 | {
|
---|
| 469 | update(Root::getSingleton().getCurrentFrameNumber(), mainViewport->getTarget());
|
---|
| 470 | return FrameListener::frameStarted(evt);
|
---|
[2240] | 471 | }
|
---|
| 472 | /**
|
---|
| 473 | @see useLISPSM
|
---|
| 474 | */
|
---|
[2333] | 475 | bool getUseLISPSM(Light::LightTypes type)
|
---|
| 476 | {
|
---|
| 477 | switch(type)
|
---|
| 478 | {
|
---|
| 479 | case Light::LT_DIRECTIONAL:
|
---|
| 480 | return useLISPSMDirectional;
|
---|
| 481 | case Light::LT_POINT:
|
---|
| 482 | return useLISPSMPoint;
|
---|
| 483 | case Light::LT_SPOTLIGHT:
|
---|
| 484 | return useLISPSMSpot;
|
---|
| 485 | }
|
---|
| 486 | }
|
---|
[2240] | 487 | /**
|
---|
| 488 | @see focusingSM
|
---|
| 489 | */
|
---|
[2333] | 490 | bool getFocusingShadowMap(Light::LightTypes type)
|
---|
| 491 | {
|
---|
| 492 | switch(type)
|
---|
| 493 | {
|
---|
| 494 | case Light::LT_DIRECTIONAL:
|
---|
| 495 | return focusingSMDirectional;
|
---|
| 496 | case Light::LT_POINT:
|
---|
| 497 | return focusingSMPoint;
|
---|
| 498 | case Light::LT_SPOTLIGHT:
|
---|
| 499 | return focusingSMSpot;
|
---|
| 500 | }
|
---|
| 501 | }
|
---|
[2240] | 502 | /**
|
---|
| 503 | @see blurSM
|
---|
| 504 | */
|
---|
[2333] | 505 | bool getBlurShadowMap(Light::LightTypes type)
|
---|
| 506 | {
|
---|
| 507 | switch(type)
|
---|
| 508 | {
|
---|
| 509 | case Light::LT_DIRECTIONAL:
|
---|
| 510 | return blurSMDirectional;
|
---|
| 511 | case Light::LT_POINT:
|
---|
| 512 | return blurSMPoint;
|
---|
| 513 | case Light::LT_SPOTLIGHT:
|
---|
| 514 | return blurSMSpot;
|
---|
| 515 | }
|
---|
| 516 | }
|
---|
[2240] | 517 | /**
|
---|
| 518 | @see useLISPSM
|
---|
| 519 | */
|
---|
[2333] | 520 | void setUseLISPSM(bool use)
|
---|
| 521 | {
|
---|
| 522 | useLISPSMDirectional = use;
|
---|
| 523 | useLISPSMPoint = use;
|
---|
| 524 | useLISPSMSpot = use;
|
---|
| 525 | }
|
---|
| 526 | void setUseLISPSM(Light::LightTypes type, bool use)
|
---|
| 527 | {
|
---|
| 528 | switch(type)
|
---|
| 529 | {
|
---|
| 530 | case Light::LT_DIRECTIONAL:
|
---|
| 531 | useLISPSMDirectional = use;break;
|
---|
| 532 | case Light::LT_POINT:
|
---|
| 533 | useLISPSMPoint = use;break;
|
---|
| 534 | case Light::LT_SPOTLIGHT:
|
---|
| 535 | useLISPSMSpot = use;break;
|
---|
| 536 | }
|
---|
| 537 | }
|
---|
[2240] | 538 | /**
|
---|
| 539 | @see focusingSM
|
---|
| 540 | */
|
---|
[2333] | 541 | void setFocusingSM(bool use)
|
---|
| 542 | {
|
---|
| 543 | focusingSMDirectional = use;
|
---|
| 544 | focusingSMPoint = use;
|
---|
| 545 | focusingSMSpot = use;
|
---|
| 546 | }
|
---|
| 547 | void setFocusingSM(Light::LightTypes type, bool use)
|
---|
| 548 | {
|
---|
| 549 | switch(type)
|
---|
| 550 | {
|
---|
| 551 | case Light::LT_DIRECTIONAL:
|
---|
| 552 | focusingSMDirectional = use;break;
|
---|
| 553 | case Light::LT_POINT:
|
---|
| 554 | focusingSMPoint = use;break;
|
---|
| 555 | case Light::LT_SPOTLIGHT:
|
---|
| 556 | focusingSMSpot = use;break;
|
---|
| 557 | }
|
---|
| 558 | }
|
---|
[2240] | 559 | /**
|
---|
| 560 | @see blurSM
|
---|
| 561 | */
|
---|
[2333] | 562 | void setBlurShadowMap(bool use)
|
---|
| 563 | {
|
---|
| 564 | blurSMDirectional = use;
|
---|
| 565 | blurSMPoint = use;
|
---|
| 566 | blurSMSpot = use;
|
---|
| 567 | }
|
---|
| 568 | void setBlurShadowMap(Light::LightTypes type, bool use)
|
---|
| 569 | {
|
---|
| 570 | switch(type)
|
---|
| 571 | {
|
---|
| 572 | case Light::LT_DIRECTIONAL:
|
---|
| 573 | blurSMDirectional = use;break;
|
---|
| 574 | case Light::LT_POINT:
|
---|
| 575 | blurSMPoint = use;break;
|
---|
| 576 | case Light::LT_SPOTLIGHT:
|
---|
| 577 | blurSMSpot = use;break;
|
---|
| 578 | }
|
---|
| 579 | }
|
---|
[2240] | 580 | /**
|
---|
| 581 | @see shadowMapMaterialName
|
---|
| 582 | */
|
---|
[2333] | 583 | void setShadowMapMaterialName(String name)
|
---|
| 584 | {
|
---|
| 585 | shadowMapMaterialNameDirectional = name;
|
---|
| 586 | shadowMapMaterialNamePoint = name;
|
---|
| 587 | shadowMapMaterialNameSpot = name;
|
---|
| 588 | }
|
---|
| 589 | void setShadowMapMaterialName(Light::LightTypes type, String name)
|
---|
| 590 | {
|
---|
| 591 | switch(type)
|
---|
| 592 | {
|
---|
| 593 | case Light::LT_DIRECTIONAL:
|
---|
| 594 | shadowMapMaterialNameDirectional = name;break;
|
---|
| 595 | case Light::LT_POINT:
|
---|
| 596 | shadowMapMaterialNamePoint = name;break;
|
---|
| 597 | case Light::LT_SPOTLIGHT:
|
---|
| 598 | shadowMapMaterialNameSpot = name;break;
|
---|
| 599 | }
|
---|
| 600 | }
|
---|
[2240] | 601 | /**
|
---|
| 602 | @brief Registers a PathMapClusters structure for a given subentity.
|
---|
[2185] | 603 |
|
---|
[2240] | 604 | @param subEntityName name of te subentity
|
---|
| 605 | @param clusters the PathMapClusters that belongs to the given subentity
|
---|
| 606 | */
|
---|
[2185] | 607 | void addPathMapClusters(String subEntityName, PathMapClusters clusters)
|
---|
| 608 | {
|
---|
| 609 | this->pathMapClusters[subEntityName] = clusters;
|
---|
| 610 | }
|
---|
[2240] | 611 | /**
|
---|
| 612 | @brief Returns the PathMapClusters structure registered for a given subentity.
|
---|
| 613 |
|
---|
| 614 | @param subEntityName name of te subentity
|
---|
| 615 | @return pointer to the PathMapClusters structure that belongs to the given subentity
|
---|
| 616 | */
|
---|
[2185] | 617 | PathMapClusters* getPathMapClusters(String subEntityName)
|
---|
| 618 | {
|
---|
| 619 | return &pathMapClusters[subEntityName];
|
---|
| 620 | }
|
---|
[2240] | 621 | /**
|
---|
| 622 | @brief Adds a new PathMapEntryPoint cluster to the entrypoint list.
|
---|
| 623 | */
|
---|
[2185] | 624 | void addPathMapEntryPoint(PathMapEntryPoint p)
|
---|
| 625 | {
|
---|
| 626 | this->pathMapEntryPoints.push_back(p);
|
---|
| 627 | }
|
---|
[2240] | 628 | /**
|
---|
| 629 | @brief Returns the list of entrypoints.
|
---|
| 630 | */
|
---|
[2189] | 631 | std::vector<PathMapEntryPoint>& getPathMapEntryPoints()
|
---|
| 632 | {
|
---|
| 633 | return pathMapEntryPoints;
|
---|
| 634 | }
|
---|
[2240] | 635 | /**
|
---|
| 636 | @brief Adds a new cluster size.
|
---|
| 637 | */
|
---|
[2185] | 638 | void addPathMapClusterLength(unsigned int l)
|
---|
| 639 | {
|
---|
| 640 | this->pathMapClusterLengths.push_back(l);
|
---|
| 641 | }
|
---|
[2240] | 642 | /**
|
---|
| 643 | @brief Gets the number of clusters.
|
---|
| 644 | */
|
---|
[2189] | 645 | unsigned int getPathMapClusterLengthsSize()
|
---|
| 646 | {
|
---|
| 647 | return this->pathMapClusterLengths.size();
|
---|
| 648 | }
|
---|
[2240] | 649 | /**
|
---|
| 650 | @brief Gets the size of the given cluster.
|
---|
| 651 |
|
---|
| 652 | @param index of the cluster
|
---|
| 653 | @return the size of the cluster
|
---|
| 654 | */
|
---|
[2189] | 655 | unsigned int getPathMapClusterLength(unsigned int index)
|
---|
| 656 | {
|
---|
| 657 | return pathMapClusterLengths.at(index);
|
---|
| 658 | }
|
---|
[2240] | 659 | /**
|
---|
| 660 | @see areaLightRadius
|
---|
| 661 | */
|
---|
[2189] | 662 | float getAreaLightRadius(){return areaLightRadius;}
|
---|
[2240] | 663 | /**
|
---|
| 664 | @see areaLightRadius
|
---|
| 665 | */
|
---|
[2189] | 666 | void setAreaLigtRadius(float radius){areaLightRadius = radius;}
|
---|
[2298] | 667 | /**
|
---|
| 668 | @brief Sets the fire rendertarget - frame buffer resolution ratio
|
---|
| 669 | */
|
---|
[2379] | 670 | inline void setFireRenderTargetSize(int size);
|
---|
[2320] | 671 |
|
---|
| 672 | void freeAllResources();
|
---|
[790] | 673 | };
|
---|
| 674 |
|
---|