|
||||||||||
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
org.mt4j.components.visibleComponents.shapes.mesh.MTTriangleMesh
public class MTTriangleMesh
A mesh class for drawing triangle meshes.
Field Summary |
---|
Fields inherited from class org.mt4j.components.visibleComponents.shapes.AbstractShape |
---|
BOUNDS_CHECK_THEN_GEOMETRY_CHECK, BOUNDS_DONT_USE, BOUNDS_ONLY_CHECK |
Constructor Summary | |
---|---|
MTTriangleMesh(processing.core.PApplet pApplet, GeometryInfo geometryInfo) Creates a new triangle mesh. |
|
MTTriangleMesh(processing.core.PApplet pApplet, GeometryInfo geometryInfo, boolean calculateDefaultNormals) Creates a new triangle mesh. |
Method Summary | |
---|---|
void |
calculateDefaultNormals() Calculates default normals for this mesh if the mesh's geometryInfo doesent yet contain normals. |
protected IBoundingShape |
computeDefaultBounds() Computes a default bounding box for the shape. |
protected 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 |
drawComponent(javax.media.opengl.GL gl) Can be used to draw if the gl context has already been set up and is ready to use. |
void |
drawComponent(processing.core.PGraphics g) Draws this component only (Not its children!). |
void |
generateDisplayLists() Generates 2 openGL display lists for drawing this shape. |
Vector3D |
getCenterPointLocal() Gets the center point in local object space. |
Vector3D |
getGeometryIntersectionLocal(Ray ray) Tests if the ray intersects the shape and where. |
float |
getHeightXY(TransformSpace transformSpace) Get the height of the shape in the XY-Plane. |
Vector3D |
getHeightXYVectObjSpace() Gets the height xy vect obj space. |
java.util.List<Vertex[]> |
getOutlineContours() Gets the outline contours. |
int |
getTriangleCount() Gets the triangle count. |
Triangle[] |
getTriangles() The triangles of this triangle mesh. |
float |
getWidthXY(TransformSpace transformSpace) Get the width of the shape in the XY-Plane. |
Vector3D |
getWidthXYVectObjSpace() Gets the width xy vect obj space. |
boolean |
isCalculateDefaultNormals() Checks if default normals should be calculated if a new geometryInfo or new vertices are set on this mesh. |
boolean |
isDrawNormals() Checks if is draw normals. |
boolean |
isGeometryContainsPointLocal(Vector3D testPoint) Tests is the geometry of the shape contains the given point. |
void |
setCalculateDefaultNormals(boolean calculateDefaultNormals) Sets if default normals should be calculated if a new geometryInfo or new vertices are set on this mesh. |
void |
setDrawNormals(boolean drawNormals) Sets the draw normals. |
void |
setGeometryInfo(GeometryInfo geometryInfo) Sets a new geometryInfo with new vertices for this shape. |
void |
setOutlineContours(java.util.List<Vertex[]> contours) Sets the outline contours. |
void |
setStrokeColor(MTColor strokeColor) Sets the stroke color. |
void |
setVertices(Vertex[] vertices) Sets new vertices for that shape. |
Methods inherited from class org.mt4j.components.visibleComponents.AbstractVisibleComponent |
---|
applyStyle, 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 |
Constructor Detail |
---|
public MTTriangleMesh(processing.core.PApplet pApplet, GeometryInfo geometryInfo)
Important: This mesh expects triangles geometry!
pApplet
- the appletgeometryInfo
- the geometry infopublic MTTriangleMesh(processing.core.PApplet pApplet, GeometryInfo geometryInfo, boolean calculateDefaultNormals)
Important: This mesh expects triangles geometry!
pApplet
- the appletgeometryInfo
- the geometry infocalculateDefaultNormals
- sets if default normals for lightning should be calculated if the geometry doesent containe them yet - WE ARE ONLY REQUIRED TO CALCULATE NORMALS IF THE MESH IS TO BE USED WITH LIGHTNING!Method Detail |
---|
public void setGeometryInfo(GeometryInfo geometryInfo)
AbstractShape
setGeometryInfo
in class AbstractShape
geometryInfo
- the geometry infopublic void setVertices(Vertex[] vertices)
AbstractShape
setVertices
in class AbstractShape
vertices
- the verticesprotected IBoundingShape computeDefaultBounds()
AbstractShape
computeDefaultBounds
in class AbstractShape
public boolean isCalculateDefaultNormals()
public void setCalculateDefaultNormals(boolean calculateDefaultNormals)
calculateDefaultNormals
- the new creates the default normalspublic void calculateDefaultNormals()
public Vector3D getCenterPointLocal()
AbstractShape
getCenterPointLocal
in class AbstractShape
public boolean isGeometryContainsPointLocal(Vector3D testPoint)
AbstractShape
isGeometryContainsPointLocal
in class AbstractShape
testPoint
- the test pointpublic Vector3D getGeometryIntersectionLocal(Ray ray)
AbstractShape
getGeometryIntersectionLocal
in class AbstractShape
ray
- the raypublic int getTriangleCount()
public Triangle[] getTriangles()
public void drawComponent(processing.core.PGraphics g)
MTComponent
drawComponent
in interface IMTComponent
drawComponent
in class AbstractVisibleComponent
g
- the graphics contextpublic void drawComponent(javax.media.opengl.GL gl)
gl
- the glpublic boolean isDrawNormals()
public void setDrawNormals(boolean drawNormals)
drawNormals
- the new draw normalsprotected void destroyComponent()
MTComponent
destroy
method. So you shouldnt invoke this method directly.
destroyComponent
in class AbstractShape
protected void destroyDisplayLists()
AbstractShape
destroyDisplayLists
in class AbstractShape
public java.util.List<Vertex[]> getOutlineContours()
public void setStrokeColor(MTColor strokeColor)
AbstractVisibleComponent
setStrokeColor
in class AbstractShape
strokeColor
- the new stroke colorpublic void setOutlineContours(java.util.List<Vertex[]> contours)
contours
- the new outline contourspublic void generateDisplayLists()
AbstractShape
setUseDirectGL
has to be set to true first!setUseDisplayList()
This method only generates them!generateDisplayLists
in class AbstractShape
public float getHeightXY(TransformSpace transformSpace)
AbstractShape
getHeightXY
in class AbstractShape
transformSpace
- the space the width is calculated in, can be world space, parent relative- or object spacepublic Vector3D getHeightXYVectObjSpace()
public float getWidthXY(TransformSpace transformSpace)
AbstractShape
getWidthXY
in class AbstractShape
transformSpace
- the space the width is calculated in, can be global space, parent relative- or object spacepublic Vector3D getWidthXYVectObjSpace()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |