diff --git a/Source/Engine/Core/Collections/Dictionary.h b/Source/Engine/Core/Collections/Dictionary.h index 941ef88d5..6e2d0e85d 100644 --- a/Source/Engine/Core/Collections/Dictionary.h +++ b/Source/Engine/Core/Collections/Dictionary.h @@ -544,14 +544,15 @@ public: /// Ensures that collection has given capacity. /// /// The minimum required capacity. - void EnsureCapacity(int32 minCapacity) + /// True if preserve collection data when changing its size, otherwise collection after resize will be empty. + void EnsureCapacity(int32 minCapacity, bool preserveContents = true) { if (_size >= minCapacity) return; if (minCapacity < DICTIONARY_DEFAULT_CAPACITY) minCapacity = DICTIONARY_DEFAULT_CAPACITY; const int32 capacity = _allocation.CalculateCapacityGrow(_size, minCapacity); - SetCapacity(capacity); + SetCapacity(capacity, preserveContents); } /// diff --git a/Source/Engine/Core/Math/CollisionsHelper.cpp b/Source/Engine/Core/Math/CollisionsHelper.cpp index b966523ec..f778fa4ec 100644 --- a/Source/Engine/Core/Math/CollisionsHelper.cpp +++ b/Source/Engine/Core/Math/CollisionsHelper.cpp @@ -1124,7 +1124,6 @@ bool CollisionsHelper::BoxIntersectsSphere(const BoundingBox& box, const Boundin Vector3 vector; Vector3::Clamp(sphere.Center, box.Minimum, box.Maximum, vector); const float distance = Vector3::DistanceSquared(sphere.Center, vector); - return distance <= sphere.Radius * sphere.Radius; } diff --git a/Source/Engine/Core/Math/Vector3.cpp b/Source/Engine/Core/Math/Vector3.cpp index 17d45a0a2..83faa28a3 100644 --- a/Source/Engine/Core/Math/Vector3.cpp +++ b/Source/Engine/Core/Math/Vector3.cpp @@ -131,23 +131,6 @@ Vector3 Vector3::Frac(const Vector3& v) ); } -Vector3 Vector3::Clamp(const Vector3& value, const Vector3& min, const Vector3& max) -{ - float x = value.X; - x = x > max.X ? max.X : x; - x = x < min.X ? min.X : x; - - float y = value.Y; - y = y > max.Y ? max.Y : y; - y = y < min.Y ? min.Y : y; - - float z = value.Z; - z = z > max.Z ? max.Z : z; - z = z < min.Z ? min.Z : z; - - return Vector3(x, y, z); -} - void Vector3::Hermite(const Vector3& value1, const Vector3& tangent1, const Vector3& value2, const Vector3& tangent2, float amount, Vector3& result) { const float squared = amount * amount; diff --git a/Source/Engine/Core/Math/Vector3.h b/Source/Engine/Core/Math/Vector3.h index bc994cb18..99ca7702d 100644 --- a/Source/Engine/Core/Math/Vector3.h +++ b/Source/Engine/Core/Math/Vector3.h @@ -593,7 +593,10 @@ public: // @param min The minimum value, // @param max The maximum value // @returns Clamped value - static Vector3 Clamp(const Vector3& value, const Vector3& min, const Vector3& max); + static Vector3 Clamp(const Vector3& value, const Vector3& min, const Vector3& max) + { + return Vector3(Math::Clamp(value.X, min.X, max.X), Math::Clamp(value.Y, min.Y, max.Y), Math::Clamp(value.Z, min.Z, max.Z)); + } // Restricts a value to be within a specified range // @param value The value to clamp diff --git a/Source/Engine/Level/Actor.h b/Source/Engine/Level/Actor.h index b31654c72..474694e99 100644 --- a/Source/Engine/Level/Actor.h +++ b/Source/Engine/Level/Actor.h @@ -640,7 +640,7 @@ public: public: /// - /// Draws this actor. Called by Scene Rendering service. This call is more optimized than generic Draw (eg. models are rendered during all passed but other actors are invoked only during GBufferFill pass). + /// Draws this actor. Called by Scene Rendering service. This call is more optimized than generic Draw (eg. geometry is rendered during all pass types but other actors are drawn only during GBufferFill pass). /// /// The rendering context. virtual void Draw(RenderContext& renderContext); diff --git a/Source/Engine/Level/Actors/SplineModel.cpp b/Source/Engine/Level/Actors/SplineModel.cpp index 6794ccbb2..5160c993c 100644 --- a/Source/Engine/Level/Actors/SplineModel.cpp +++ b/Source/Engine/Level/Actors/SplineModel.cpp @@ -258,7 +258,7 @@ void SplineModel::UpdateDeformationBuffer() AnimationUtils::GetTangent(end.Value, end.TangentIn, length, rightTangent); for (int32 chunk = 0; chunk < chunksPerSegment; chunk++) { - const float alpha = (chunk == chunksPerSegment - 1)? 1.0f : ((float)chunk * chunksPerSegmentInv); + const float alpha = (chunk == chunksPerSegment - 1) ? 1.0f : ((float)chunk * chunksPerSegmentInv); // Evaluate transformation at the curve AnimationUtils::Bezier(start.Value, leftTangent, rightTangent, end.Value, alpha, transform);