2
* Copyright (C) 2012 Arjun Kumar <arjun1991@gmail.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
#include "OgreIncludes.h"
21
#include "sigc++/connection.h"
32
class ConfigListenerContainer;
36
class GraphicalChangeAdapter;
39
* @brief Handles changes in shadow detail automatically.
40
* Acts as a sub-component of the automatic handling of graphics system.
42
class ShadowDetailManager
48
ShadowDetailManager(GraphicalChangeAdapter& graphicalChangeAdapter, Ogre::SceneManager& sceneManager);
53
~ShadowDetailManager();
56
* @brief Sets the maximum distance the shadows are rendered at in float.
57
* @param distance The maximum distance in float.
59
bool setShadowFarDistance(float distance);
62
* @brief Sets the lod bias for the shadow camera.
64
* This can be used to affect the overall quality of the shadow by affecting the level of detail of the mesh for which the shadow is rendered.
66
* @param factor The bias factor applied to the shadow camera.
68
* @note factor cannot be negative or zero. It is still safe to attempt to set these values as the function will default to a factor of 0.1
70
bool setShadowCameraLodBias(float factor);
73
* @brief Initializes the shadow detail manager.
74
* The manager starts listening for graphics detail change requests.
79
* @brief This can be used to stop this component responding to change requests.
84
* @brief This can be used to restart this component responding to change requests.
90
* @brief Checks level against this component's threshold value to determine change in shadow detail.
91
* This function is used to listen to the changes required by the automatic graphics detail system.
93
bool changeLevel(float level);
96
* @brief Steps down the maximum shadow distance by provided step.
97
* @param step The value to step the distance down by in float.
99
bool stepUpShadowDistance(float step);
102
* @brief Steps up the maximum shadow distance by provided step.
103
* @param step The value to step the distance down by in float.
105
bool stepDownShadowDistance(float step);
108
* @brief Steps down the maximum shadow distance by provided step.
109
* @param step The value to step the distance down by in float.
111
bool stepUpShadowCameraLodBias(float step);
114
* @brief Steps up the maximum shadow distance by provided step.
115
* @param step The value to step the distance down by in float.
117
bool stepDownShadowCameraLodBias(float step);
120
* @brief Connected to the config service to listen for shadow lod bias settings.
122
void Config_ShadowLodBias(const std::string& section, const std::string& key, varconf::Variable& variable);
125
* Holds the distance the rendered shadows are culled. i.e. shadows beyond this distance are not rendered.
126
* @see setShadowFarDistance
128
float mShadowFarDistance;
131
* The threshold fps change after which the shadow camera lod level is changed to respond to performance change requested.
133
float mShadowCameraLodThreshold;
136
* The threshold fps change after which the shadow distance is changed to respond to performance change requested.
138
float mShadowDistanceThreshold;
141
* The maximum distance the shadow far distance can be increased to.
143
float mMaxShadowFarDistance;
146
* The minimum distance the shadow far distance can be decreased to.
148
float mMinShadowFarDistance;
151
* The step taken up or down while changing shadow far distance.
153
float mDefaultShadowDistanceStep;
156
* Holds the level of detail bias for the shadow camera.
157
* @see setShadowCameraLodBias
159
float mShadowCameraLodBias;
162
* The maximum lod bias factor that the shadow camera can have.
164
float mMaxShadowCameraLodBias;
167
* The minimum lod bias factor that the shadow camera can have.
169
float mMinShadowCameraLodBias;
172
* The step taken up or down while changing the lod bias for generating shadows.
174
float mDefaultShadowLodStep;
177
* Holds the reference to the connection to the changeRequired signal. Used to disconnect the signal on destruction of this class or to pause the functioning of this component.
179
sigc::connection mChangeRequiredConnection;
182
* Reference to the scenemanager used to edit the shadows.
184
Ogre::SceneManager& mSceneManager;
187
* @brief Used to listen for configuration changes.
189
ConfigListenerContainer* mConfigListenerContainer;