28package com.jogamp.graph.ui;
30import java.util.ArrayList;
33import com.jogamp.graph.curve.OutlineShape;
34import com.jogamp.graph.curve.Region;
35import com.jogamp.graph.curve.opengl.GLRegion;
36import com.jogamp.graph.curve.opengl.RegionRenderer;
37import com.jogamp.graph.ui.layout.Padding;
38import com.jogamp.math.Vec3f;
39import com.jogamp.math.Vec4f;
40import com.jogamp.math.geom.AABBox;
41import com.jogamp.opengl.GL2ES2;
42import com.jogamp.opengl.GLProfile;
43import com.jogamp.opengl.util.texture.TextureSequence;
61 private final List<GLRegion> dirtyRegions =
new ArrayList<GLRegion>();
105 this.oshapeSharpness = sharpness;
122 private final void clearDirtyRegions(
final GL2ES2 gl) {
123 for(
final GLRegion r : dirtyRegions) {
126 dirtyRegions.clear();
132 clearDirtyRegions(gl);
141 clearDirtyRegions(gl);
191 }
else if(
null == gl ) {
211 resetGLRegion(glp, gl, colorTexSeq, vertIndexCount[0], vertIndexCount[1]);
217 clearDirtyRegions(gl);
262 final float dxy = borderThickness;
263 shape.
moveTo(x1+dxy, y1+dxy, z);
264 shape.
lineTo(x1+dxy, y2-dxy, z);
265 shape.
lineTo(x2-dxy, y2-dxy, z);
266 shape.
lineTo(x2-dxy, y1+dxy, z);
267 shape.
lineTo(x1+dxy, y1+dxy, z);
A Generic shape objects which is defined by a list of Outlines.
static final float DEFAULT_SHARPNESS
Initial getSharpness() value, which can be modified via setSharpness(float).
final void setIsQuadraticNurbs()
Claim this outline's vertices are all OutlineShape.VerticesState#QUADRATIC_NURBS, hence no cubic tran...
final void moveTo(final float x, final float y, final float z)
Start a new position for the next line segment at given point x/y (P1).
final void lineTo(final float x, final float y, final float z)
Add a line segment, intersecting the last point and the given point x/y (P1).
final void setSharpness(final float s)
Sets sharpness, defaults to DEFAULT_SHARPNESS.
final void closeLastOutline(final boolean closeTail)
Closes the last outline in the shape.
final void addEmptyOutline()
Add a new empty Outline to the end of this shape's outline list.
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
final void addOutlineShape(final OutlineShape shape, final AffineTransform t, final Vec4f rgbaColor)
Add the given OutlineShape to this region with the given optional AffineTransform.
static final int COLORCHANNEL_RENDERING_BIT
Rendering-Mode bit for Region to optionally enable a color-channel per vertex.
static String getRenderModeString(final int renderModes)
Returns a unique technical description string for renderModes as follows:
static final int DEFAULT_TWO_PASS_TEXTURE_UNIT
final void markStateDirty()
Mark this region's render-state dirty, i.e.
static final int[] countOutlineShape(final OutlineShape shape, final int[] vertIndexCount)
Count required number of vertices and indices adding to given int[2] vertIndexCount array.
static boolean hasColorChannel(final int renderModes)
Returns true if render mode has a color channel, i.e.
static boolean hasColorTexture(final int renderModes)
Returns true if render mode has a color texture, i.e.
A GLRegion is the OGL binding of one or more OutlineShapes Defined by its vertices and generated tria...
final void drawToSelect(final GL2ES2 gl, final RegionRenderer renderer)
Perform glSelect false color rendering: pass1 w/o any color texture nor channel, use static select co...
final GLRegion clear(final GL2ES2 gl)
Clears all buffers, i.e.
final void destroy(final GL2ES2 gl)
Delete and clear the associated OGL objects.
final void draw(final GL2ES2 gl, final RegionRenderer renderer)
Renders the associated OGL objects specifying current width/hight of window for optional multi pass r...
abstract void setTextureUnit(final int pass2TexUnit)
Set the 2nd pass texture unit.
final boolean setBufferCapacity(final int verticesCount, final int indicesCount)
Set the renderer buffers pre-emptively for given vertices- and index counts.
static GLRegion create(final GLProfile glp, int renderModes, final TextureSequence colorTexSeq, final int pass2TexUnit, final int initialVerticesCount, final int initialIndicesCount)
Create a GLRegion using the passed render mode.
final void setColorStatic(final Vec4f rgbaColor)
Graph based GLRegion Shape.
final int getRenderModes()
Returns validated Graph Region render modes, see create(..).
final float getSharpness()
Return the shape's Graph OutlineShape's sharpness value.
void clearImpl(final GL2ES2 gl, final RegionRenderer renderer)
void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer)
void setTextureUnit(final int pass2TexUnit)
Set the 2nd pass texture unit.
final void resetGLRegion(final GLProfile glp, final GL2ES2 gl, final TextureSequence colorTexSeq, final OutlineShape shape)
Convenient resetGLRegion(GLProfile, GL2ES2, TextureSequence, int, int) variant determining initial GL...
final void clearImpl0(final GL2ES2 gl, final RegionRenderer renderer)
Custom clear(GL2ES2, RegionRenderer) task, called 1st.
final void drawToSelectImpl0(final GL2ES2 gl, final RegionRenderer renderer)
Actual draw implementation, called by drawToSelect(GL2ES2, RegionRenderer).
void drawImpl0(final GL2ES2 gl, final RegionRenderer renderer, final Vec4f rgba)
Actual draw implementation, called by draw(GL2ES2, RegionRenderer).
boolean hasColorChannel()
Returns true if implementation uses an extra color channel or texture which will be modulated with th...
final void destroyImpl0(final GL2ES2 gl, final RegionRenderer renderer)
Custom destroy(GL2ES2, RegionRenderer) task, called 1st.
final GraphShape setSharpness(final float sharpness)
Sets the shape's Graph OutlineShape's sharpness parameter.
final int getRenderModesReq()
Returns requested Graph Region render modes, see create(..).
final void resetGLRegion(final GLProfile glp, final GL2ES2 gl, final TextureSequence colorTexSeq, int vertexCount, int indexCount)
Reset the GLRegion and reserving its buffers to have a free capacity for vertexCount and indexCount e...
final void validateImpl(final GL2ES2 gl, final GLProfile glp)
abstract void addShapeToRegion(GLProfile glp, GL2ES2 gl)
static void addRectangle(final Region region, final float sharpness, final AABBox box, final Padding padding, final float borderThickness, final Vec4f color)
GraphShape(final int renderModes)
Create a generic Graph based GLRegion UI Shape.
Generic Shape, potentially using a Graph via GraphShape or other means of representing content.
Padding getPadding()
Returns unscaled Padding of this shape, which is included in unscaled getBounds() and also includes t...
final boolean isStateDirty()
Returns the rendering dirty state, see markStateDirty().
boolean hasPadding()
Returns true if setPaddding(Padding) added a non Padding#zeroSize() spacing to this shape.
final boolean hasBorder()
Returns true if a border has been enabled via setBorder(float, Padding).
final float getBorderThickness()
Returns the border thickness, see setBorder(float, Padding).
boolean isShapeDirty()
Returns the shape's dirty state, see markShapeDirty().
final Vec4f getBorderColor()
final void markShapeDirty()
Marks the shape dirty, causing next draw() to recreate the Graph shape and reset the region.
final Vec4f rgbaColor
Default base-color w/o color channel, will be modulated w/ pressed- and toggle color.
final Shape setRotationPivot(final float px, final float py, final float pz)
Set unscaled rotation origin, aka pivot.
GraphUI CSS property Padding, unscaled space belonging to the element and included in the element's s...
final float top
Top value (unscaled)
final float left
Left value (unscaled)
static final Padding None
Zero padding constant.
final float right
Right value (unscaled)
final float bottom
Bottom value (unscaled)
3D Vector based upon three float components.
4D Vector based upon four float components.
boolean isEqual(final Vec4f o, final float epsilon)
Equals check using a given FloatUtil#EPSILON value and FloatUtil#isEqual(float, float,...
Axis Aligned Bounding Box.
final Vec3f getHigh()
Returns the maximum right-top-near (xyz) coordinate.
final Vec3f getLow()
Returns the minimum left-bottom-far (xyz) coordinate.
final AABBox resize(final AABBox newBox)
Resize the AABBox to encapsulate another AABox.
final Vec3f getCenter()
Returns computed center of this AABBox of getLow() and getHigh().
Specifies the the OpenGL profile.
Protocol for texture sequences, like animations, movies, etc.