From 5cca51e32999a882e2a5f00cb45ecafc824ffd86 Mon Sep 17 00:00:00 2001
From: Sven Göthel <sgothel@jausoft.com>
Date: Fri, 19 Jan 2024 06:11:46 +0100
Subject: Frustum: Revise code and its Plane definition to support
 Cube->Frustum as well as to extract planes for float[] vec4-shader uniforms.

commit 1040bed4ecc6f4598ea459f1073a9240583fc3c3 added AABBox -> Cube -> Frustum mapping (incomplete)
and requires Frustum.Plane.set(..) by normal and point-on-plane for distance.

Frustum.isOutside(Cube) has been added, testing all its 8-points similar to AABBox.

Further all 6 Frustum.Plane shall be extracted to Vec4f and float[],
the latter to pass the whole float[4*6] as a vec4[6] uniform array to the shader.

+++

Constructor, setter and getter have been adjusted accordingly.

Most of the loops have been unrolled.

+++

Method names to query Frustum, i.e. 'is*Outside(<Type>)'
have been reduced to 'isOutside(<Type>)'
where <Type> uniquely indenticates the purpose.
Hence only 'isSphereOutside()' is left over.
---
 src/jogl/classes/com/jogamp/math/util/PMVMatrix4f.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'src/jogl/classes/com/jogamp/math/util/PMVMatrix4f.java')

diff --git a/src/jogl/classes/com/jogamp/math/util/PMVMatrix4f.java b/src/jogl/classes/com/jogamp/math/util/PMVMatrix4f.java
index ec9876b24..7d02904be 100644
--- a/src/jogl/classes/com/jogamp/math/util/PMVMatrix4f.java
+++ b/src/jogl/classes/com/jogamp/math/util/PMVMatrix4f.java
@@ -1259,8 +1259,7 @@ public class PMVMatrix4f {
             if( null == frustum ) {
                 frustum = new Frustum();
             }
-            final Matrix4f mPMv = getPMv();
-            frustum.updateFrustumPlanes(mPMv);
+            getPMv().updateFrustumPlanes(frustum);
             dirtyBits &= ~FRUSTUM;
         }
         return frustum;
-- 
cgit v1.2.3