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 viaGraphShapeor 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 classShape.EventInfoShapeevent info for propagatedNEWTEvents containing reference ofthe intended shapeas well as therotated relative positionto this shape.static interfaceShape.ListenerGeneralShapelistener actionstatic interfaceShape.ListenerBoolShapelistener action returning a boolean valuestatic classShape.MouseGestureAdapterConvenient adapter combining dummy implementation forMouseListenerandGestureHandler.GestureListenerstatic interfaceShape.MouseGestureListenerCombiningMouseListenerandGestureHandler.GestureListenerstatic interfaceShape.Visitor1GeneralShapevisitorstatic interfaceShape.Visitor2GeneralShapevisitor
-
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 ShapeaddMouseListener(Shape.MouseGestureListener l)voidclear(GL2ES2 gl, RegionRenderer renderer)Clears all data and reset all states as if this instance was newly createdvoiddestroy(GL2ES2 gl, RegionRenderer renderer)Destroys all datavoiddraw(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount)Renders the shape.voiddrawToSelect(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount)Experimental selection draw command used byScene.Vec4fgetBorderColor()floatgetBorderThickness()Returns the border thickness, see#setBorder(float, Padding).AABBoxgetBounds()Returns the unscaled boundingAABBoxfor this shape, borrowing internal instance.AABBoxgetBounds(GLProfile glp)Returns the unscaled boundingAABBoxfor this shape.Vec4fgetColor()intgetName()Return the optional symbolic name for this shape.PaddinggetPadding()ReturnsPaddingof 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.Vec3fgetPosition()Returns position, i.e.QuaterniongetRotation()ReturnsQuaternionfor rotation.Vec3fgetRotationPivot()Return unscaled rotation origin, aka pivot.Vec3fgetScale()Returns scale factors.floatgetScaledHeight()Returns the scaled height of the boundingAABBoxfor this shape.floatgetScaledWidth()Returns the scaled width of the boundingAABBoxfor this shape.StringgetSubString()RectigetSurfacePort(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.booleanhasBorder()Returns true if a border has been enabled via#setBorder(float, Padding).abstract booleanhasColorChannel()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[]).booleanhasPadding()Returns true ifsetPaddding(Padding)added a nonPadding.zeroSumSize()spacing to this shape.booleanisDraggable()Returns if this shape is draggable, a user interaction.booleanisEnabled()Returns true if this shape is enabled and hence visible, otherwise false.booleanisInteractive()Returns if this shape allows user interaction, seesetInteractive(boolean)booleanisPressed()booleanisResizable()Returns if this shape is resiable, a user interaction.booleanisToggleable()Returns true if this shape is toggable, i.e.booleanisToggleOn()voidmarkShapeDirty()Marks the shape dirty, causing nextdraw()to recreate the Graph shape and reset the region.voidmarkStateDirty()Marks the rendering state dirty, causing nextdraw()to notify the Graph region to reselect shader and repaint potentially used FBOs.Shapemove(float dtx, float dty, float dtz)Move about scaled distance.Shapemove(Vec3f dt)Move about scaled distance.ShapemoveTo(float tx, float ty, float tz)Move to scaled position.ShapemoveTo(Vec3f t)Move to scaled position.voidonClicked(Shape.Listener l)voidonInit(Shape.ListenerBool l)Set a user one-shot initializer callback.voidonMove(Shape.Listener l)voidonToggle(Shape.Listener l)ShaperemoveMouseListener(Shape.MouseGestureListener l)Shapescale(float sx, float sy, float sz)Multiply current scale factor by given scale.ShapesetBorder(float thickness)Sets the thickness of the border, which is included ingetBounds()and is outside ofgetPadding().ShapesetBorderColor(float r, float g, float b, float a)Set border color.ShapesetBorderColor(Vec4f c)Set border color.ShapesetColor(float r, float g, float b, float a)Set base color.ShapesetColor(Vec4f c)Set base color.ShapesetDragAndResizeable(boolean v)Set whether this shape is draggable and resizable.ShapesetDraggable(boolean draggable)Set whether this shape is draggable, i.e.ShapesetEnabled(boolean v)Enable or disable this shape, i.e.ShapesetInteractive(boolean v)Set whether this shape is interactive, i.e.ShapesetName(int name)Set a symbolic name for this shape for identification.ShapesetPaddding(Padding padding)Sets the padding for this shape, which is included in {@link #getBounds()B} and also includes the border.ShapesetPressed(boolean b)ShapesetPressedColorMod(float r, float g, float b, float a)Set pressed color.ShapesetResizable(boolean resizable)Set whether this shape is resizable, i.e.ShapesetRotationPivot(float px, float py, float pz)Set unscaled rotation origin, aka pivot.ShapesetRotationPivot(Vec3f pivot)Set unscaled rotation origin, aka pivot.ShapesetScale(float sx, float sy, float sz)Set scale factor to given scale.ShapesetToggle(boolean v)ShapesetToggleable(boolean toggleable)ShapesetToggleOffColorMod(float r, float g, float b, float a)Set toggle-off color.ShapesetToggleOnColorMod(float r, float g, float b, float a)Set toggle-on color.voidsetTransform(PMVMatrix pmv)Setup the pre-selectedGLMatrixFunc.GL_MODELVIEWPMVMatrixfor 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.Shapetoggle()StringtoString()Shapevalidate(GL2ES2 gl)Validates the shape's underlyingGLRegion.Shapevalidate(GLProfile glp)Validates the shape's underlyingGLRegionw/o a currentGL2ES2objectVec3fwinToShapeCoord(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.Vec3fwinToShapeCoord(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.Vec3fwinToShapeCoord(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()
ReturnsPaddingof 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()
ReturnsQuaternionfor 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 boundingAABBoxfor this shape, borrowing internal instance. The returnedAABBoxwill cover the unscaled shape as well as its optionalgetPadding()and optionalgetBorderThickness(). The returnedAABBoxis only valid after an initial call todraw(..)orvalidate(GL2ES2).- See Also:
getBounds(GLProfile)
-
getScaledWidth
public final float getScaledWidth()
Returns the scaled width of the boundingAABBoxfor 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 boundingAABBoxfor 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 boundingAABBoxfor this shape. This variant differs fromgetBounds()as it returns a validAABBoxeven 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-RegionRendererwhich 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
clearedand is reused.- Parameters:
gl- currentGL2ES2object- See Also:
validate(GLProfile)
-
validate
public final Shape validate(GLProfile glp)
Validates the shape's underlyingGLRegionw/o a currentGL2ES2objectIf 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_MODELVIEWPMVMatrixfor 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
PMVMatrixhas to be setup properly for this object, i.e. itsGLMatrixFunc.GL_PROJECTIONandGLMatrixFunc.GL_MODELVIEWfor 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
surfacePortfor successful gluProject(..) operation, otherwisenull
-
getSurfaceSize
public int[] getSurfaceSize(PMVMatrix pmv, Recti viewport, int[] surfaceSize)
Retrieve surface (view) size of this shape.The given
PMVMatrixhas to be setup properly for this object, i.e. itsGLMatrixFunc.GL_PROJECTIONandGLMatrixFunc.GL_MODELVIEWfor 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]
surfaceSizefor 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
PMVMatrixwill besetupproperly for this shape including this shape'ssetTransform(PMVMatrix).- Parameters:
pmvMatrixSetup-Scene.PMVMatrixSetuptosetupgivenPMVMatrixpmv.viewport- used viewport forPMVMatrix#gluProject(float, float, float, int[], float[])pmv- a newPMVMatrixwhich willbe setup,shape-transformedand can be reused by the caller.surfaceSize- int[2] target surface size- Returns:
- given int[2]
surfaceSizefor 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
PMVMatrixwill besetupproperly for this shape including this shape'ssetTransform(PMVMatrix).- Parameters:
scene-Sceneto retrieveScene.PMVMatrixSetupand the viewport.pmv- a newPMVMatrixwhich willbe setup,shape-transformedand can be reused by the caller.surfaceSize- int[2] target surface size- Returns:
- given int[2]
surfaceSizefor 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
PMVMatrixwill besetupproperly for this shape including this shape'ssetTransform(PMVMatrix).- Parameters:
scene-Sceneto retrieveScene.PMVMatrixSetupand the viewport.pmv- a newPMVMatrixwhich willbe setup,shape-transformedand can be reused by the caller.pixPerShape- float[2] pixel per scaled shape-coordinate unit result storage- Returns:
- given float[2]
pixPerShapefor 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
PMVMatrixhas to be setup properly for this object, i.e. itsGLMatrixFunc.GL_PROJECTIONandGLMatrixFunc.GL_MODELVIEWfor 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]
glWinPosfor 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
PMVMatrixwill besetupproperly for this shape including this shape'ssetTransform(PMVMatrix).- Parameters:
pmvMatrixSetup-Scene.PMVMatrixSetuptosetupgivenPMVMatrixpmv.viewport- used viewport forPMVMatrix.gluProject(Vec3f, Recti, Vec3f)objPos- object position relative to this shape's centerpmv- a newPMVMatrixwhich willbe setup,shape-transformedand can be reused by the caller.glWinPos- int[2] target window position of objPos relative to this shape- Returns:
- given int[2]
glWinPosfor 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
PMVMatrixwill besetupproperly for this shape including this shape'ssetTransform(PMVMatrix).- Parameters:
scene-Sceneto retrieveScene.PMVMatrixSetupand the viewport.objPos- object position relative to this shape's centerpmv- a newPMVMatrixwhich willbe setup,shape-transformedand can be reused by the caller.glWinPos- int[2] target window position of objPos relative to this shape- Returns:
- given int[2]
glWinPosfor 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
PMVMatrixhas to be setup properly for this object, i.e. itsGLMatrixFunc.GL_PROJECTIONandGLMatrixFunc.GL_MODELVIEWfor 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
objPosfor 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
PMVMatrixwill besetupproperly for this shape including this shape'ssetTransform(PMVMatrix).- Parameters:
pmvMatrixSetup-Scene.PMVMatrixSetuptosetupgivenPMVMatrixpmv.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 newPMVMatrixwhich willbe setup,shape-transformedand can be reused by the caller.objPos- target object position of glWinX/glWinY relative to this shape- Returns:
- given
objPosfor 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
PMVMatrixwill besetupproperly for this shape including this shape'ssetTransform(PMVMatrix).- Parameters:
scene-Sceneto retrieveScene.PMVMatrixSetupand the viewport.glWinX- in GL window coordinates, origin bottom-leftglWinY- in GL window coordinates, origin bottom-leftpmv- a newPMVMatrixwhich willbe setup,shape-transformedand can be reused by the caller.objPos- target object position of glWinX/glWinY relative to this shape- Returns:
- given
objPosfor 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[]).
-
-