![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Smooths transitions between values using a linear ramp approach. More...
#include <RampFilter.h>
Public Member Functions | |
| RampFilter () | |
Default constructor for RampFilter. | |
| RampFilter (int frames, float epsilon=0.01f) | |
Constructs a RampFilter with a specified transition duration and epsilon. | |
| float | Filter (float value) |
| Applies the ramp filter to the specified target value. | |
| void | SetIncrement (float increment) |
| Sets the increment for each transition step. | |
| void | SetFrames (int frames) |
| Sets the number of frames for a complete transition. | |
Private Attributes | |
| float | increment |
| The step size for each frame of the transition. | |
| float | filter |
| The current filtered value. | |
| float | epsilon |
| A small tolerance to determine when to stop adjusting. | |
Smooths transitions between values using a linear ramp approach.
This class incrementally adjusts an internal filter value towards a target, ensuring smooth transitions.
Definition at line 24 of file RampFilter.h.
| RampFilter | ( | ) |
Default constructor for RampFilter.
Initializes the filter with default parameters.
Definition at line 3 of file RampFilter.cpp.
| RampFilter | ( | int | frames, |
| float | epsilon = 0.01f |
||
| ) |
Constructs a RampFilter with a specified transition duration and epsilon.
| frames | The number of frames for a complete transition. |
| epsilon | The tolerance for considering the transition complete. |
Definition at line 9 of file RampFilter.cpp.
Applies the ramp filter to the specified target value.
Smoothly transitions the internal filter value towards the given target.
| value | The target value to filter towards. |
Definition at line 14 of file RampFilter.cpp.
References epsilon, filter, increment, and Mathematics::IsClose().
Sets the number of frames for a complete transition.
Automatically calculates the increment based on the number of frames.
| frames | The number of frames for a complete transition. |
Definition at line 30 of file RampFilter.cpp.
References increment.
Sets the increment for each transition step.
| increment | The step size for each frame of the transition. |
Definition at line 26 of file RampFilter.cpp.
References increment.
|
private |
A small tolerance to determine when to stop adjusting.
Definition at line 28 of file RampFilter.h.
Referenced by Filter(), RampFilter(), and RampFilter().
|
private |
The current filtered value.
Definition at line 27 of file RampFilter.h.
Referenced by Filter(), and RampFilter().
|
private |
The step size for each frame of the transition.
Definition at line 26 of file RampFilter.h.
Referenced by Filter(), RampFilter(), RampFilter(), SetFrames(), and SetIncrement().