Class Region

  • Direct Known Subclasses:
    GLRegion

    public abstract class Region
    extends Object
    Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
    See Also:
    GLRegion
    • Field Detail

      • DEBUG_ALL_EVENT

        public static final boolean DEBUG_ALL_EVENT
      • DEBUG_INSTANCE

        public static final boolean DEBUG_INSTANCE
      • DEBUG

        public static final boolean DEBUG
        Debug flag for [com.]jogamp.graph.curve.* incl. Region (graph.curve)
      • NORM_RENDERING_BIT

        public static final int NORM_RENDERING_BIT
        Rendering-Mode bit for Region

        One pass `norm` rendering either using no AA or underlying full-screen AA (fsaa).

        This mode-bit is a shader-key.

        See Also:
        Constant Field Values
      • MSAA_RENDERING_BIT

        public static final int MSAA_RENDERING_BIT
        Rendering-Mode bit for Region

        MSAA based Anti-Aliasing, a two pass region rendering, slower and more resource hungry (FBO with sample buffer), but providing fast MSAA in case the whole scene is not rendered with MSAA.

        In case sample count is 1, no FBO sample buffer is used but a simple bilinear texture filter.

        This mode-bit is a shader-key.

        See Also:
        Constant Field Values
      • VBAA_RENDERING_BIT

        public static final int VBAA_RENDERING_BIT
        Rendering-Mode bit for Region

        View based Anti-Aliasing, a two pass region rendering, slower and more resource hungry (FBO), but AA is perfect. Otherwise the default fast one pass MSAA region rendering is being used.

        In case sample count is 1, no FBO supersampling is performed but a simple bilinear texture filter used.

        Depending on AA-quality, MAX_AA_QUALITY denotes full 4x billinear filtering per sample and 0 denotes 1x flipquad filtering per sample.

        This mode-bit is a shader-key.

        See Also:
        Constant Field Values
      • VARWEIGHT_RENDERING_BIT

        public static final int VARWEIGHT_RENDERING_BIT
        Rendering-Mode bit for Region

        Use non uniform weights [0.0 .. 1.9] for curve region rendering. Otherwise the default weight 1.0 for uniform curve region rendering is being applied.

        This mode-bit is a shader-key.

        See Also:
        Constant Field Values
      • COLORCHANNEL_RENDERING_BIT

        public static final int COLORCHANNEL_RENDERING_BIT
        Rendering-Mode bit for Region to optionally enable a color-channel per vertex.

        If set, a color channel attribute per vertex is added to the stream via #addOutlineShape(OutlineShape, AffineTransform, float[]), otherwise static color can being used for a monotonic color.

        This mode-bit is a shader-key.

        See Also:
        getRenderModes(), hasColorChannel(), #addOutlineShape(OutlineShape, AffineTransform, float[]), com.jogamp.graph.curve.opengl.RegionRenderer#setColorStatic(com.jogamp.opengl.GL2ES2, float, float, float, float), Constant Field Values
      • DEFAULT_TWO_PASS_TEXTURE_UNIT

        public static final int DEFAULT_TWO_PASS_TEXTURE_UNIT
        See Also:
        Constant Field Values
    • Method Detail

      • isRenderModeSet

        public static final boolean isRenderModeSet​(int renderModes,
                                                    int mask)
      • setRenderMode

        public static final int setRenderMode​(int renderModes,
                                              int mask,
                                              boolean v)
      • isVBAA

        public static boolean isVBAA​(int renderModes)
        Returns true if given renderModes has VBAA_RENDERING_BIT set.
      • isMSAA

        public static boolean isMSAA​(int renderModes)
        Returns true if given renderModes has MSAA_RENDERING_BIT set.
      • isGraphAA

        public static boolean isGraphAA​(int renderModes)
        Returns true if given renderModes has any of AA_RENDERING_MASK set.
      • isTwoPass

        public static boolean isTwoPass​(int renderModes)
        Returns true if given renderModes has any of AA_RENDERING_MASK set.
      • hasVariableWeight

        public static boolean hasVariableWeight​(int renderModes)
        Returns true if render mode capable of variable weights, i.e. the bit VARWEIGHT_RENDERING_BIT is set, otherwise false.
      • hasColorChannel

        public static boolean hasColorChannel​(int renderModes)
        Returns true if render mode has a color channel, i.e. the bit COLORCHANNEL_RENDERING_BIT is set, otherwise false.
      • hasColorTexture

        public static boolean hasColorTexture​(int renderModes)
        Returns true if render mode has a color texture, i.e. the bit COLORTEXTURE_RENDERING_BIT is set, otherwise false.
      • getRenderModeString

        public static String getRenderModeString​(int renderModes)
        Returns a unique technical description string for renderModes as follows:
            (vbaa|msaa|norm)[-curve][-cols][-ctex]
         
        Parameters:
        renderModes - Graph renderModes, see create(..)
      • getRenderModeString

        public static String getRenderModeString​(int renderModes,
                                                 int graphAAQuality,
                                                 int graphSampleCount,
                                                 int fsaaSampleCount)
        Return a unique technical description string for renderModes and sample counts as follows:
            getRenderModeString(int)-q{AA-quality}-s{sampleCount}-fsaa{CapsNumSamples}
         
        Parameters:
        renderModes - the used Graph renderModes, see create(..)
        graphAAQuality - Graph AA quality, see DEFAULT_AA_QUALITY, set to negative value to mark undefined
        graphSampleCount - Graph sample count for VBAA_RENDERING_BIT or MSAA_RENDERING_BIT
        fsaaSampleCount - full-screen AA (fsaa) sample count, retrieved e.g. via GLCapabilitiesImmutable.getNumSamples()
      • printBufferStats

        public abstract void printBufferStats​(PrintStream out)
        Print implementation buffer stats like detailed and total size and capacity in bytes etc
      • usesI32Idx

        public final boolean usesI32Idx()
        Returns true if implementation uses `int32_t` sized indices implying at least a GLProfile.isGL2ES3() alike context. Otherwise method returns false on GLProfile.isGLES2() using `uint16_t` sized indices.
      • growBuffer

        public abstract boolean growBuffer​(int verticesCount,
                                           int indicesCount)
        Increase the renderer buffers if necessary to add given counts of vertices- and index elements.

        Buffers will not change if remaining free slots, capacity less position, satisfy count elements.

        Parameters:
        verticesCount - number of vertex elements to add if necessary
        indicesCount - number of index elements to add if necessary
        Returns:
        true if buffer size has changed, i.e. grown. Otherwise false.
        See Also:
        setBufferCapacity(int, int), countOutlineShape(OutlineShape, int[]), countOutlineShapes(List, int[])
      • setBufferCapacity

        public abstract boolean setBufferCapacity​(int verticesCount,
                                                  int indicesCount)
        Set the renderer buffers pre-emptively for given vertices- and index counts.

        Buffers will not change if given count elements is lower or equal current capacity.

        Parameters:
        verticesCount - number of vertices to hold
        indicesCount - number of indices to hold
        Returns:
        true if buffer size has changed, i.e. grown. Otherwise false.
        See Also:
        growBuffer(int, int), countOutlineShape(OutlineShape, int[]), countOutlineShapes(List, int[])
      • getRenderModes

        public final int getRenderModes()
        Returns bit-field of render modes, see create(..).
      • isRenderModeSet

        public final boolean isRenderModeSet​(int mask)
      • isVBAA

        public final boolean isVBAA()
        Returns true if capable of two pass rendering - VBAA, otherwise false.
        See Also:
        getRenderModes()
      • isMSAA

        public final boolean isMSAA()
        Returns true if capable of two pass rendering - MSAA, otherwise false.
        See Also:
        getRenderModes()
      • hasVariableWeight

        public final boolean hasVariableWeight()
        Returns true if capable of variable weights, otherwise false.
        See Also:
        getRenderModes()
      • hasColorTexture

        public final boolean hasColorTexture()
        Returns true if render mode has a color texture, i.e. the bit COLORTEXTURE_RENDERING_BIT is set, otherwise false.
        See Also:
        getRenderModes(), #isColorTextureLetterbox()
      • setFrustum

        public final void setFrustum​(com.jogamp.math.geom.Frustum frustum)
        Set Frustum culling for #addOutlineShape(OutlineShape, AffineTransform, float[]).
      • addOutlineShape

        public final void addOutlineShape​(OutlineShape shape,
                                          com.jogamp.math.geom.plane.AffineTransform t,
                                          com.jogamp.math.Vec4f rgbaColor)
        Add the given OutlineShape to this region with the given optional AffineTransform.

        In case frustum culling is set, the OutlineShape is dropped if it's bounding-box is fully outside of the frustum. The optional AffineTransform is applied to the bounding-box beforehand.

        Parameters:
        shape - the OutlineShape to add
        t - the optional AffineTransform to be applied on each vertex
        rgbaColor - if hasColorChannel() RGBA color must be passed, otherwise value is ignored.
      • addOutlineShapes

        public final void addOutlineShapes​(List<OutlineShape> shapes,
                                           com.jogamp.math.geom.plane.AffineTransform transform,
                                           com.jogamp.math.Vec4f rgbaColor)
        Add the given list of OutlineShapes to this region with the given optional AffineTransform.

        In case frustum culling is set, the OutlineShapes are dropped if it's bounding-box is fully outside of the frustum. The optional AffineTransform is applied to the bounding-box beforehand.

        Parameters:
        shapes - list of OutlineShape to add
        t - the optional AffineTransform to be applied on each vertex
        rgbaColor - if hasColorChannel() RGBA color must be passed, otherwise value is ignored.
      • getBounds

        public final com.jogamp.math.geom.AABBox getBounds()
        Returns:
        the AxisAligned bounding box of current region
      • markShapeDirty

        public final void markShapeDirty()
        Mark this region's shape dirty, i.e. its vertices, triangles, lines and/or color-texture coordinates changed.

        The data will be re-uploaded to the GPU at next draw(..).

        In 2-pass mode, this implies updating the FBO itself as well.

      • isShapeDirty

        public final boolean isShapeDirty()
        Returns true if this region's shape are dirty, see markShapeDirty().
      • markStateDirty

        public final void markStateDirty()
        Mark this region's render-state dirty, i.e. re-selecting a shader program regarding color-texture and -channel, and rendering the region into the FBO in 2-pass mode.

        In 1-pass mode, re-selection of the shader-program is based on color-texture and -channel only.

      • isStateDirty

        public final boolean isStateDirty()
        Returns true if this region's state is dirty, see markStateDirty().