aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java1
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl1
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.glsl21
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_weight.glsl10
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp8
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp10
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl4
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl14
8 files changed, 50 insertions, 19 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
index 7244851ff..4a66295f2 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
@@ -6,6 +6,7 @@ public class UniformNames {
public static final String gcu_Weight = "gcu_Weight";
public static final String gcu_ColorTexUnit = "gcu_ColorTexUnit";
public static final String gcu_ColorTexBBox = "gcu_ColorTexBBox";
+ public static final String gcu_ClipBBox = "gcu_ClipBBox";
public static final String gcu_PMVMatrix02 = "gcu_PMVMatrix02"; // gcu_PMVMatrix[3]; // P, Mv, and Mvi
public static final String gcu_FboTexUnit = "gcu_FboTexUnit";
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl
index b8c68a924..6fc3b4201 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl
@@ -1,3 +1,4 @@
+// Copyright 2010-2024 JogAmp Community. All rights reserved.
#ifndef attributes_glsl
#define attributes_glsl
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.glsl
index 6ff35df85..c5850f5fa 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.glsl
@@ -1,14 +1,23 @@
- // Copyright 2010-2023 JogAmp Community. All rights reserved.
-
+// Copyright 2010-2024 JogAmp Community. All rights reserved.
+
+#ifdef USE_AABBOX_CLIPPING
+ if( is_inside(gcv_ClipBBoxCoord, gcu_ClipBBox[0], gcu_ClipBBox[1]) < 0.5 ) {
+ #if USE_DISCARD
+ discard; // discard freezes NV tegra2 compiler
+ #else
+ mgl_FragColor = vec4(0);
+ #endif
+ } else
+#endif
if( gcv_CurveParam.x == 0.0 && gcv_CurveParam.y == 0.0 ) {
// pass-1: Lines
#if defined(USE_COLOR_TEXTURE) && defined(USE_COLOR_CHANNEL)
- vec4 t = clip_coord(gcuTexture2D(gcu_ColorTexUnit, gcv_ColorTexCoord.st), vec4(1), gcv_ColorTexCoord, vec2(0), gcv_ColorTexExt);
+ vec4 t = clip_coord(gcuTexture2D(gcu_ColorTexUnit, gcv_ColorTexCoord.st), vec4(1), gcv_ColorTexCoord, vec2(0), gcu_ColorTexBBox[2]);
mgl_FragColor = vec4( mix( t.rgb * gcu_ColorStatic.rgb, gcv_Color.rgb, gcv_Color.a ),
mix( t.a * gcu_ColorStatic.a, 1, gcv_Color.a) );
#elif defined(USE_COLOR_TEXTURE)
- mgl_FragColor = clip_coord(gcuTexture2D(gcu_ColorTexUnit, gcv_ColorTexCoord.st), vec4(1), gcv_ColorTexCoord, vec2(0), gcv_ColorTexExt)
+ mgl_FragColor = clip_coord(gcuTexture2D(gcu_ColorTexUnit, gcv_ColorTexCoord.st), vec4(1), gcv_ColorTexCoord, vec2(0), gcu_ColorTexBBox[2])
* gcu_ColorStatic;
#elif defined(USE_COLOR_CHANNEL)
mgl_FragColor = gcv_Color * gcu_ColorStatic;
@@ -27,12 +36,12 @@
float a = clamp(0.5 - ( position/length(f) ) * sign(gcv_CurveParam.y), 0.0, 1.0);
#if defined(USE_COLOR_TEXTURE) && defined(USE_COLOR_CHANNEL)
- vec4 t = clip_coord(gcuTexture2D(gcu_ColorTexUnit, gcv_ColorTexCoord.st), vec4(1), gcv_ColorTexCoord, vec2(0), gcv_ColorTexExt);
+ vec4 t = clip_coord(gcuTexture2D(gcu_ColorTexUnit, gcv_ColorTexCoord.st), vec4(1), gcv_ColorTexCoord, vec2(0), gcu_ColorTexBBox[2]);
mgl_FragColor = vec4( mix( t.rgb * gcu_ColorStatic.rgb, gcv_Color.rgb, gcv_Color.a ),
a * mix( t.a * gcu_ColorStatic.a, 1, gcv_Color.a) );
#elif defined(USE_COLOR_TEXTURE)
- vec4 t = clip_coord(gcuTexture2D(gcu_ColorTexUnit, gcv_ColorTexCoord.st), vec4(1), gcv_ColorTexCoord, vec2(0), gcv_ColorTexExt);
+ vec4 t = clip_coord(gcuTexture2D(gcu_ColorTexUnit, gcv_ColorTexCoord.st), vec4(1), gcv_ColorTexCoord, vec2(0), gcu_ColorTexBBox[2]);
mgl_FragColor = vec4(t.rgb * gcu_ColorStatic.rgb, t.a * gcu_ColorStatic.a * a);
#elif defined(USE_COLOR_CHANNEL)
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_weight.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_weight.glsl
index 1620a9532..e7172d834 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_weight.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_weight.glsl
@@ -1,4 +1,14 @@
+// Copyright 2010-2024 JogAmp Community. All rights reserved.
+#ifdef USE_AABBOX_CLIPPING
+ if( is_inside(gcv_ClipBBoxCoord, gcu_ClipBBox[0], gcu_ClipBBox[1]) < 0.5 ) {
+ #if USE_DISCARD
+ discard; // discard freezes NV tegra2 compiler
+ #else
+ mgl_FragColor = vec4(0);
+ #endif
+ } else
+#endif
if( gcv_CurveParam.x == 0.0 && gcv_CurveParam.y == 0.0 ) {
// pass-1: Lines
#ifdef USE_COLOR_CHANNEL
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 de41d9198..6956529f7 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
@@ -23,10 +23,12 @@ void main(void)
gcv_CurveParam = gca_CurveParams;
}
#endif
+#ifdef USE_AABBOX_CLIPPING
+ gcv_ClipBBoxCoord = gca_Vertices.xyz;
+#endif
+
#ifdef USE_COLOR_TEXTURE
- vec2 dim = vec2(gcu_ColorTexBBox[1].x - gcu_ColorTexBBox[0].x, gcu_ColorTexBBox[1].y - gcu_ColorTexBBox[0].y);
- gcv_ColorTexCoord = vec2(gca_Vertices.x - gcu_ColorTexBBox[0].x, gca_Vertices.y - gcu_ColorTexBBox[0].y) / dim;
- gcv_ColorTexExt = gcu_ColorTexBBox[2]; // texture-size
+ gcv_ColorTexCoord = ( gca_Vertices.xy - gcu_ColorTexBBox[0] ) / ( gcu_ColorTexBBox[1] - gcu_ColorTexBBox[0] );
#endif
#ifdef USE_COLOR_CHANNEL
gcv_Color = gca_Colors;
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 919b526df..aebf8c147 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
@@ -1,4 +1,4 @@
-//Copyright 2010 JogAmp Community. All rights reserved.
+// Copyright 2010-2024 JogAmp Community. All rights reserved.
#if __VERSION__ >= 130
#define attribute in
@@ -23,10 +23,12 @@ void main(void)
gcv_CurveParam = gca_CurveParams;
}
#endif
+#ifdef USE_AABBOX_CLIPPING
+ gcv_ClipBBoxCoord = gca_Vertices.xyz;
+#endif
+
#ifdef USE_COLOR_TEXTURE
- vec2 dim = vec2(gcu_ColorTexBBox[1].x - gcu_ColorTexBBox[0].x, gcu_ColorTexBBox[1].y - gcu_ColorTexBBox[0].y);
- gcv_ColorTexCoord = vec2(gca_Vertices.x - gcu_ColorTexBBox[0].x, gca_Vertices.y - gcu_ColorTexBBox[0].y) / dim;
- gcv_ColorTexExt = gcu_ColorTexBBox[2]; // texture-size
+ gcv_ColorTexCoord = ( gca_Vertices.xy - gcu_ColorTexBBox[0] ) / ( gcu_ColorTexBBox[1] - gcu_ColorTexBBox[0] );
#endif
#ifdef USE_COLOR_CHANNEL
gcv_Color = gca_Colors;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
index 956c31d4b..a9554528c 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
@@ -1,3 +1,4 @@
+// Copyright 2010-2024 JogAmp Community. All rights reserved.
#ifndef uniforms_glsl
#define uniforms_glsl
@@ -9,6 +10,9 @@ uniform float gcu_Weight;
#ifdef USE_COLOR_TEXTURE
uniform vec2 gcu_ColorTexBBox[3]; // box-min[2], box-max[2] and tex-size[2]
#endif
+#ifdef USE_AABBOX_CLIPPING
+ uniform vec3 gcu_ClipBBox[2]; // box-min[3], box-max[3]
+#endif
uniform mat4 gcu_PMVMatrix02[3]; // P, Mv, and Mvi
uniform sampler2D gcu_FboTexUnit;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
index a64b8ad4d..0e8d5b843 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
@@ -1,20 +1,22 @@
+// Copyright 2023-2024 JogAmp Community. All rights reserved.
#ifndef varyings_glsl
#define varyings_glsl
-varying vec3 gcv_CurveParam;
+varying vec3 gcv_CurveParam;
-varying vec2 gcv_FboTexCoord;
+varying vec2 gcv_FboTexCoord;
#ifdef USE_COLOR_TEXTURE
- varying vec2 gcv_ColorTexCoord;
- varying vec2 gcv_ColorTexExt;
+ varying vec2 gcv_ColorTexCoord;
#endif
+#ifdef USE_AABBOX_CLIPPING
+ varying vec3 gcv_ClipBBoxCoord;
+#endif
#ifdef USE_COLOR_CHANNEL
- varying vec4 gcv_Color;
+ varying vec4 gcv_Color;
#endif
-
#endif // varyings_glsl