diff options
author | Sven Göthel <[email protected]> | 2024-02-13 22:17:06 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-02-13 22:17:06 +0100 |
commit | 65b3a230a53252f7c2cacd968b7afee6d43e7327 (patch) | |
tree | e4c75afce67f151fbb2dc8d3fa4854b741f44e11 /src/jogl/classes | |
parent | e6dd773b249cbeb117a710a46133fa42f748f1d7 (diff) |
Graph RenderState/RegionRenderer: Rename isHintMaskSet()->hintBitsSet(), setHintMask()->setHintBits(), clearHintMask()->clearHintBits()
Diffstat (limited to 'src/jogl/classes')
5 files changed, 32 insertions, 31 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 87e1c4385..38f4d0dbf 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -104,14 +104,14 @@ public final class RegionRenderer { public static final GLCallback defaultBlendEnable = new GLCallback() { @Override public void run(final GL gl, final RegionRenderer renderer) { - if( renderer.isHintMaskSet(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) { + if( renderer.hintBitsSet(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) { gl.glDepthMask(false); // gl.glDisable(GL.GL_DEPTH_TEST); // gl.glDepthFunc(GL.GL_ALWAYS); } gl.glEnable(GL.GL_BLEND); gl.glBlendEquation(GL.GL_FUNC_ADD); // default - renderer.setHintMask(RenderState.BITHINT_BLENDING_ENABLED); + renderer.setHintBits(RenderState.BITHINT_BLENDING_ENABLED); } }; @@ -128,9 +128,9 @@ public final class RegionRenderer { public static final GLCallback defaultBlendDisable = new GLCallback() { @Override public void run(final GL gl, final RegionRenderer renderer) { - renderer.clearHintMask(RenderState.BITHINT_BLENDING_ENABLED); + renderer.clearHintBits(RenderState.BITHINT_BLENDING_ENABLED); gl.glDisable(GL.GL_BLEND); - if( renderer.isHintMaskSet(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) { + if( renderer.hintBitsSet(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) { // gl.glEnable(GL.GL_DEPTH_TEST); // gl.glDepthFunc(GL.GL_LESS); gl.glDepthMask(true); @@ -336,11 +336,11 @@ public final class RegionRenderer { /** Returns the optional Mv-premultiplied clipping {@link Frustum} or null if unused. */ public final Frustum getClipFrustum() { return rs.getClipFrustum(); } - public final boolean isHintMaskSet(final int mask) { return rs.isHintMaskSet(mask); } + public final boolean hintBitsSet(final int mask) { return rs.hintBitsSet(mask); } - public final void setHintMask(final int mask) { rs.setHintMask(mask); } + public final void setHintBits(final int mask) { rs.setHintBits(mask); } - public final void clearHintMask(final int mask) { rs.clearHintMask(mask); } + public final void clearHintBits(final int mask) { rs.clearHintBits(mask); } /** * Enabling or disabling the {@link #getRenderState() RenderState}'s 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 d6be9e07b..4913d8174 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java @@ -54,10 +54,10 @@ public class RenderState { private static final String thisKey = "jogamp.graph.curve.RenderState" ; /** - * Bitfield hint, {@link #isHintMaskSet(int) if set} + * Bitfield hint, {@link #hintBitsSet(int) if set} * stating <i>enabled</i> {@link GL#GL_BLEND}, otherwise <i>disabled</i>. * <p> - * Shall be set via {@link #setHintMask(int)} and cleared via {@link #clearHintMask(int)}. + * Shall be set via {@link #setHintBits(int)} and cleared via {@link #clearHintBits(int)}. * </p> * <p> * If set, {@link GLRegion#draw(GL2ES2, RegionRenderer) GLRegion's draw-method} @@ -73,10 +73,10 @@ public class RenderState { public static final int BITHINT_BLENDING_ENABLED = 1 << 0 ; /** - * Bitfield hint, {@link #isHintMaskSet(int) if set} + * Bitfield hint, {@link #hintBitsSet(int) if set} * stating globally <i>enabled</i> {@link GL#GL_DEPTH_TEST}, otherwise <i>disabled</i>. * <p> - * Shall be set via {@link #setHintMask(int)} and cleared via {@link #clearHintMask(int)}. + * Shall be set via {@link #setHintBits(int)} and cleared via {@link #clearHintBits(int)}. * </p> * <p> * {@link GLRegion#draw(GL2ES2, RegionRenderer) GLRegion's draw-method} @@ -105,7 +105,7 @@ public class RenderState { /** Optional clipping {@link Frustum}, which shall be pre-multiplied with the Mv-matrix. Null if unused. */ private final Frustum clipFrustum; private boolean useClipFrustum; - private int hintBitfield; + private int hintBits; private ShaderProgram sp; private static synchronized int getNextID() { @@ -209,7 +209,7 @@ public class RenderState { this.clipFrustum = new Frustum(); this.useClipFrustum = false; - this.hintBitfield = 0; + this.hintBits = 0; this.sp = null; } @@ -296,6 +296,17 @@ public class RenderState { /** Returns the optional Mv-premultiplied clipping {@link Frustum} or null if unused. */ public final Frustum getClipFrustum() { return useClipFrustum ? this.clipFrustum : null; } + public final int getHintBits() { return this.hintBits; } + public final boolean hintBitsSet(final int mask) { + return mask == ( hintBits & mask ); + } + public final void setHintBits(final int mask) { + hintBits |= mask; + } + public final void clearHintBits(final int mask) { + hintBits &= ~mask; + } + /** * * @param gl @@ -362,17 +373,6 @@ public class RenderState { } } - - public final boolean isHintMaskSet(final int mask) { - return mask == ( hintBitfield & mask ); - } - public final void setHintMask(final int mask) { - hintBitfield |= mask; - } - public final void clearHintMask(final int mask) { - hintBitfield &= ~mask; - } - /** * Only nullifies {@link ShaderProgram} reference owned by {@link RegionRenderer}. */ diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java index 4644ff883..8f0d0de73 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java @@ -379,7 +379,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion { private void renderFBO(final GL2ES2 gl, final RenderState rs, final int width, final int height) { gl.glViewport(0, 0, width, height); - if( rs.isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED | RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) { + if( rs.hintBitsSet(RenderState.BITHINT_BLENDING_ENABLED | RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) { // BITHINT_GLOBAL_DEPTH_TEST_ENABLED path added by commit 45395696c252c215a8a22d05e5da7e98c662d07e (2014-04-10), // but not in VBORegion2PVBAA.renderVBO(..) -> investigate if required for working MSAA: // - "VBORegion2PMSAAES2 enables/disables GL_DEPTH_TEST, otherwise MSAA is corrupt" @@ -388,7 +388,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion { gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); gl.glEnable(GL.GL_DEPTH_TEST); - } else if( rs.isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) { + } else if( rs.hintBitsSet(RenderState.BITHINT_BLENDING_ENABLED) ) { // RGB is already multiplied w/ alpha via renderRegion2FBO(..) gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); } @@ -424,7 +424,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion { if( 0 >= targetFboWidth || 0 >= targetFboHeight ) { throw new IllegalArgumentException("targetFBOSize "+targetFboWidth+"x"+targetFboHeight+" must be greater than 0"); } - final boolean blendingEnabled = rs.isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED); + final boolean blendingEnabled = rs.hintBitsSet(RenderState.BITHINT_BLENDING_ENABLED); final int targetFboSamples = rs.getSampleCount() > 1 ? rs.getSampleCount() : 0; final boolean fboSampleTypeMatch; { @@ -490,7 +490,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion { // Multiply RGB w/ Alpha, preserve alpha for renderFBO(..) gl.glBlendFuncSeparate(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA, GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); - if( rs.isHintMaskSet(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) { + if( rs.hintBitsSet(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) { gl.glDisable(GL.GL_DEPTH_TEST); } } else { diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java index 333150899..c03e4d50d 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java @@ -426,7 +426,7 @@ public final class VBORegion2PVBAAES2 extends GLRegion { // but not here -> investigate if required for working MSAA: // - "VBORegion2PMSAAES2 enables/disables GL_DEPTH_TEST, otherwise MSAA is corrupt" // - if( rs.isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) { + if( rs.hintBitsSet(RenderState.BITHINT_BLENDING_ENABLED) ) { // RGB is already multiplied w/ alpha via renderRegion2FBO(..) gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); } @@ -463,7 +463,7 @@ public final class VBORegion2PVBAAES2 extends GLRegion { if( 0 >= targetFboWidth || 0 >= targetFboHeight ) { throw new IllegalArgumentException("targetFBOSize "+targetFboWidth+"x"+targetFboHeight+" must be greater than 0"); } - final boolean blendingEnabled = rs.isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED); + final boolean blendingEnabled = rs.hintBitsSet(RenderState.BITHINT_BLENDING_ENABLED); if(null == fbo) { fboWidth = targetFboWidth; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java index 478931531..7fcd61292 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -187,7 +187,8 @@ public final class VBORegionSPES2 extends GLRegion { vpc_ileave.enableBuffer(gl, true); indicesBuffer.bindBuffer(gl, true); // keeps VBO binding - if( renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) { + final RenderState rs = renderer.getRenderState(); + if( rs.hintBitsSet(RenderState.BITHINT_BLENDING_ENABLED) ) { gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); } |