mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Add constant to vector function parameters that don't actually modify their input.
Add more overloads of vector multiplication, required by templates to compile with float=64.
This commit is contained in:
@@ -86,20 +86,20 @@ private:
|
||||
Vector3 mag_next_max;
|
||||
|
||||
///@TODO a few support functions for trackers, most are math related and should likely be moved elsewhere
|
||||
float floor_decimals(float p_value, float p_decimals) {
|
||||
float floor_decimals(const float p_value, const float p_decimals) {
|
||||
float power_of_10 = pow(10.0f, p_decimals);
|
||||
return floor(p_value * power_of_10) / power_of_10;
|
||||
};
|
||||
|
||||
Vector3 floor_decimals(const Vector3 &p_vector, float p_decimals) {
|
||||
Vector3 floor_decimals(const Vector3 &p_vector, const float p_decimals) {
|
||||
return Vector3(floor_decimals(p_vector.x, p_decimals), floor_decimals(p_vector.y, p_decimals), floor_decimals(p_vector.z, p_decimals));
|
||||
};
|
||||
|
||||
Vector3 low_pass(const Vector3 &p_vector, const Vector3 &p_last_vector, float p_factor) {
|
||||
Vector3 low_pass(const Vector3 &p_vector, const Vector3 &p_last_vector, const float p_factor) {
|
||||
return p_vector + (p_factor * (p_last_vector - p_vector));
|
||||
};
|
||||
|
||||
Vector3 scrub(const Vector3 &p_vector, const Vector3 &p_last_vector, float p_decimals, float p_factor) {
|
||||
Vector3 scrub(const Vector3 &p_vector, const Vector3 &p_last_vector, const float p_decimals, const float p_factor) {
|
||||
return low_pass(floor_decimals(p_vector, p_decimals), p_last_vector, p_factor);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user