ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
Loading...
Searching...
No Matches
ToyMaker::Constraint< LagrangeCount > Class Template Reference

Any constraint storing LagrangeCount correction multipliers. More...

#include <types.hpp>

Inheritance diagram for ToyMaker::Constraint< LagrangeCount >:
ToyMaker::BaseConstraint ToyMaker::ParametrizedConstraint< TParameter, LagrangeCount >

Public Member Functions

void applyLagrangeDelta (float delta, uint8_t index)
 Adds a delta to a lagrange value located at index.
const std::array< float, LagrangeCount > & getLagrange () const
 Gets the current Lagrange multiplier values for this constraint.
const std::array< float, LagrangeCount > & getLagrangeDelta () const
 Gets the latest lagrange delta applied to a constraint.
void resetLagrange () override
 Sets all lagrange multipliers to 0 in preparation for the next physics update.
template<uint8_t ... indices>
void resetLagrange (std::integer_sequence< uint8_t, indices... > sequence)
Public Member Functions inherited from ToyMaker::BaseConstraint
float getCompliance () const
 Gets the current compliance value for this constraint.
virtual void applyConstraintPosition (const ParticipantTable &states, float substepSeconds)
 Applies positional constraint to current set of bounds and physics states.
virtual void applyConstraintVelocity (const ParticipantTable &states, float substepSeconds)
 Applies velocity-based constraint to current set of bounds and physics states.
void setCompliance (float newCompliance)
 Sets the compliance value for this constraint.

Protected Member Functions

 Constraint (float compliance)
 Initializes this constraint with some initial compliance value.
Protected Member Functions inherited from ToyMaker::BaseConstraint
 BaseConstraint (float compliance)
 Initializes this constraint.

Private Member Functions

template<uint8_t... ints>
void resetLagrange (std::integer_sequence< uint8_t, ints... > index)
 Private implementation for each lagrange multiplier index in need of a reset.

Private Attributes

std::array< float, LagrangeCount > mLagrangeMultipliers { 0.f }
 The Lagrange multiplier, computed every substep since the start of the physics simulation till the current time.
std::array< float, LagrangeCount > mLagrangeDeltas { 0.f }
 The last delta applied to the Lagrange multiplier for this constraint.

Additional Inherited Members

Public Types inherited from ToyMaker::BaseConstraint
using ParticipantID = std::size_t
using ParticipantTable

Detailed Description

template<uint8_t LagrangeCount>
class ToyMaker::Constraint< LagrangeCount >

Any constraint storing LagrangeCount correction multipliers.

@tparameter LagrangeCount The number of Lagrange multipliers in usage by this constraint

Member Function Documentation

◆ resetLagrange()

template<uint8_t LagrangeCount>
void ToyMaker::Constraint< LagrangeCount >::resetLagrange ( )
inlineoverridevirtual

Sets all lagrange multipliers to 0 in preparation for the next physics update.

Reimplemented from ToyMaker::BaseConstraint.

Member Data Documentation

◆ mLagrangeMultipliers

template<uint8_t LagrangeCount>
std::array<float, LagrangeCount> ToyMaker::Constraint< LagrangeCount >::mLagrangeMultipliers { 0.f }
private

The Lagrange multiplier, computed every substep since the start of the physics simulation till the current time.

Allows position and orientation corrections applied by this constraint to be independent of the length of substep.


The documentation for this class was generated from the following file:
  • ToyMaker_Main/include/toymaker/engine/physics/types.hpp