|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mt4j.components.MTComponent
org.mt4j.components.visibleComponents.AbstractVisibleComponent
org.mt4j.components.visibleComponents.shapes.AbstractShape
public abstract class AbstractShape
Abstract superclass for all kinds of shapes defined by vertices.
Field Summary | |
---|---|
static int |
BOUNDS_CHECK_THEN_GEOMETRY_CHECK The Constant BOUNDS_CHECK_THEN_GEOMETRY_CHECK. |
static int |
BOUNDS_DONT_USE The Constant BOUNDS_DONT_USE. |
static int |
BOUNDS_ONLY_CHECK The Constant BOUNDS_ONLY_CHECK. |
Constructor Summary | |
---|---|
AbstractShape(GeometryInfo geometryInfo, processing.core.PApplet pApplet) Creates a new geometry with the geometryInfo provided. |
|
AbstractShape(Vertex[] vertices, processing.core.PApplet pApplet) Creates a new shape with the vertices provided. |
Method Summary | |
---|---|
protected boolean |
componentContainsPointLocal(Vector3D testPoint) Checks whether the specified point is contained in this component. |
protected IBoundingShape |
computeDefaultBounds() Computes a default bounding box for the shape. |
void |
destroy() Removes this component from its parent. |
protected abstract void |
destroyComponent() Override this to clean up resources when destroying a component. |
protected void |
destroyDisplayLists() This is called during the shape's destroy() method. |
void |
disableAndDeleteDisplayLists() Deletes the displaylists of the object and sets setUseDisplayList() to false. |
void |
generateAndUseDisplayLists() Generates and uses openGL display lists for drawing this shape. |
void |
generateDisplayLists() Generates 2 openGL display lists for drawing this shape. |
IBoundingShape |
getBoundingShape() Gets the bounding shape. |
Vector3D |
getCenterPointGlobal() Gets the center point global. |
abstract Vector3D |
getCenterPointLocal() Gets the center point in local object space. |
Vector3D |
getCenterPointRelativeToParent() Gets the center point relative to parent. |
Vector3D[] |
getConvexHullXYGlobal() Calculates the 2D XY convex hull for this shape. |
GeometryInfo |
getGeometryInfo() Gets the geometry info. |
abstract Vector3D |
getGeometryIntersectionLocal(Ray ray) Tests if the ray intersects the shape and where. |
abstract float |
getHeightXY(TransformSpace transformSpace) Get the height of the shape in the XY-Plane. |
Vector3D |
getIntersectionLocal(Ray ray) Returns the intersection point of the ray and this component (children are not checked for intersections). |
processing.core.PImage |
getTexture() Gets the texture. |
int |
getTextureMode() Gets the processing texture mode. |
int |
getVertexCount() Gets the vertex count. |
Vertex[] |
getVerticesGlobal() Returns the vertices of this shape in real world (global) coordinates Caution: If you alter them in anyway, changes will only be consistent if you call the setVertices() method of the shape. |
Vertex[] |
getVerticesLocal() Returns the vertices of this shape without any transformations applied Caution: If you alter them in anyway, changes will only be consistent by calling the setVertices(Vertex[]) method with the changes vertices as an argument!. |
abstract float |
getWidthXY(TransformSpace transformSpace) Get the width of the shape in the XY-Plane. |
boolean |
isBoundingShapeSet() Checks if is bounding shape set. |
boolean |
isBoundsAutoCompute() Checks if is bounds auto compute. |
boolean |
isContainedIn(IFrustum frustum) Checks if this component is contained in the specified viewing frustum (is currently visible). |
abstract boolean |
isGeometryContainsPointLocal(Vector3D testPoint) Tests is the geometry of the shape contains the given point. |
boolean |
isTextureEnabled() Checks if is texture enabled. |
boolean |
isUseDirectGL() Checks if is use direct gl. |
boolean |
isUseDisplayList() Checks if is use display list. |
boolean |
isUseVBOs() Checks if this shape is drawn using VBOs. |
void |
setBoundingShape(IBoundingShape boundingShape) Sets the bounding shape. |
void |
setBoundsAutoCompute(boolean autoCompute) Sets the bounds auto compute. |
void |
setBoundsBehaviour(int boundsBehaviour) Sets the bounds behaviour. |
void |
setBoundsPickingBehaviour(int boundsPickingBehaviour) Deprecated. Method was renamed! Use setBoundsBehaviour()! |
protected void |
setDefaultGestureActions() Assigns the default gesture to this component, drag, rotate, scale. |
void |
setFillColor(MTColor color) Sets the fill color. |
void |
setGeometryInfo(GeometryInfo geometryInfo) Sets a new geometryInfo with new vertices for this shape. |
void |
setMatricesDirty(boolean baseMatrixDirty) Informs the object (and its children), that its matrix - OR ONE OF ITS PARENT'S MATRIX - has been altered. |
void |
setPositionGlobal(Vector3D pos) Sets the global position of the component. |
void |
setPositionRelativeToOther(MTComponent otherComp, Vector3D pos) Sets the position of this component, relative to the other specified component. |
void |
setPositionRelativeToParent(Vector3D pos) Sets the position of the component, relative to its parent coordinate frame. |
void |
setStrokeColor(MTColor strokeColor) Sets the stroke color. |
void |
setTexture(processing.core.PImage newTexImage) Sets a texture for this shape. |
void |
setTextureEnabled(boolean texture) Tells the shape to use its texture. |
void |
setTextureMode(int textureMode) Sets the way texture coordinates are handled in processing. |
void |
setUseDirectGL(boolean drawPureGL) If set to true - which is the default if using the OpenGL render mode - this shape will bypass processings rendering pipeline and use the OpenGL context directly for performance increases. |
void |
setUseDisplayList(boolean useDisplayList) Tries to use a opengl display list for rendering this shape. |
void |
setUseVBOs(boolean useVBOs) Tries to use Vertex Buffer Objects for displaying this shape. |
void |
setVertices(Vertex[] vertices) Sets new vertices for that shape. |
void |
tweenTranslate(Vector3D directionVect, float interpolationDuration, float accelerationEndTime, float decelerationStartTime) Moves this shape in the specified direction with an animation specified by the other parameters. |
void |
tweenTranslate(Vector3D directionVect, float interpolationDuration, float accelerationEndTime, float decelerationStartTime, int triggerDelay) Tween translate. |
void |
tweenTranslateTo(float x, float y, float z, float interpolationDuration, float accelerationEndTime, float decelerationStartTime) Moves this shape to the specified global position using an animation specified by the last three parameters |
Methods inherited from class org.mt4j.components.visibleComponents.AbstractVisibleComponent |
---|
applyStyle, drawComponent, getFillColor, getFillDrawMode, getFillPaint, getLineStipple, getMaterial, getStrokeColor, getStrokeWeight, getStyleInfo, isDrawSmooth, isNoFill, isNoStroke, postDraw, postDrawChildren, preDraw, setDrawSmooth, setFillDrawMode, setFillPaint, setLineStipple, setMaterial, setNoFill, setNoStroke, setStrokeWeight, setStyleInfo |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int BOUNDS_ONLY_CHECK
public static final int BOUNDS_CHECK_THEN_GEOMETRY_CHECK
public static final int BOUNDS_DONT_USE
Constructor Detail |
---|
public AbstractShape(Vertex[] vertices, processing.core.PApplet pApplet)
vertices
- the verticespApplet
- the appletpublic AbstractShape(GeometryInfo geometryInfo, processing.core.PApplet pApplet)
geometryInfo
- the geometry infopApplet
- the appletMethod Detail |
---|
protected void setDefaultGestureActions()
public void setBoundsBehaviour(int boundsBehaviour)
getIntersectionLocal
(used in picking) and getComponentContainsPointLocal
. Allowed values are:
AbstractShape.BOUNDS_ONLY_CHECK
AbstractShape.BOUNDS_DONT_USE
AbstractShape.BOUNDS_CHECK_THEN_GEOMETRY_CHECK
boundsBehaviour
- the new bounds behaviourpublic void setBoundsPickingBehaviour(int boundsPickingBehaviour)
boundsPickingBehaviour
- the new bounds picking behaviourpublic void setBoundingShape(IBoundingShape boundingShape)
boundingShape
- the new bounding shapepublic IBoundingShape getBoundingShape()
public boolean isBoundingShapeSet()
protected IBoundingShape computeDefaultBounds()
public void setBoundsAutoCompute(boolean autoCompute)
autoCompute
- the new bounds auto computepublic boolean isBoundsAutoCompute()
public void setGeometryInfo(GeometryInfo geometryInfo)
geometryInfo
- the geometry infopublic GeometryInfo getGeometryInfo()
public void setVertices(Vertex[] vertices)
vertices
- the verticespublic Vertex[] getVerticesLocal()
setVertices(Vertex[])
method with the changes vertices as an argument!.
public Vertex[] getVerticesGlobal()
public void setMatricesDirty(boolean baseMatrixDirty)
MTComponent
setMatricesDirty
in class MTComponent
baseMatrixDirty
- the matrices dirtypublic int getVertexCount()
public boolean isUseDirectGL()
public void setUseDirectGL(boolean drawPureGL)
If this is set to true, and additionally, setUseVBOs() is set to true, the shape is drawn by using vertex buffer objects (VBO).
By calling setUseDisplayList(true) it is drawn using display lists.
drawPureGL
- the draw pure glpublic boolean isUseVBOs()
public void setUseVBOs(boolean useVBOs)
setDrawDirectGL(true)
first.
useVBOs
- the use vb ospublic boolean isUseDisplayList()
public void setUseDisplayList(boolean useDisplayList)
setDrawDirectGL()
has to be set to "true" first!generateDisplayLists
. Instead of these 2 steps we can also just call generateAndUseDisplayLists()
useDisplayList
- the use display listpublic void generateDisplayLists()
setUseDirectGL
has to be set to true first!setUseDisplayList()
This method only generates them!public void generateAndUseDisplayLists()
public void disableAndDeleteDisplayLists()
public Vector3D[] getConvexHullXYGlobal()
public void setFillColor(MTColor color)
AbstractVisibleComponent
setFillColor
in class AbstractVisibleComponent
color
- the new fill colorpublic void setStrokeColor(MTColor strokeColor)
AbstractVisibleComponent
setStrokeColor
in class AbstractVisibleComponent
strokeColor
- the new stroke colorpublic void setTextureEnabled(boolean texture)
texture
- the texturepublic boolean isTextureEnabled()
public void setTexture(processing.core.PImage newTexImage)
newTexImage
- the new tex imagepublic processing.core.PImage getTexture()
public void setTextureMode(int textureMode)
PApplet.NORMALIZED
and PApplet.IMAGE
PApplet.NORMALIZED
. Which indicates that the texture coordinates should be in normalized range from 0.0 to 1.0! In image mode they have to range from 0..imageDimensions.
textureMode
- the texture modepublic int getTextureMode()
public void setPositionGlobal(Vector3D pos)
pos
- the pospublic void setPositionRelativeToParent(Vector3D pos)
pos
- the pospublic void setPositionRelativeToOther(MTComponent otherComp, Vector3D pos)
otherComp
- the other comppos
- the pospublic Vector3D getIntersectionLocal(Ray ray)
MTComponent
getIntersectionLocal
in class AbstractVisibleComponent
ray
- the rays, in local spaceMTComponent.globalToLocal(org.mt4j.util.math.Vector3D)
protected boolean componentContainsPointLocal(Vector3D testPoint)
MTComponent
componentContainsPointLocal
in class AbstractVisibleComponent
testPoint
- the test pointpublic boolean isContainedIn(IFrustum frustum)
MTComponent
isContainedIn
in class MTComponent
frustum
- the frustumpublic abstract Vector3D getGeometryIntersectionLocal(Ray ray)
ray
- the raypublic abstract boolean isGeometryContainsPointLocal(Vector3D testPoint)
testPoint
- the test pointpublic final Vector3D getCenterPointGlobal()
public final Vector3D getCenterPointRelativeToParent()
public abstract Vector3D getCenterPointLocal()
public void destroy()
destroyComponent
on this component which can be used to free resources that the component used.By default, the openGl texture object and the VBOs associated with this shape will be deleted. Be careful when you share textures or VBOs across more than one object! Destroying of displaylists isnt done atm! Use disableAndDeleteDisplaylists() instead.
destroy
in class MTComponent
protected void destroyDisplayLists()
protected abstract void destroyComponent()
MTComponent
destroy
method. So you shouldnt invoke this method directly.
destroyComponent
in class MTComponent
public abstract float getWidthXY(TransformSpace transformSpace)
transformSpace
- the space the width is calculated in, can be global space, parent relative- or object spacepublic abstract float getHeightXY(TransformSpace transformSpace)
transformSpace
- the space the width is calculated in, can be world space, parent relative- or object spacepublic void tweenTranslateTo(float x, float y, float z, float interpolationDuration, float accelerationEndTime, float decelerationStartTime)
x
- the xy
- the yz
- the zinterpolationDuration
- the interpolation durationaccelerationEndTime
- the acceleration end timedecelerationStartTime
- the deceleration start timepublic void tweenTranslate(Vector3D directionVect, float interpolationDuration, float accelerationEndTime, float decelerationStartTime)
directionVect
- the direction vectinterpolationDuration
- the interpolation durationaccelerationEndTime
- the acceleration end timedecelerationStartTime
- the deceleration start timepublic void tweenTranslate(Vector3D directionVect, float interpolationDuration, float accelerationEndTime, float decelerationStartTime, int triggerDelay)
directionVect
- the direction vectinterpolationDuration
- the interpolation durationaccelerationEndTime
- the acceleration end timedecelerationStartTime
- the deceleration start timetriggerDelay
- the trigger delay
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |