Class Shape
- java.lang.Object
-
- com.jogamp.graph.ui.Shape
-
- Direct Known Subclasses:
GraphShape
,Group
public abstract class Shape extends Object
Generic Shape, potentially using a Graph viaGraphShape
or other means of representing content.A shape includes the following build-in user-interactions - drag shape w/ 1-pointer click, see
setDraggable(boolean)
- resize shape w/ 1-pointer click and drag in 1/4th bottom-left and bottom-right corner, seesetResizable(boolean)
.A shape is expected to have its 0/0 origin in its bottom-left corner, otherwise the drag-zoom sticky-edge will not work as expected.
A shape's
getBounds()
includes its optionalgetPadding()
and optionalgetBorderThickness()
.GraphUI is GPU based and resolution independent.
GraphUI is intended to become an immediate- and retained-mode API.
Default colors (toggle-off is full color): - non-toggle: 0.6 * color, static -> 0.6 - pressed: 0.8 * color, static -> 0.5 - toggle-off: 1.0 * color, static -> 0.6 - toggle-on: 0.8 * color
- See Also:
Scene
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Shape.EventInfo
Shape
event info for propagatedNEWTEvent
s containing reference ofthe intended shape
as well as therotated relative position
to this shape.static interface
Shape.Listener
GeneralShape
listener actionstatic interface
Shape.ListenerBool
Shape
listener action returning a boolean valuestatic class
Shape.MouseGestureAdapter
Convenient adapter combining dummy implementation forMouseListener
andGestureHandler.GestureListener
static interface
Shape.MouseGestureListener
CombiningMouseListener
andGestureHandler.GestureListener
static interface
Shape.Visitor1
GeneralShape
visitorstatic interface
Shape.Visitor2
GeneralShape
visitor
-
Field Summary
Fields Modifier and Type Field Description static Comparator<Shape>
ZAscendingComparator
-
Constructor Summary
Constructors Constructor Description Shape()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Shape
addMouseListener(Shape.MouseGestureListener l)
void
clear(GL2ES2 gl, RegionRenderer renderer)
Clears all data and reset all states as if this instance was newly createdvoid
destroy(GL2ES2 gl, RegionRenderer renderer)
Destroys all datavoid
draw(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount)
Renders the shape.void
drawToSelect(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount)
Experimental selection draw command used byScene
.Vec4f
getBorderColor()
float
getBorderThickness()
Returns the border thickness, see#setBorder(float, Padding)
.AABBox
getBounds()
Returns the unscaled boundingAABBox
for this shape, borrowing internal instance.AABBox
getBounds(GLProfile glp)
Returns the unscaled boundingAABBox
for this shape.Vec4f
getColor()
int
getName()
Return the optional symbolic name for this shape.Padding
getPadding()
ReturnsPadding
of this shape, which is included in {@link #getBounds()B} and also includes the border.float[]
getPixelPerShapeUnit(int[] shapeSizePx, float[] pixPerShape)
Retrieve pixel per scaled shape-coordinate unit, i.e.float[]
getPixelPerShapeUnit(Scene scene, PMVMatrix pmv, float[] pixPerShape)
Retrieve pixel per scaled shape-coordinate unit, i.e.Vec3f
getPosition()
Returns position, i.e.Quaternion
getRotation()
ReturnsQuaternion
for rotation.Vec3f
getRotationPivot()
Return unscaled rotation origin, aka pivot.Vec3f
getScale()
Returns scale factors.float
getScaledHeight()
Returns the scaled height of the boundingAABBox
for this shape.float
getScaledWidth()
Returns the scaled width of the boundingAABBox
for this shape.String
getSubString()
Recti
getSurfacePort(PMVMatrix pmv, Recti viewport, Recti surfacePort)
Retrieve surface (view) port of this shape, i.e.int[]
getSurfaceSize(Scene.PMVMatrixSetup pmvMatrixSetup, Recti viewport, PMVMatrix pmv, int[] surfaceSize)
Retrieve surface (view) size of this shape.int[]
getSurfaceSize(Scene scene, PMVMatrix pmv, int[] surfaceSize)
Retrieve surface (view) size of this shape.int[]
getSurfaceSize(PMVMatrix pmv, Recti viewport, int[] surfaceSize)
Retrieve surface (view) size of this shape.boolean
hasBorder()
Returns true if a border has been enabled via#setBorder(float, Padding)
.abstract boolean
hasColorChannel()
Returns true if implementation uses an extra color channel or texture which will be modulated with the passed rgba color#drawImpl0(GL2ES2, RegionRenderer, int[], float[])
.boolean
hasPadding()
Returns true ifsetPaddding(Padding)
added a nonPadding.zeroSumSize()
spacing to this shape.boolean
isDraggable()
Returns if this shape is draggable, a user interaction.boolean
isEnabled()
Returns true if this shape is enabled and hence visible, otherwise false.boolean
isInteractive()
Returns if this shape allows user interaction, seesetInteractive(boolean)
boolean
isPressed()
boolean
isResizable()
Returns if this shape is resiable, a user interaction.boolean
isToggleable()
Returns true if this shape is toggable, i.e.boolean
isToggleOn()
void
markShapeDirty()
Marks the shape dirty, causing nextdraw()
to recreate the Graph shape and reset the region.void
markStateDirty()
Marks the rendering state dirty, causing nextdraw()
to notify the Graph region to reselect shader and repaint potentially used FBOs.Shape
move(float dtx, float dty, float dtz)
Move about scaled distance.Shape
move(Vec3f dt)
Move about scaled distance.Shape
moveTo(float tx, float ty, float tz)
Move to scaled position.Shape
moveTo(Vec3f t)
Move to scaled position.void
onClicked(Shape.Listener l)
void
onInit(Shape.ListenerBool l)
Set a user one-shot initializer callback.void
onMove(Shape.Listener l)
void
onToggle(Shape.Listener l)
Shape
removeMouseListener(Shape.MouseGestureListener l)
Shape
scale(float sx, float sy, float sz)
Multiply current scale factor by given scale.Shape
setBorder(float thickness)
Sets the thickness of the border, which is included ingetBounds()
and is outside ofgetPadding()
.Shape
setBorderColor(float r, float g, float b, float a)
Set border color.Shape
setBorderColor(Vec4f c)
Set border color.Shape
setColor(float r, float g, float b, float a)
Set base color.Shape
setColor(Vec4f c)
Set base color.Shape
setDragAndResizeable(boolean v)
Set whether this shape is draggable and resizable.Shape
setDraggable(boolean draggable)
Set whether this shape is draggable, i.e.Shape
setEnabled(boolean v)
Enable or disable this shape, i.e.Shape
setInteractive(boolean v)
Set whether this shape is interactive, i.e.Shape
setName(int name)
Set a symbolic name for this shape for identification.Shape
setPaddding(Padding padding)
Sets the padding for this shape, which is included in {@link #getBounds()B} and also includes the border.Shape
setPressed(boolean b)
Shape
setPressedColorMod(float r, float g, float b, float a)
Set pressed color.Shape
setResizable(boolean resizable)
Set whether this shape is resizable, i.e.Shape
setRotationPivot(float px, float py, float pz)
Set unscaled rotation origin, aka pivot.Shape
setRotationPivot(Vec3f pivot)
Set unscaled rotation origin, aka pivot.Shape
setScale(float sx, float sy, float sz)
Set scale factor to given scale.Shape
setToggle(boolean v)
Shape
setToggleable(boolean toggleable)
Shape
setToggleOffColorMod(float r, float g, float b, float a)
Set toggle-off color.Shape
setToggleOnColorMod(float r, float g, float b, float a)
Set toggle-on color.void
setTransform(PMVMatrix pmv)
Setup the pre-selectedGLMatrixFunc.GL_MODELVIEW
PMVMatrix
for this object.int[]
shapeToWinCoord(Scene.PMVMatrixSetup pmvMatrixSetup, Recti viewport, Vec3f objPos, PMVMatrix pmv, int[] glWinPos)
Map given object coordinate relative to this shape to window coordinates.int[]
shapeToWinCoord(Scene scene, Vec3f objPos, PMVMatrix pmv, int[] glWinPos)
Map given object coordinate relative to this shape to window coordinates.int[]
shapeToWinCoord(PMVMatrix pmv, Recti viewport, Vec3f objPos, int[] glWinPos)
Map given object coordinate relative to this shape to window coordinates.Shape
toggle()
String
toString()
Shape
validate(GL2ES2 gl)
Validates the shape's underlyingGLRegion
.Shape
validate(GLProfile glp)
Validates the shape's underlyingGLRegion
w/o a currentGL2ES2
objectVec3f
winToShapeCoord(Scene.PMVMatrixSetup pmvMatrixSetup, Recti viewport, int glWinX, int glWinY, PMVMatrix pmv, Vec3f objPos)
Map given gl-window-coordinates to object coordinates relative to this shape and its z-coordinate.Vec3f
winToShapeCoord(Scene scene, int glWinX, int glWinY, PMVMatrix pmv, Vec3f objPos)
Map given gl-window-coordinates to object coordinates relative to this shape and its z-coordinate.Vec3f
winToShapeCoord(PMVMatrix pmv, Recti viewport, int glWinX, int glWinY, Vec3f objPos)
Map given gl-window-coordinates to object coordinates relative to this shape and its z-coordinate.
-
-
-
Field Detail
-
ZAscendingComparator
public static Comparator<Shape> ZAscendingComparator
-
-
Method Detail
-
setName
public final Shape setName(int name)
Set a symbolic name for this shape for identification. Default is -1 for noname.
-
getName
public final int getName()
Return the optional symbolic name for this shape.
-
isEnabled
public final boolean isEnabled()
Returns true if this shape is enabled and hence visible, otherwise false.
-
setEnabled
public final Shape setEnabled(boolean v)
Enable or disable this shape, i.e. its visibility.
-
setPaddding
public final Shape setPaddding(Padding padding)
Sets the padding for this shape, which is included in {@link #getBounds()B} and also includes the border. Default is zero. Method issuesmarkShapeDirty()
.- Parameters:
padding
- distance of shape to the border, i.e. padding- Returns:
- this shape for chaining
- See Also:
getPadding()
,hasPadding()
-
getPadding
public Padding getPadding()
ReturnsPadding
of this shape, which is included in {@link #getBounds()B} and also includes the border. Default is zero.- See Also:
setPaddding(Padding)
,hasPadding()
-
hasPadding
public boolean hasPadding()
Returns true ifsetPaddding(Padding)
added a nonPadding.zeroSumSize()
spacing to this shape.
-
setBorder
public final Shape setBorder(float thickness)
Sets the thickness of the border, which is included ingetBounds()
and is outside ofgetPadding()
. Default is zero for no border. Method issuesmarkShapeDirty()
.- Parameters:
thickness
- border thickness, zero for no border- Returns:
- this shape for chaining
-
hasBorder
public final boolean hasBorder()
Returns true if a border has been enabled via#setBorder(float, Padding)
.
-
getBorderThickness
public final float getBorderThickness()
Returns the border thickness, see#setBorder(float, Padding)
.
-
clear
public final void clear(GL2ES2 gl, RegionRenderer renderer)
Clears all data and reset all states as if this instance was newly created- Parameters:
gl
- TODOrenderer
- TODO
-
destroy
public final void destroy(GL2ES2 gl, RegionRenderer renderer)
Destroys all data- Parameters:
gl
-renderer
-
-
onInit
public final void onInit(Shape.ListenerBool l)
Set a user one-shot initializer callback.Shape.ListenerBool.run(Shape)
will be called after eachdraw(GL2ES2, RegionRenderer, int[])
until it returns true, signaling user initialization is completed.- Parameters:
l
- callback, which shall return true signaling user initialization is done
-
onMove
public final void onMove(Shape.Listener l)
-
onToggle
public final void onToggle(Shape.Listener l)
-
onClicked
public final void onClicked(Shape.Listener l)
-
moveTo
public final Shape moveTo(float tx, float ty, float tz)
Move to scaled position. Position ends up in PMVMatrix unmodified.
-
moveTo
public final Shape moveTo(Vec3f t)
Move to scaled position. Position ends up in PMVMatrix unmodified.
-
move
public final Shape move(float dtx, float dty, float dtz)
Move about scaled distance. Position ends up in PMVMatrix unmodified.
-
move
public final Shape move(Vec3f dt)
Move about scaled distance. Position ends up in PMVMatrix unmodified.
-
getPosition
public final Vec3f getPosition()
Returns position, i.e. scaled translation as set viaor {@link #move(float, float, float)}
.
-
getRotation
public final Quaternion getRotation()
ReturnsQuaternion
for rotation.
-
getRotationPivot
public final Vec3f getRotationPivot()
Return unscaled rotation origin, aka pivot. Null if not set viagetRotationPivot()
.
-
setRotationPivot
public final Shape setRotationPivot(float px, float py, float pz)
Set unscaled rotation origin, aka pivot. Usually thegetBounds()
center and should be set whilevalidateImpl(GLProfile, GL2ES2)
.- Returns:
- this shape for chaining
-
setRotationPivot
public final Shape setRotationPivot(Vec3f pivot)
Set unscaled rotation origin, aka pivot. Usually thegetBounds()
center and should be set whilevalidateImpl(GLProfile, GL2ES2)
.- Parameters:
pivot
- rotation origin- Returns:
- this shape for chaining
-
setScale
public final Shape setScale(float sx, float sy, float sz)
Set scale factor to given scale.- See Also:
scale(float, float, float)
,getScale()
-
scale
public final Shape scale(float sx, float sy, float sz)
Multiply current scale factor by given scale.- See Also:
setScale(float, float, float)
,getScale()
-
getScale
public final Vec3f getScale()
Returns scale factors.
-
markShapeDirty
public final void markShapeDirty()
Marks the shape dirty, causing nextdraw()
to recreate the Graph shape and reset the region.
-
markStateDirty
public final void markStateDirty()
Marks the rendering state dirty, causing nextdraw()
to notify the Graph region to reselect shader and repaint potentially used FBOs.
-
getBounds
public final AABBox getBounds()
Returns the unscaled boundingAABBox
for this shape, borrowing internal instance. The returnedAABBox
will cover the unscaled shape as well as its optionalgetPadding()
and optionalgetBorderThickness()
. The returnedAABBox
is only valid after an initial call todraw(..)
orvalidate(GL2ES2)
.- See Also:
getBounds(GLProfile)
-
getScaledWidth
public final float getScaledWidth()
Returns the scaled width of the boundingAABBox
for this shape. The returned width will cover the scaled shape as well as its optional scaledgetPadding()
and optional scaledgetBorderThickness()
. The returned width is only valid after an initial call todraw(..)
orvalidate(GL2ES2)
.- See Also:
getBounds()
-
getScaledHeight
public final float getScaledHeight()
Returns the scaled height of the boundingAABBox
for this shape. The returned height will cover the scaled shape as well as its optional scaledgetPadding()
and optional scaledgetBorderThickness()
. The returned height is only valid after an initial call todraw(..)
orvalidate(GL2ES2)
.- See Also:
getBounds()
-
getBounds
public final AABBox getBounds(GLProfile glp)
Returns the unscaled boundingAABBox
for this shape. This variant differs fromgetBounds()
as it returns a validAABBox
even beforedraw(..)
and having an OpenGL instance available.- See Also:
getBounds()
-
drawToSelect
public void drawToSelect(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount)
Experimental selection draw command used byScene
.
-
draw
public void draw(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount)
Renders the shape.setTransform(PMVMatrix)
is expected to be completed beforehand.- Parameters:
gl
- the current GL objectrenderer
-RegionRenderer
which might be used for Graph Curve Rendering, also source ofRegionRenderer.getMatrix()
andRegionRenderer.getViewport()
.sampleCount
- sample count if used by Graph renderModes
-
validate
public final Shape validate(GL2ES2 gl)
Validates the shape's underlyingGLRegion
.If the region is dirty, it gets
cleared
and is reused.- Parameters:
gl
- currentGL2ES2
object- See Also:
validate(GLProfile)
-
validate
public final Shape validate(GLProfile glp)
Validates the shape's underlyingGLRegion
w/o a currentGL2ES2
objectIf the region is dirty a new region is created and the old one gets pushed to a dirty-list to get disposed when a GL context is available.
- See Also:
validate(GL2ES2)
-
setTransform
public void setTransform(PMVMatrix pmv)
Setup the pre-selectedGLMatrixFunc.GL_MODELVIEW
PMVMatrix
for this object. - Scale shape from its center position - Rotate shape around optional scaled pivot, see#setRotationPivot(float[])
), otherwise rotate around its scaled center (default)Shape's origin should be bottom-left @ 0/0 to have build-in drag-zoom work properly.
- Parameters:
pmv
- the matrix- See Also:
#setRotationPivot(float[])
,getRotation()
,moveTo(float, float, float)
,setScale(float, float, float)
-
getSurfacePort
public Recti getSurfacePort(PMVMatrix pmv, Recti viewport, Recti surfacePort)
Retrieve surface (view) port of this shape, i.e. lower x/y position and size.The given
PMVMatrix
has to be setup properly for this object, i.e. itsGLMatrixFunc.GL_PROJECTION
andGLMatrixFunc.GL_MODELVIEW
for the surrounding scene including this shape'ssetTransform(PMVMatrix)
.- Parameters:
pmv
- well formedPMVMatrix
, e.g. could have been setup viasetupMatrix(..)
andsetTransform(PMVMatrix)
.viewport
- the int[4] viewportsurfacePort
- Recti target surface port- Returns:
- given Recti
surfacePort
for successful gluProject(..) operation, otherwisenull
-
getSurfaceSize
public int[] getSurfaceSize(PMVMatrix pmv, Recti viewport, int[] surfaceSize)
Retrieve surface (view) size of this shape.The given
PMVMatrix
has to be setup properly for this object, i.e. itsGLMatrixFunc.GL_PROJECTION
andGLMatrixFunc.GL_MODELVIEW
for the surrounding scene including this shape'ssetTransform(PMVMatrix)
.- Parameters:
pmv
- well formedPMVMatrix
, e.g. could have been setup viasetupMatrix(..)
andsetTransform(PMVMatrix)
.viewport
- the int[4] viewportsurfaceSize
- int[2] target surface size- Returns:
- given int[2]
surfaceSize
for successful gluProject(..) operation, otherwisenull
- See Also:
getSurfaceSize(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix, int[])
,getSurfaceSize(Scene, PMVMatrix, int[])
-
getSurfaceSize
public int[] getSurfaceSize(Scene.PMVMatrixSetup pmvMatrixSetup, Recti viewport, PMVMatrix pmv, int[] surfaceSize)
Retrieve surface (view) size of this shape.The given
PMVMatrix
will besetup
properly for this shape including this shape'ssetTransform(PMVMatrix)
.- Parameters:
pmvMatrixSetup
-Scene.PMVMatrixSetup
tosetup
givenPMVMatrix
pmv
.viewport
- used viewport forPMVMatrix#gluProject(float, float, float, int[], float[])
pmv
- a newPMVMatrix
which willbe setup
,shape-transformed
and can be reused by the caller.surfaceSize
- int[2] target surface size- Returns:
- given int[2]
surfaceSize
for successful gluProject(..) operation, otherwisenull
- See Also:
getSurfaceSize(PMVMatrix, Recti, int[])
,getSurfaceSize(Scene, PMVMatrix, int[])
-
getSurfaceSize
public int[] getSurfaceSize(Scene scene, PMVMatrix pmv, int[] surfaceSize)
Retrieve surface (view) size of this shape.The given
PMVMatrix
will besetup
properly for this shape including this shape'ssetTransform(PMVMatrix)
.- Parameters:
scene
-Scene
to retrieveScene.PMVMatrixSetup
and the viewport.pmv
- a newPMVMatrix
which willbe setup
,shape-transformed
and can be reused by the caller.surfaceSize
- int[2] target surface size- Returns:
- given int[2]
surfaceSize
for successful gluProject(..) operation, otherwisenull
- See Also:
getSurfaceSize(PMVMatrix, Recti, int[])
,getSurfaceSize(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix, int[])
-
getPixelPerShapeUnit
public float[] getPixelPerShapeUnit(Scene scene, PMVMatrix pmv, float[] pixPerShape)
Retrieve pixel per scaled shape-coordinate unit, i.e. [px]/[obj].The given
PMVMatrix
will besetup
properly for this shape including this shape'ssetTransform(PMVMatrix)
.- Parameters:
scene
-Scene
to retrieveScene.PMVMatrixSetup
and the viewport.pmv
- a newPMVMatrix
which willbe setup
,shape-transformed
and can be reused by the caller.pixPerShape
- float[2] pixel per scaled shape-coordinate unit result storage- Returns:
- given float[2]
pixPerShape
for successful gluProject(..) operation, otherwisenull
- See Also:
getPixelPerShapeUnit(int[], float[])
,getSurfaceSize(Scene, PMVMatrix, int[])
,getScaledWidth()
,getScaledHeight()
-
getPixelPerShapeUnit
public float[] getPixelPerShapeUnit(int[] shapeSizePx, float[] pixPerShape)
Retrieve pixel per scaled shape-coordinate unit, i.e. [px]/[obj].- Parameters:
shapeSizePx
- int[2] shape size in pixel as retrieved via e.g.getSurfaceSize(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix, int[])
pixPerShape
- float[2] pixel scaled per shape-coordinate unit result storage- Returns:
- given float[2]
pixPerShape
- See Also:
getPixelPerShapeUnit(Scene, PMVMatrix, float[])
,getSurfaceSize(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, PMVMatrix, int[])
,getScaledWidth()
,getScaledHeight()
-
shapeToWinCoord
public int[] shapeToWinCoord(PMVMatrix pmv, Recti viewport, Vec3f objPos, int[] glWinPos)
Map given object coordinate relative to this shape to window coordinates.The given
PMVMatrix
has to be setup properly for this object, i.e. itsGLMatrixFunc.GL_PROJECTION
andGLMatrixFunc.GL_MODELVIEW
for the surrounding scene including this shape'ssetTransform(PMVMatrix)
.- Parameters:
pmv
- well formedPMVMatrix
, e.g. could have been setup viasetupMatrix(..)
andsetTransform(PMVMatrix)
.viewport
- the viewportobjPos
- object position relative to this shape's centerglWinPos
- int[2] target window position of objPos relative to this shape- Returns:
- given int[2]
glWinPos
for successful gluProject(..) operation, otherwisenull
- See Also:
#shapeToWinCoord(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, float[], PMVMatrix, int[])
,#shapeToWinCoord(Scene, float[], PMVMatrix, int[])
-
shapeToWinCoord
public int[] shapeToWinCoord(Scene.PMVMatrixSetup pmvMatrixSetup, Recti viewport, Vec3f objPos, PMVMatrix pmv, int[] glWinPos)
Map given object coordinate relative to this shape to window coordinates.The given
PMVMatrix
will besetup
properly for this shape including this shape'ssetTransform(PMVMatrix)
.- Parameters:
pmvMatrixSetup
-Scene.PMVMatrixSetup
tosetup
givenPMVMatrix
pmv
.viewport
- used viewport forPMVMatrix.gluProject(Vec3f, Recti, Vec3f)
objPos
- object position relative to this shape's centerpmv
- a newPMVMatrix
which willbe setup
,shape-transformed
and can be reused by the caller.glWinPos
- int[2] target window position of objPos relative to this shape- Returns:
- given int[2]
glWinPos
for successful gluProject(..) operation, otherwisenull
- See Also:
#shapeToWinCoord(PMVMatrix, Recti, float[], int[])
,#shapeToWinCoord(Scene, float[], PMVMatrix, int[])
-
shapeToWinCoord
public int[] shapeToWinCoord(Scene scene, Vec3f objPos, PMVMatrix pmv, int[] glWinPos)
Map given object coordinate relative to this shape to window coordinates.The given
PMVMatrix
will besetup
properly for this shape including this shape'ssetTransform(PMVMatrix)
.- Parameters:
scene
-Scene
to retrieveScene.PMVMatrixSetup
and the viewport.objPos
- object position relative to this shape's centerpmv
- a newPMVMatrix
which willbe setup
,shape-transformed
and can be reused by the caller.glWinPos
- int[2] target window position of objPos relative to this shape- Returns:
- given int[2]
glWinPos
for successful gluProject(..) operation, otherwisenull
- See Also:
#shapeToWinCoord(PMVMatrix, Recti, float[], int[])
,#shapeToWinCoord(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, float[], PMVMatrix, int[])
-
winToShapeCoord
public Vec3f winToShapeCoord(PMVMatrix pmv, Recti viewport, int glWinX, int glWinY, Vec3f objPos)
Map given gl-window-coordinates to object coordinates relative to this shape and its z-coordinate.The given
PMVMatrix
has to be setup properly for this object, i.e. itsGLMatrixFunc.GL_PROJECTION
andGLMatrixFunc.GL_MODELVIEW
for the surrounding scene including this shape'ssetTransform(PMVMatrix)
.- Parameters:
pmv
- well formedPMVMatrix
, e.g. could have been setup viasetupMatrix(..)
andsetTransform(PMVMatrix)
.viewport
- the Rect4i viewportglWinX
- in GL window coordinates, origin bottom-leftglWinY
- in GL window coordinates, origin bottom-leftobjPos
- target object position of glWinX/glWinY relative to this shape- Returns:
- given
objPos
for successful gluProject(..) and gluUnProject(..) operation, otherwisenull
- See Also:
#winToShapeCoord(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, int, int, PMVMatrix, float[])
,#winToShapeCoord(Scene, int, int, PMVMatrix, float[])
-
winToShapeCoord
public Vec3f winToShapeCoord(Scene.PMVMatrixSetup pmvMatrixSetup, Recti viewport, int glWinX, int glWinY, PMVMatrix pmv, Vec3f objPos)
Map given gl-window-coordinates to object coordinates relative to this shape and its z-coordinate.The given
PMVMatrix
will besetup
properly for this shape including this shape'ssetTransform(PMVMatrix)
.- Parameters:
pmvMatrixSetup
-Scene.PMVMatrixSetup
tosetup
givenPMVMatrix
pmv
.viewport
- used viewport forPMVMatrix.gluUnProject(float, float, float, Recti, Vec3f)
glWinX
- in GL window coordinates, origin bottom-leftglWinY
- in GL window coordinates, origin bottom-leftpmv
- a newPMVMatrix
which willbe setup
,shape-transformed
and can be reused by the caller.objPos
- target object position of glWinX/glWinY relative to this shape- Returns:
- given
objPos
for successful gluProject(..) and gluUnProject(..) operation, otherwisenull
- See Also:
#winToShapeCoord(PMVMatrix, Recti, int, int, float[])
,#winToShapeCoord(Scene, int, int, PMVMatrix, float[])
-
winToShapeCoord
public Vec3f winToShapeCoord(Scene scene, int glWinX, int glWinY, PMVMatrix pmv, Vec3f objPos)
Map given gl-window-coordinates to object coordinates relative to this shape and its z-coordinate.The given
PMVMatrix
will besetup
properly for this shape including this shape'ssetTransform(PMVMatrix)
.- Parameters:
scene
-Scene
to retrieveScene.PMVMatrixSetup
and the viewport.glWinX
- in GL window coordinates, origin bottom-leftglWinY
- in GL window coordinates, origin bottom-leftpmv
- a newPMVMatrix
which willbe setup
,shape-transformed
and can be reused by the caller.objPos
- target object position of glWinX/glWinY relative to this shape- Returns:
- given
objPos
for successful gluProject(..) and gluUnProject(..) operation, otherwisenull
- See Also:
#winToShapeCoord(PMVMatrix, Recti, int, int, float[])
,#winToShapeCoord(com.jogamp.graph.ui.Scene.PMVMatrixSetup, Recti, int, int, PMVMatrix, float[])
-
getColor
public Vec4f getColor()
-
setColor
public final Shape setColor(float r, float g, float b, float a)
Set base color.Default base-color w/o color channel, will be modulated w/ pressed- and toggle color
-
setColor
public final Shape setColor(Vec4f c)
Set base color.Default base-color w/o color channel, will be modulated w/ pressed- and toggle color
-
setPressedColorMod
public final Shape setPressedColorMod(float r, float g, float b, float a)
Set pressed color.Default pressed color-factor w/o color channel, modulated base-color. 0.75 * 1.2 = 0.9
-
setToggleOnColorMod
public final Shape setToggleOnColorMod(float r, float g, float b, float a)
Set toggle-on color.Default toggle-on color-factor w/o color channel, modulated base-color. 0.75 * 1.13 ~ 0.85
-
setToggleOffColorMod
public final Shape setToggleOffColorMod(float r, float g, float b, float a)
Set toggle-off color.Default toggle-off color-factor w/o color channel, modulated base-color. 0.75 * 0.86 ~ 0.65
-
getBorderColor
public Vec4f getBorderColor()
-
setBorderColor
public final Shape setBorderColor(float r, float g, float b, float a)
Set border color.
-
getSubString
public String getSubString()
-
setPressed
public Shape setPressed(boolean b)
-
isPressed
public boolean isPressed()
-
setToggleable
public Shape setToggleable(boolean toggleable)
- Parameters:
toggleable
-- See Also:
isInteractive()
-
isToggleable
public boolean isToggleable()
Returns true if this shape is toggable, i.e. rendered w/setToggleOnColorMod(float, float, float, float)
orsetToggleOffColorMod(float, float, float, float)
.- See Also:
isInteractive()
-
setToggle
public Shape setToggle(boolean v)
-
toggle
public Shape toggle()
-
isToggleOn
public boolean isToggleOn()
-
setInteractive
public Shape setInteractive(boolean v)
Set whether this shape is interactive, i.e. any user interaction like -isToggleable()
-isDraggable()
-isResizable()
but excluding programmatic changes.- Parameters:
v
- new value forisInteractive()
-
isInteractive
public boolean isInteractive()
Returns if this shape allows user interaction, seesetInteractive(boolean)
- See Also:
setInteractive(boolean)
-
setDraggable
public Shape setDraggable(boolean draggable)
Set whether this shape is draggable, i.e. translated by 1-pointer-click and drag.Default draggable is true.
- See Also:
isInteractive()
-
isDraggable
public boolean isDraggable()
Returns if this shape is draggable, a user interaction.- See Also:
isInteractive()
-
setResizable
public Shape setResizable(boolean resizable)
Set whether this shape is resizable, i.e. zoomed by 1-pointer-click and drag in 1/4th bottom-left and bottom-right corner.Default resizable is true.
- See Also:
isInteractive()
-
isResizable
public boolean isResizable()
Returns if this shape is resiable, a user interaction.- See Also:
isInteractive()
-
setDragAndResizeable
public Shape setDragAndResizeable(boolean v)
Set whether this shape is draggable and resizable.Default draggable and resizable is true.
-
addMouseListener
public final Shape addMouseListener(Shape.MouseGestureListener l)
-
removeMouseListener
public final Shape removeMouseListener(Shape.MouseGestureListener l)
-
hasColorChannel
public abstract boolean hasColorChannel()
Returns true if implementation uses an extra color channel or texture which will be modulated with the passed rgba color#drawImpl0(GL2ES2, RegionRenderer, int[], float[])
. Otherwise the base color will be modulated and passed to#drawImpl0(GL2ES2, RegionRenderer, int[], float[])
.
-
-