mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:35:08 +02:00
implement VerletPoint::integrateForward()
This commit is contained in:
parent
b2c2cfec79
commit
60612f6397
2 changed files with 8 additions and 0 deletions
|
@ -11,6 +11,12 @@
|
|||
|
||||
#include "VerletPoint.h"
|
||||
|
||||
void VerletPoint::integrateForward() {
|
||||
glm::vec3 oldPosition = _position;
|
||||
_position += 0.6f * (_position - _lastPosition);
|
||||
_lastPosition = oldPosition;
|
||||
}
|
||||
|
||||
void VerletPoint::accumulateDelta(const glm::vec3& delta) {
|
||||
_accumulatedDelta += delta;
|
||||
++_numDeltas;
|
||||
|
|
|
@ -18,6 +18,8 @@ class VerletPoint {
|
|||
public:
|
||||
VerletPoint() : _position(0.0f), _lastPosition(0.0f), _mass(1.0f), _accumulatedDelta(0.0f), _numDeltas(0) {}
|
||||
|
||||
void initPosition(const glm::vec3& position) { _position = position; _lastPosition = position; }
|
||||
void integrateForward();
|
||||
void accumulateDelta(const glm::vec3& delta);
|
||||
void applyAccumulatedDelta();
|
||||
|
||||
|
|
Loading…
Reference in a new issue