add back code blow away in regex replacements

This commit is contained in:
Stephen Birarda 2014-04-09 10:03:26 -07:00
parent f969e050cd
commit b8bfe325a0

View file

@ -8,6 +8,29 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <glm/glm.hpp>
#include <SharedUtil.h>
#include "Util.h"
#include "world.h"
#include "Physics.h"
//
// Applies static friction: maxVelocity is the largest velocity for which there
// there is friction, and strength is the amount of friction force applied to reduce
// velocity.
//
void applyStaticFriction(float deltaTime, glm::vec3& velocity, float maxVelocity, float strength) {
float v = glm::length(velocity);
if (v < maxVelocity) {
velocity *= glm::clamp((1.0f - deltaTime * strength * (1.f - v / maxVelocity)), 0.0f, 1.0f);
}
}
//
// Applies velocity damping, with a strength value for linear and squared velocity damping
//
void applyDamping(float deltaTime, glm::vec3& velocity, float linearStrength, float squaredStrength) {
if (squaredStrength == 0.f) {
velocity *= glm::clamp(1.f - deltaTime * linearStrength, 0.f, 1.f);
@ -18,5 +41,4 @@ void applyDamping(float deltaTime, glm::vec3& velocity, float linearStrength, fl
void applyDampedSpring(float deltaTime, glm::vec3& velocity, glm::vec3& position, glm::vec3& targetPosition, float k, float damping) {
}
}