diff options
author | Sven Gothel <[email protected]> | 2023-04-07 08:46:18 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-07 08:46:18 +0200 |
commit | 84a6d63205ec49ddfb36b57fe2888425ecda3a5a (patch) | |
tree | 354cec2ac14a8932a01122c5234926e774ef874e /src/jogl/classes/com/jogamp/graph | |
parent | 10b60e10ece3cbc3e0b8a68ac73229371530e0ba (diff) |
PMVMatrix rewrite using Matrix4f, providing SyncMatrix4f* for GLUniformData; Utilize Vec3f, Recti, .. throughout API (Matrix4f, AABBox, .. Graph*)
Big Easter Cleanup
- Net -214 lines of code, despite new classes.
- GLUniformData buffer can be synced w/ underlying data via SyncAction/SyncBuffer, e.g. SyncMatrix4f + SyncMatrices4f
- PMVMatrix rewrite using Matrix4f and providing SyncMatrix4f/Matrices4f to sync w/ GLUniformData
- Additional SyncMatrix4f16 + SyncMatrices4f16 covering Matrix4f sync w/ GLUniformData w/o PMVMatrix
- Utilize Vec3f, Recti, .. throughout API (Matrix4f, AABBox, .. Graph*)
- Moved FloatUtil -> Matrix4f, kept a few basic matrix ops for ProjectFloat
- Most, if not all, float[] and int[] should have been moved to proper classes
- int[] -> Recti for viewport rectangle
- Matrix4f and PMVMatrix is covered by math unit tests (as was FloatUtil before) -> save
Passed all unit tests on AMD64 GNU/Linux
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java | 22 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java | 2 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java index a9fca4c72..4863e97d6 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -35,6 +35,7 @@ import com.jogamp.opengl.GL2ES2; import com.jogamp.opengl.GLES2; import com.jogamp.opengl.GLException; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.math.Recti; import jogamp.graph.curve.opengl.shader.AttributeNames; import jogamp.graph.curve.opengl.shader.UniformNames; @@ -192,25 +193,25 @@ public final class RegionRenderer { private final GLCallback enableCallback; private final GLCallback disableCallback; - private final int[] viewport = new int[] { 0, 0, 0, 0 }; + private final Recti viewport = new Recti(); private boolean initialized; private boolean vboSupported = false; public final boolean isInitialized() { return initialized; } - /** Copies the current int[4] viewport in given target and returns it for chaining. */ - public final int[/*4*/] getViewport(final int[/*4*/] target) { - System.arraycopy(viewport, 0, target, 0, 4); + /** Copies the current Rect4i viewport in given target and returns it for chaining. */ + public final Recti getViewport(final Recti target) { + target.set(viewport); return target; } - /** Borrows the current int[4] viewport w/o copying. */ - public final int[/*4*/] getViewport() { + /** Borrows the current Rect4i viewport w/o copying. */ + public final Recti getViewport() { return viewport; } /** Return width of current viewport */ - public final int getWidth() { return viewport[2]; } + public final int getWidth() { return viewport.width(); } /** Return height of current viewport */ - public final int getHeight() { return viewport[3]; } + public final int getHeight() { return viewport.height(); } /** Borrow the current {@link PMVMatrix}. */ public final PMVMatrix getMatrix() { return rs.getMatrix(); } @@ -342,10 +343,7 @@ public final class RegionRenderer { * No PMVMatrix operation is performed here. */ public final void reshapeNotify(final int x, final int y, final int width, final int height) { - viewport[0] = x; - viewport[1] = y; - viewport[2] = width; - viewport[3] = height; + viewport.set(x, y, width, height); } public final void reshapePerspective(final float angle, final int width, final int height, final float near, final float far) { diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java index aafd71d64..2f518d1cc 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java @@ -139,7 +139,7 @@ public class RenderState { public final boolean update(final GL2ES2 gl, final RenderState rs, final boolean updateLocation, final int renderModes, final boolean pass1, final boolean throwOnError) { if( rs.id() != rsId ) { // Assignment of Renderstate buffers to uniforms (no copy, direct reference) - gcu_PMVMatrix01.setData(rs.pmvMatrix.glGetPMvMatrixf()); + gcu_PMVMatrix01.setData(rs.pmvMatrix.getSyncPMvMat()); gcu_Weight.setData(rs.weightBuffer); gcu_ColorStatic.setData(rs.colorStaticBuffer); rsId = rs.id(); |