Jet
v1.3.3
|
Abstract base class for physics-based animation. More...
#include <jet/physics_animation.h>
Public Member Functions | |
PhysicsAnimation () | |
Default constructor. More... | |
virtual | ~PhysicsAnimation () |
Destructor. More... | |
bool | isUsingFixedSubTimeSteps () const |
Returns true if fixed sub-timestepping is used. More... | |
void | setIsUsingFixedSubTimeSteps (bool isUsing) |
Sets true if fixed sub-timestepping is used. More... | |
unsigned int | numberOfFixedSubTimeSteps () const |
Returns the number of fixed sub-timesteps. More... | |
void | setNumberOfFixedSubTimeSteps (unsigned int numberOfSteps) |
Sets the number of fixed sub-timesteps. More... | |
void | advanceSingleFrame () |
Advances a single frame. More... | |
Frame | currentFrame () const |
Returns current frame. More... | |
void | setCurrentFrame (const Frame &frame) |
Sets current frame cursor (but do not invoke update()). More... | |
double | currentTimeInSeconds () const |
Returns current time in seconds. More... | |
![]() | |
Animation () | |
virtual | ~Animation () |
void | update (const Frame &frame) |
Updates animation state for given frame . More... | |
Protected Member Functions | |
virtual void | onAdvanceTimeStep (double timeIntervalInSeconds)=0 |
Called when a single time-step should be advanced. More... | |
virtual unsigned int | numberOfSubTimeSteps (double timeIntervalInSeconds) const |
Returns the required number of sub-timesteps for given time interval. More... | |
virtual void | onInitialize () |
Called at frame 0 to initialize the physics state. More... | |
Abstract base class for physics-based animation.
This class represents physics-based animation by adding time-integration specific functions to Animation class.
jet::PhysicsAnimation::PhysicsAnimation | ( | ) |
Default constructor.
|
virtual |
Destructor.
void jet::PhysicsAnimation::advanceSingleFrame | ( | ) |
Advances a single frame.
Frame jet::PhysicsAnimation::currentFrame | ( | ) | const |
Returns current frame.
double jet::PhysicsAnimation::currentTimeInSeconds | ( | ) | const |
Returns current time in seconds.
This function returns the current time which is calculated by adding current frame + sub-timesteps it passed.
bool jet::PhysicsAnimation::isUsingFixedSubTimeSteps | ( | ) | const |
Returns true if fixed sub-timestepping is used.
When performing a time-integration, it is often required to take sub-timestepping for better results. The sub-stepping can be either fixed rate or adaptive, and this function returns which feature is currently selected.
unsigned int jet::PhysicsAnimation::numberOfFixedSubTimeSteps | ( | ) | const |
Returns the number of fixed sub-timesteps.
When performing a time-integration, it is often required to take sub-timestepping for better results. The sub-stepping can be either fixed rate or adaptive, and this function returns the number of fixed sub-steps.
|
protectedvirtual |
Returns the required number of sub-timesteps for given time interval.
The required number of sub-timestep can be different depending on the physics model behind the implementation. Override this function to implement own logic for model specific sub-timestepping for given time interval.
[in] | timeIntervalInSeconds | The time interval in seconds. |
Reimplemented in jet::GridFluidSolver2, jet::GridFluidSolver3, jet::SphSolver2, and jet::SphSolver3.
|
protectedpure virtual |
Called when a single time-step should be advanced.
When Animation::update function is called, this class will internally subdivide a frame into sub-steps if needed. Each sub-step, or time-step, is then taken to move forward in time. This function is called for each time-step, and a subclass that inherits PhysicsAnimation class should implement this function for its own physics model.
[in] | timeIntervalInSeconds | The time interval in seconds |
Implemented in jet::ParticleSystemSolver2, jet::ParticleSystemSolver3, jet::GridFluidSolver2, and jet::GridFluidSolver3.
|
protectedvirtual |
Called at frame 0 to initialize the physics state.
Inheriting classes can override this function to setup initial condition for the simulation.
Reimplemented in jet::GridFluidSolver2, jet::GridFluidSolver3, jet::ParticleSystemSolver2, jet::ParticleSystemSolver3, jet::PicSolver3, and jet::PicSolver2.
void jet::PhysicsAnimation::setCurrentFrame | ( | const Frame & | frame | ) |
Sets current frame cursor (but do not invoke update()).
void jet::PhysicsAnimation::setIsUsingFixedSubTimeSteps | ( | bool | isUsing | ) |
Sets true if fixed sub-timestepping is used.
When performing a time-integration, it is often required to take sub-timestepping for better results. The sub-stepping can be either fixed rate or adaptive, and this function sets which feature should be selected.
[in] | isUsing | True to enable fixed sub-stepping. |
void jet::PhysicsAnimation::setNumberOfFixedSubTimeSteps | ( | unsigned int | numberOfSteps | ) |
Sets the number of fixed sub-timesteps.
When performing a time-integration, it is often required to take sub-timestepping for better results. The sub-stepping can be either fixed rate or adaptive, and this function sets the number of fixed sub-steps.
[in] | numberOfSteps | The number of fixed sub-timesteps. |