Fix BoundingFrustum::GetPlane in C++ to match C# version (and doc comment)

This commit is contained in:
Wojtek Figat
2025-10-02 18:48:32 +02:00
parent 7e1ac5e167
commit 9b812ec34a
3 changed files with 13 additions and 6 deletions

View File

@@ -63,9 +63,16 @@ void BoundingFrustum::SetMatrix(const Matrix& matrix)
Plane BoundingFrustum::GetPlane(int32 index) const
{
if (index > 5)
return Plane();
return _planes[index];
switch (index)
{
case 0: return _pLeft;
case 1: return _pRight;
case 2: return _pTop;
case 3: return _pBottom;
case 4: return _pNear;
case 5: return _pFar;
default: return Plane();
}
}
static Vector3 Get3PlanesInterPoint(const Plane& p1, const Plane& p2, const Plane& p3)

View File

@@ -182,7 +182,7 @@ namespace FlaxEngine
/// <summary>
/// Returns one of the 6 planes related to this frustum.
/// </summary>
/// <param name="index">Plane index where 0 fro Left, 1 for Right, 2 for Top, 3 for Bottom, 4 for Near, 5 for Far</param>
/// <param name="index">Plane index where 0 for Left, 1 for Right, 2 for Top, 3 for Bottom, 4 for Near, 5 for Far</param>
/// <returns>The frustum plane.</returns>
public Plane GetPlane(int index)
{

View File

@@ -148,13 +148,13 @@ public:
Plane GetPlane(int32 index) const;
/// <summary>
/// Gets the the 8 corners of the frustum: Near1 (near right down corner), Near2 (near right top corner), Near3 (near Left top corner), Near4 (near Left down corner), Far1 (far right down corner), Far2 (far right top corner), Far3 (far left top corner), Far4 (far left down corner).
/// Gets the 8 corners of the frustum: Near1 (near right down corner), Near2 (near right top corner), Near3 (near Left top corner), Near4 (near Left down corner), Far1 (far right down corner), Far2 (far right top corner), Far3 (far left top corner), Far4 (far left down corner).
/// </summary>
/// <param name="corners">The corners.</param>
void GetCorners(Float3 corners[8]) const;
/// <summary>
/// Gets the the 8 corners of the frustum: Near1 (near right down corner), Near2 (near right top corner), Near3 (near Left top corner), Near4 (near Left down corner), Far1 (far right down corner), Far2 (far right top corner), Far3 (far left top corner), Far4 (far left down corner).
/// Gets the 8 corners of the frustum: Near1 (near right down corner), Near2 (near right top corner), Near3 (near Left top corner), Near4 (near Left down corner), Far1 (far right down corner), Far2 (far right top corner), Far3 (far left top corner), Far4 (far left down corner).
/// </summary>
/// <param name="corners">The corners.</param>
void GetCorners(Double3 corners[8]) const;