aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-09 03:02:57 +0100
committerSven Göthel <[email protected]>2024-01-09 03:02:57 +0100
commitf836fbd9201034010ecbf591348433f23920f527 (patch)
treeb241a857c3d7d20d9840c953b19d49a194d79bd9 /src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
parentc87e89959e40ee8411cccc16fe0a5708f54a6c9f (diff)
Graph Clipping: GLSL: Add `USE_AABBOX_CLIPPING`, i.e. clipping via AABBox min/max vec3 as convenient using Graph/GraphUI produced AABBox
USE_AABBOX_CLIPPING - Conditional compilation w/ macro 'USE_AABBOX_CLIPPING' - gcv_ClipBBoxCoord smooth varying setup in vertex shader - fragment shader clips via branch if( is_inside(gcv_ClipBBoxCoord, gcu_ClipBBox[0], gcu_ClipBBox[1]) < 0.5 ) { CLIP } - clipping via discard or alpha=0 in case of buggy-discard. Other optimization: - Drop gcv_ColorTexExt, fragment-shader uses gcu_ColorTexBBox[2] directly (flat) - Simplified gcv_ColorTexCoord smooth varying equation in vertex shader.
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp10
1 files changed, 6 insertions, 4 deletions
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;