aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-09 03:37:00 +0100
committerSven Göthel <[email protected]>2024-01-09 03:37:00 +0100
commit335dd0a493fff1435cad1cd22e4ac5a20d7df03a (patch)
treea848055c1f3bc6f8d9ab630816a3e3e0c0f6149a /src/jogl
parentbb11c498b7d4fe269e7273a1b164e46f3c7a3b50 (diff)
Graph Clipping: Add missing Modelview-Matrix (Mv) Multiplication / Consideration
- GLSL vertex shader sets smooth varying 'gcv_ClipBBoxCoord' w/ Mv multiplied vertex-coord - RegionRenderer.setClipBBox(AABBox) expects a pre-multiplied Mv AABBox covering an independent area, not per Shape/Region. - This works as expected with moving/scaling of each Shape/Region etc
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java3
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp2
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp2
4 files changed, 7 insertions, 2 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 06c10586c..c43dc7913 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -303,7 +303,9 @@ public final class RegionRenderer {
public final void setColorStatic(final float r, final float g, final float b, final float a){ rs.setColorStatic(r, g, b, a); }
+ /** Set the optional clipping {@link AABBox}, which shall be pre-multiplied with the Mv-matrix or null to disable. */
public final void setClipBBox(final AABBox clipBBox) { rs.setClipBBox(clipBBox); }
+ /** Returns the optional Mv-premultiplied clipping {@link AABBox} or null if unused. */
public final AABBox getClipBBox() { return rs.getClipBBox(); }
public final boolean isHintMaskSet(final int mask) { return rs.isHintMaskSet(mask); }
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 32483c1fc..ed4bc2585 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
@@ -98,6 +98,7 @@ public class RenderState {
private final FloatBuffer weightBuffer;
private final float[] colorStatic;
private final FloatBuffer colorStaticBuffer;
+ /** Optional clipping {@link AABBox}, which shall be pre-multiplied with the Mv-matrix. Null if unused. */
private AABBox clipBBox;
private int hintBitfield;
private ShaderProgram sp;
@@ -262,7 +263,9 @@ public class RenderState {
colorStatic[3] = a;
}
+ /** Set the optional clipping {@link AABBox}, which shall be pre-multiplied with the Mv-matrix or null to disable. */
public final void setClipBBox(final AABBox clipBBox) { this.clipBBox = clipBBox; }
+ /** Returns the optional Mv-premultiplied clipping {@link AABBox} or null if unused. */
public final AABBox getClipBBox() { return this.clipBBox; }
/**
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp
index 6956529f7..b9974b97d 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp
@@ -24,7 +24,7 @@ void main(void)
}
#endif
#ifdef USE_AABBOX_CLIPPING
- gcv_ClipBBoxCoord = gca_Vertices.xyz;
+ gcv_ClipBBoxCoord = (gcu_PMVMatrix02[1] * gca_Vertices).xyz; // Mv
#endif
#ifdef USE_COLOR_TEXTURE
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
index aebf8c147..9518834b0 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
@@ -24,7 +24,7 @@ void main(void)
}
#endif
#ifdef USE_AABBOX_CLIPPING
- gcv_ClipBBoxCoord = gca_Vertices.xyz;
+ gcv_ClipBBoxCoord = (gcu_PMVMatrix01[1] * gca_Vertices).xyz; // Mv
#endif
#ifdef USE_COLOR_TEXTURE