/usr/include/OGRE/OgrePredefinedControllers.h is in libogre-1.8-dev 1.8.0+dfsg1-7+b1.
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 | /*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __PredefinedControllers_H__
#define __PredefinedControllers_H__
#include "OgrePrerequisites.h"
#include "OgreCommon.h"
#include "OgreController.h"
#include "OgreFrameListener.h"
#include "OgreGpuProgram.h"
namespace Ogre {
/** \addtogroup Core
* @{
*/
/** \addtogroup General
* @{
*/
//-----------------------------------------------------------------------
// Controller Values
//-----------------------------------------------------------------------
/** Predefined controller value for getting the latest frame time.
*/
class _OgreExport FrameTimeControllerValue : public ControllerValue<Real>, public FrameListener
{
protected:
Real mFrameTime;
Real mTimeFactor;
Real mElapsedTime;
Real mFrameDelay;
public:
FrameTimeControllerValue();
bool frameEnded(const FrameEvent &evt);
bool frameStarted(const FrameEvent &evt);
Real getValue(void) const;
void setValue(Real value);
Real getTimeFactor(void) const;
void setTimeFactor(Real tf);
Real getFrameDelay(void) const;
void setFrameDelay(Real fd);
Real getElapsedTime(void) const;
void setElapsedTime(Real elapsedTime);
};
//-----------------------------------------------------------------------
/** Predefined controller value for getting / setting the frame number of a texture layer
*/
class _OgreExport TextureFrameControllerValue : public ControllerValue<Real>
{
protected:
TextureUnitState* mTextureLayer;
public:
TextureFrameControllerValue(TextureUnitState* t);
/** Gets the frame number as a parametric value in the range [0,1]
*/
Real getValue(void) const;
/** Sets the frame number as a parametric value in the range [0,1]; the actual frame number is value * (numFrames-1).
*/
void setValue(Real value);
};
//-----------------------------------------------------------------------
/** Predefined controller value for getting / setting a texture coordinate modifications (scales and translates).
@remarks
Effects can be applied to the scale or the offset of the u or v coordinates, or both. If separate
modifications are required to u and v then 2 instances are required to control both independently, or 4
if you ant separate u and v scales as well as separate u and v offsets.
@par
Because of the nature of this value, it can accept values outside the 0..1 parametric range.
*/
class _OgreExport TexCoordModifierControllerValue : public ControllerValue<Real>
{
protected:
bool mTransU, mTransV;
bool mScaleU, mScaleV;
bool mRotate;
TextureUnitState* mTextureLayer;
public:
/** Constructor.
@param
t TextureUnitState to apply the modification to.
@param
translateU If true, the u coordinates will be translated by the modification.
@param
translateV If true, the v coordinates will be translated by the modification.
@param
scaleU If true, the u coordinates will be scaled by the modification.
@param
scaleV If true, the v coordinates will be scaled by the modification.
@param
rotate If true, the texture will be rotated by the modification.
*/
TexCoordModifierControllerValue(TextureUnitState* t, bool translateU = false, bool translateV = false,
bool scaleU = false, bool scaleV = false, bool rotate = false );
Real getValue(void) const;
void setValue(Real value);
};
//-----------------------------------------------------------------------
/** Predefined controller value for setting a single floating-
point value in a constant parameter of a vertex or fragment program.
@remarks
Any value is accepted, it is propagated into the 'x'
component of the constant register identified by the index. If you
need to use named parameters, retrieve the index from the param
object before setting this controller up.
@note
Retrieving a value from the program parameters is not currently
supported, therefore do not use this controller value as a source,
only as a target.
*/
class _OgreExport FloatGpuParameterControllerValue : public ControllerValue<Real>
{
protected:
/// The parameters to access
GpuProgramParametersSharedPtr mParams;
/// The index of the parameter to e read or set
size_t mParamIndex;
public:
/** Constructor.
@param
params The parameters object to access
@param
index The index of the parameter to be set
*/
FloatGpuParameterControllerValue(GpuProgramParametersSharedPtr params,
size_t index );
~FloatGpuParameterControllerValue() {}
Real getValue(void) const;
void setValue(Real value);
};
//-----------------------------------------------------------------------
// Controller functions
//-----------------------------------------------------------------------
/** Predefined controller function which just passes through the original source
directly to dest.
*/
class _OgreExport PassthroughControllerFunction : public ControllerFunction<Real>
{
public:
/** Constructor.
@param
sequenceTime The amount of time in seconds it takes to loop through the whole animation sequence.
@param
timeOffset The offset in seconds at which to start (default is start at 0)
*/
PassthroughControllerFunction(bool deltaInput = false);
/** Overriden function.
*/
Real calculate(Real source);
};
/** Predefined controller function for dealing with animation.
*/
class _OgreExport AnimationControllerFunction : public ControllerFunction<Real>
{
protected:
Real mSeqTime;
Real mTime;
public:
/** Constructor.
@param
sequenceTime The amount of time in seconds it takes to loop through the whole animation sequence.
@param
timeOffset The offset in seconds at which to start (default is start at 0)
*/
AnimationControllerFunction(Real sequenceTime, Real timeOffset = 0.0f);
/** Overridden function.
*/
Real calculate(Real source);
/** Set the time value manually. */
void setTime(Real timeVal);
/** Set the sequence duration value manually. */
void setSequenceTime(Real seqVal);
};
//-----------------------------------------------------------------------
/** Predefined controller function which simply scales an input to an output value.
*/
class _OgreExport ScaleControllerFunction : public ControllerFunction<Real>
{
protected:
Real mScale;
public:
/** Constructor, requires a scale factor.
@param
scalefactor The multiplier applied to the input to produce the output.
@param
deltaInput If true, signifies that the input will be a delta value such that the function should
add it to an internal counter before calculating the output.
*/
ScaleControllerFunction(Real scalefactor, bool deltaInput);
/** Overridden method.
*/
Real calculate(Real source);
};
//-----------------------------------------------------------------------
/** Predefined controller function based on a waveform.
@remarks
A waveform function translates parametric input to parametric output based on a wave. The factors
affecting the function are:
- wave type - the shape of the wave
- base - the base value of the output from the wave
- frequency - the speed of the wave in cycles per second
- phase - the offset of the start of the wave, e.g. 0.5 to start half-way through the wave
- amplitude - scales the output so that instead of lying within [0,1] it lies within [0,1] * amplitude
- duty cycle - the active width of a PWM signal
@par
Note that for simplicity of integration with the rest of the controller insfrastructure, the output of
the wave is parametric i.e. 0..1, rather than the typical wave output of [-1,1]. To compensate for this, the
traditional output of the wave is scaled by the following function before output:
@par
output = (waveoutput + 1) * 0.5
@par
Hence a wave output of -1 becomes 0, a wave ouput of 1 becomes 1, and a wave output of 0 becomes 0.5.
*/
class _OgreExport WaveformControllerFunction : public ControllerFunction<Real>
{
protected:
WaveformType mWaveType;
Real mBase;
Real mFrequency;
Real mPhase;
Real mAmplitude;
Real mDutyCycle;
/** Overridden from ControllerFunction. */
Real getAdjustedInput(Real input);
public:
/** Default constructor, requires at least a wave type, other parameters can be defaulted unless required.
@param
deltaInput If true, signifies that the input will be a delta value such that the function should
add it to an internal counter before calculating the output.
@param
dutyCycle Used in PWM mode to specify the pulse width.
*/
WaveformControllerFunction(WaveformType wType, Real base = 0, Real frequency = 1, Real phase = 0, Real amplitude = 1, bool deltaInput = true, Real dutyCycle = 0.5);
/** Overridden function.
*/
Real calculate(Real source);
};
//-----------------------------------------------------------------------
/** @} */
/** @} */
}
#endif
|