From 003eb8ca1f296f287dc3d224fa19781705e10dd9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 8 Apr 2023 20:23:09 +0200 Subject: PMVMatrix: Expose temporary storage (w/o side-effects) for efficiency; GraphUI.Shape: Efficiently reuse matPMv and temporary PMVMatrix storage Reuse PMv in Shape.getSurfaceSize() and Shape.winToShapeCoord(), for the latter we invert the reused PMv for mapWinToObj (i.e. UnProject). --- .../classes/com/jogamp/opengl/util/PMVMatrix.java | 43 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'src/jogl') diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java index 6c0a6c351..0cba41f65 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java @@ -271,8 +271,49 @@ public final class PMVMatrix implements GLMatrixFunc { } // - // Matrix4f access as well as their SyncedBuffer counterpart SyncedMatrix and SyncedMatrices + // Temporary storage access for efficiency // + + /** + * Return the first temporary Matrix4f exposed to be reused for efficiency. + *

+ * Temporary storage is only used by this class within single method calls, + * hence has no side-effects. + *

+ */ + public final Matrix4f getTmp1Mat() { return mat4Tmp1; } + + /** + * Return the second temporary Matrix4f exposed to be reused for efficiency. + *

+ * Temporary storage is only used by this class within single method calls, + * hence has no side-effects. + *

+ */ + public final Matrix4f getTmp2Mat() { return mat4Tmp2; } + + /** + * Return the first temporary Vec3f exposed to be reused for efficiency. + *

+ * Temporary storage is only used by this class within single method calls, + * hence has no side-effects. + *

+ */ + public final Vec3f getTmp1Vec3f() { return vec3Tmp1; } + + /** + * Return the first temporary Vec4f exposed to be reused for efficiency. + *

+ * Temporary storage is only used by this class within single method calls, + * hence has no side-effects. + *

+ */ + public final Vec4f getTmp1Vec4f() { return vec4Tmp1; } + + // + // Regular Matrix4f access as well as their SyncedBuffer counterpart SyncedMatrix and SyncedMatrices + // + /** * Returns the {@link GLMatrixFunc#GL_TEXTURE_MATRIX texture matrix} (T). *

-- cgit v1.2.3