#include <shaderparamoscillator.h>

Public Member Functions | ||||
| ShaderParamOscillator (const std::string &name) | ||||
| Constructs the float parameter. | ||||
| virtual const ShaderParameter::ParamType & | GetType () const | |||
| Gets the type of this parameter. | ||||
| virtual void | AttachToRenderState (osg::StateSet &stateSet) | |||
| Assigns the necessary uniform variables for this parameter to the render state. | ||||
| virtual void | Update () | |||
| Method called by the shader owning this parameter if it detects the parameter has changed state. | ||||
| void | SetValue (float newValue) | |||
| Sets the value - temporarily. | ||||
| float | GetValue () const | |||
| Gets the current value in this parameter. | ||||
| virtual ShaderParameter * | Clone () | |||
| Makes a deep copy of the Shader Parameter. | ||||
| void | SetOffset (float offset) | |||
| The starting point for the timer oscillation. | ||||
| float | GetOffset () const | |||
| Gets the starting point for the timer oscillation. | ||||
| float | GetCurrentRange () const | |||
| Gets the current range. | ||||
| void | SetRangeMin (float minimum) | |||
| The minimum range value for the timer. | ||||
| float | GetRangeMin () const | |||
| The minimum range value for the timer. | ||||
| void | SetRangeMax (float maximum) | |||
| The max range value for the timer. | ||||
| float | GetRangeMax () const | |||
| The max range value for the timer. | ||||
| float | GetCurrentCycleTime () const | |||
| Gets the current cycle time. | ||||
| void | SetCycleTimeMin (float cycleTimeMin) | |||
| The minimum amount for Cycle time. | ||||
| float | GetCycleTimeMin () const | |||
| The min amount of cycle time (see SetCycleTimeMin(). | ||||
| void | SetCycleTimeMax (float cycleTimeMax) | |||
| The maximum amount for Cycle time. | ||||
| float | GetCycleTimeMax () const | |||
| The max amount of cycle time (see SetCycleTimeMax(). | ||||
| void | SetCycleCountTotal (int newCount) | |||
| ||||
| float | GetCycleCountTotal () const | |||
| ||||
| void | SetUseRealTime (bool useRealTime) | |||
| Indicates whether we use real time or simulation time to do our cycle. | ||||
| bool | GetUseRealTime () const | |||
| Gets the texture unit currently assigned to this shader parameter. | ||||
| void | SetOscillationType (const OscillationType &type) | |||
| Sets the way that the timer oscillates values. | ||||
| const OscillationType & | GetOscillationType () const | |||
| Gets the source texture type of this parameter. | ||||
| void | SetOscillationTrigger (const OscillationTrigger &type) | |||
| Sets when the timer will begin to oscillate its value. | ||||
| const OscillationTrigger & | GetOscillationTrigger () const | |||
| Returns the way that the oscillator will begin. | ||||
| const float | GetCycleDirection () const | |||
| Returns the current cycle direction. | ||||
| virtual void | OnMessage (MessageData *data) | |||
| Called by the dtCore::Base class - used to get timer updates. | ||||
| void | TriggerOscillationStart () | |||
| Triggers the oscillation to begin if the trigger type is 'manual' Otherwise, it resets the current oscillation to their starting defaults. | ||||
Static Public Attributes | ||||
| static const int | INFINITE_CYCLE = -1 | |||
Protected Member Functions | ||||
| virtual | ~ShaderParamOscillator () | |||
| void | DoShaderUpdate (float timeDelta) | |||
| Does the actual work for the shader. | ||||
Classes | ||||
| class | OscillationTrigger | |||
| The type of trigger for this parameter. More... | ||||
| class | OscillationType | |||
| The type of oscillation for this parameter. More... | ||||
If you assign this to a node, it will oscillate the value as if it were a time constraint.
| dtCore::ShaderParamOscillator::ShaderParamOscillator | ( | const std::string & | name | ) |
Constructs the float parameter.
| name | Name given to this parameter. If it is to be used in a hardware shader, this name must match the corresponding uniform variable in the shader. |
| dtCore::ShaderParamOscillator::~ShaderParamOscillator | ( | ) | [protected, virtual] |
| virtual const ShaderParameter::ParamType& dtCore::ShaderParamOscillator::GetType | ( | ) | const [inline, virtual] |
| void dtCore::ShaderParamOscillator::AttachToRenderState | ( | osg::StateSet & | stateSet | ) | [virtual] |
Assigns the necessary uniform variables for this parameter to the render state.
This allows the parameter to communicate to the underlying shader.
Implements dtCore::ShaderParameter.
| void dtCore::ShaderParamOscillator::Update | ( | ) | [virtual] |
Method called by the shader owning this parameter if it detects the parameter has changed state.
This method when called, sends the current float value in this parameter to the hardware shader. Since this value oscillates continuously, it will push the value every tick.
Implements dtCore::ShaderParameter.
| void dtCore::ShaderParamOscillator::SetValue | ( | float | newValue | ) | [inline] |
Sets the value - temporarily.
This method is only provided for consistency. Because this parameter oscillates, the value you set will be overridden. Typically, you should never call this method.
| newValue | The new value to set - only changed temporarily until next tick. |
| float dtCore::ShaderParamOscillator::GetValue | ( | ) | const [inline] |
Gets the current value in this parameter.
| ShaderParameter * dtCore::ShaderParamOscillator::Clone | ( | ) | [virtual] |
Makes a deep copy of the Shader Parameter.
Used when a user assigns a shader to a node because we clone the template shader and its parameters. Note - Like Update(), this is a pure virtual method that must be implemented on each param.
Implements dtCore::ShaderParameter.
| void dtCore::ShaderParamOscillator::SetOffset | ( | float | offset | ) | [inline] |
The starting point for the timer oscillation.
In [1.0, 5.0], this would be 1.0. For [-8.0, 12.0], this would be -8.0. Default is 0.0.
| offset | The offset from zero for the bottom value of the timer. |
| float dtCore::ShaderParamOscillator::GetOffset | ( | ) | const [inline] |
Gets the starting point for the timer oscillation.
In [1.0, 5.0], this would be 1.0. For [-8.0, 12.0], this would be -8.0.
| float dtCore::ShaderParamOscillator::GetCurrentRange | ( | ) | const [inline] |
Gets the current range.
Remember offset is the 'bottom', and the 'top' is offset + range. Whenever a tick happens where IsDirty() is true, this value is recomputed.
| void dtCore::ShaderParamOscillator::SetRangeMin | ( | float | minimum | ) | [inline] |
The minimum range value for the timer.
On first update (or first update after a dirty), the min and max are used to compute an actual range. Then, the timer will oscillate between the 'bottom' (offset) and the 'top' (offset plus range). Default is 1.0.
| minimum | The minimum value for the range. Is reset to <= max on next dirty Update. |
| float dtCore::ShaderParamOscillator::GetRangeMin | ( | ) | const [inline] |
The minimum range value for the timer.
On first update (or first update after a dirty), the min and max are used to compute an actual range. Then, the timer will oscillate between the 'bottom' (offset) and the 'top' (offset plus range).
| void dtCore::ShaderParamOscillator::SetRangeMax | ( | float | maximum | ) | [inline] |
The max range value for the timer.
On first update (or first update after a dirty), the min and max are used to compute an actual range. Then, the timer will oscillate between the 'bottom' (offset) and the 'top' (offset plus range). Default is 1.0.
| maximum | The max value for the range. Is reset to >= min on next dirty Update. |
| float dtCore::ShaderParamOscillator::GetRangeMax | ( | ) | const [inline] |
The max range value for the timer.
On first update (or first update after a dirty), the min and max are used to compute an actual range. Then, the timer will oscillate between the 'bottom' (offset) and the 'top' (offset plus range).
| float dtCore::ShaderParamOscillator::GetCurrentCycleTime | ( | ) | const [inline] |
Gets the current cycle time.
This is the actual amount of time (in seconds) that it takes to go from bottom to top (or reverse). 2X this for a full oscillation. This value is NOT settable. Whenever a tick happens where IsDirty() is true, this value is recomputed.
| void dtCore::ShaderParamOscillator::SetCycleTimeMin | ( | float | cycleTimeMin | ) | [inline] |
The minimum amount for Cycle time.
Cycle Time is defined as the amount of time (in seconds) it takes to go from bottom to top, or reverse. Note, if oscillating up and down or down and up, the complete cycle will take 2X cycle time. Default is 1.0.
| cycleTime | The time in secs to go from bottom to top or top to bottom. |
| float dtCore::ShaderParamOscillator::GetCycleTimeMin | ( | ) | const [inline] |
| void dtCore::ShaderParamOscillator::SetCycleTimeMax | ( | float | cycleTimeMax | ) | [inline] |
The maximum amount for Cycle time.
Cycle Time is defined as the amount of time (in seconds) it takes to go from bottom to top, or reverse. Note, if oscillating up and down or down and up, the complete cycle will take 2X cycle time. Default is 1.0.
| cycleTimeMax | The time in secs to go from bottom to top or top to bottom. |
| float dtCore::ShaderParamOscillator::GetCycleTimeMax | ( | ) | const [inline] |
| void dtCore::ShaderParamOscillator::SetCycleCountTotal | ( | int | newCount | ) | [inline] |
| count | The number of cycles that will happen before oscillation stops. |
| float dtCore::ShaderParamOscillator::GetCycleCountTotal | ( | ) | const [inline] |
| void dtCore::ShaderParamOscillator::SetUseRealTime | ( | bool | useRealTime | ) | [inline] |
Indicates whether we use real time or simulation time to do our cycle.
Default is true (real time).
| useRealTime | True means use real time, false uses simulation time. |
| bool dtCore::ShaderParamOscillator::GetUseRealTime | ( | ) | const [inline] |
Gets the texture unit currently assigned to this shader parameter.
| void dtCore::ShaderParamOscillator::SetOscillationType | ( | const OscillationType & | type | ) | [inline] |
Sets the way that the timer oscillates values.
Basically, the offset is considered the 'bottom' and the offset+range is the 'top'. So, up goes from bottom to top, down does the reverse, and the other two go back and forth as you'd expect. Default is UP.
| type | The source type. |
| const OscillationType& dtCore::ShaderParamOscillator::GetOscillationType | ( | ) | const [inline] |
Gets the source texture type of this parameter.
| void dtCore::ShaderParamOscillator::SetOscillationTrigger | ( | const OscillationTrigger & | type | ) | [inline] |
Sets when the timer will begin to oscillate its value.
If set to AUTO, oscillation will begin immediately by itself. If set to MANUAL, oscillation will not occur until the decides to call Start.
| const OscillationTrigger& dtCore::ShaderParamOscillator::GetOscillationTrigger | ( | ) | const [inline] |
Returns the way that the oscillator will begin.
| const float dtCore::ShaderParamOscillator::GetCycleDirection | ( | ) | const [inline] |
Returns the current cycle direction.
Should be either 1.0 or -1.0. You cannot set this but you can find out which direction it is currently going.
| void dtCore::ShaderParamOscillator::OnMessage | ( | MessageData * | data | ) | [virtual] |
Called by the dtCore::Base class - used to get timer updates.
| The | data from the message |
Reimplemented from dtCore::Base.
| void dtCore::ShaderParamOscillator::TriggerOscillationStart | ( | ) |
Triggers the oscillation to begin if the trigger type is 'manual' Otherwise, it resets the current oscillation to their starting defaults.
| void dtCore::ShaderParamOscillator::DoShaderUpdate | ( | float | timeDelta | ) | [protected] |
Does the actual work for the shader.
When called, make sure you pass in the real or simulated as appropriate, based on mUseRealTime.
| timeDelta | The real or simulated time to use to modify the shader |
const int dtCore::ShaderParamOscillator::INFINITE_CYCLE = -1 [static] |