Package org.jzy3d.plot3d.primitives
Class Wireframeable
- java.lang.Object
-
- org.jzy3d.plot3d.primitives.Drawable
-
- org.jzy3d.plot3d.primitives.Wireframeable
-
- All Implemented Interfaces:
IGLRenderer,ISortableDraw
- Direct Known Subclasses:
AbstractEnlightable,CompileableComposite,Composite,CubeGLUT,Disk,DrawableBoundingBox,DrawableVBO2,Geometry,LineStrip,Parallelepiped,Sphere,Teapot,Tube
public abstract class Wireframeable extends Drawable
AnWireframeableis aDrawablethat has a wireframe mode for display, i.e. almost all objects exceptPoint. Defining an object asWireframeablemeans this object will have a wireframe mode status (on/off), a wireframe color, and a wireframe width. As a consequence of beingWireframeable, a 3d object may have its faces displayed or not bysetFaceDisplayed(boolean). Wireframe coloring can either be based on the wireframe color or the geometryPoints' colors.Wireframeableobjects have faces which may reflect lights if there is any light switched on in the chart.- Author:
- Martin Pernollet
-
-
Field Summary
Fields Modifier and Type Field Description protected booleandepthFunctionChangeForWireframeif true, may change depth function while rendering wireframe to avoid Z-fighting with polygon face.protected booleanfaceDisplayedprotected ColormaterialAmbiantReflectionprotected ColormaterialDiffuseReflectionprotected ColormaterialEmissionprotected float[]materialShininessprotected ColormaterialSpecularReflectionstatic floatNO_OVERLAP_DEPTH_RATIOThe higher the value, the more the line are far from the faces and hence no z-fighting occurs between faces and lines.protected floatpolygonOffsetFactorprotected booleanpolygonOffsetFillEnableif true, enable polygon offset fill, which is the most clean way of handling polygon fill / line Z fighting, but only available in native mode (not emulgl)protected floatpolygonOffsetUnitprotected booleanpolygonWireframeDepthTrickif true, may change the depth range to set lines and polygons in different spaces.protected booleanreflectLightprotected ColorwireframeColorprotected booleanwireframeColorFromPolygonPointsprotected booleanwireframeDisplayedprotected floatwireframeWidthprotected booleanwireframeWithLineLoopif true, use line loop for rendering polygon border, otherwise use polygon mode + line mode.-
Fields inherited from class org.jzy3d.plot3d.primitives.Drawable
bbox, boundingBoxColor, boundingBoxDisplayed, displayed, hasListeners, legend, legendDisplayed, listeners, spaceTransformer, transform, transformBefore
-
-
Constructor Summary
Constructors Constructor Description Wireframeable()Initialize the wireframeable with a white color and width of 1 for wires, hidden wireframe, and displayed faces.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidapplyDepthRangeDefault(IPainter painter)protected voidapplyDepthRangeForOverlying(IPainter painter)protected voidapplyDepthRangeForUnderlying(IPainter painter)protected voidapplyMaterial(IPainter painter)Applies material settingsprotected voiddoDrawBoundsIfDisplayed(IPainter painter)ColorgetMaterialAmbiantReflection()ColorgetMaterialDiffuseReflection()ColorgetMaterialEmission()floatgetMaterialShininess()ColorgetMaterialSpecularReflection()floatgetPolygonOffsetFactor()floatgetPolygonOffsetUnit()ColorgetWireframeColor()Get the wireframe color.floatgetWireframeWidth()Get the wireframe width.booleanisFaceDisplayed()Get the face display status to on or off.booleanisPolygonOffsetFillEnable()booleanisPolygonWireframeDepthTrick()booleanisReflectLight()booleanisWireframeColorFromPolygonPoints()booleanisWireframeDisplayed()Get the wireframe display status to on or off.protected voidpolygonOffsetFillDisable(IPainter painter)protected voidpolygonOffsetFillEnable(IPainter painter)protected voidpolygonOffsetLineDisable(IPainter painter)protected voidpolygonOffsetLineEnable(IPainter painter)voidsetFaceDisplayed(boolean status)Set the face display status to on or off.voidsetMaterialAmbiantReflection(Color materialAmbiantReflection)voidsetMaterialDiffuseReflection(Color materialDiffuseReflection)voidsetMaterialEmission(Color materialEmission)voidsetMaterialShininess(float shininess)voidsetMaterialSpecularReflection(Color materialSpecularReflection)voidsetPolygonOffsetFactor(float polygonOffsetFactor)voidsetPolygonOffsetFillEnable(boolean polygonOffsetFillEnable)Enable offset fill, which let a polygon with a wireframe render cleanly without weird depth uncertainty between face polygon and wireframe polygon.voidsetPolygonOffsetUnit(float polygonOffsetUnit)voidsetPolygonWireframeDepthTrick(boolean polygonWireframeDepthTrick)May be used as alternative tosetPolygonOffsetFillEnable(boolean)in case it is not supported by underlying OpenGL version (Polygon offset appears as off version 2).voidsetReflectLight(boolean reflectLight)If true, drawing this object will set ambient, diffuse, specular and shininess parameters.voidsetWireframeColor(Color color)Set the wireframe color.voidsetWireframeColorFromPolygonPoints(boolean wireframeColorFromPolygonPoints)voidsetWireframeDisplayed(boolean status)Set the wireframe display status to on or off.voidsetWireframeWidth(float width)Set the wireframe width.-
Methods inherited from class org.jzy3d.plot3d.primitives.Drawable
addDrawableListener, applyGeometryTransform, asWireframeable, dispose, doTransform, draw, fireDrawableChanged, fireDrawableChanged, getBarycentre, getBoundingBoxColor, getBounds, getDistance, getLegend, getLongestDistance, getShortestDistance, getSpaceTransformer, getTransform, getTransformBefore, hasLegend, isBoundingBoxDisplayed, isDisplayed, isLegendDisplayed, removeDrawableListener, setBoundingBoxColor, setBoundingBoxDisplayed, setDisplayed, setLegend, setLegendDisplayed, setSpaceTransformer, setTransform, setTransformBefore, toString, toString, updateBounds
-
-
-
-
Field Detail
-
wireframeColor
protected Color wireframeColor
-
wireframeWidth
protected float wireframeWidth
-
wireframeDisplayed
protected boolean wireframeDisplayed
-
wireframeColorFromPolygonPoints
protected boolean wireframeColorFromPolygonPoints
-
faceDisplayed
protected boolean faceDisplayed
-
wireframeWithLineLoop
protected boolean wireframeWithLineLoop
if true, use line loop for rendering polygon border, otherwise use polygon mode + line mode.
-
depthFunctionChangeForWireframe
protected boolean depthFunctionChangeForWireframe
if true, may change depth function while rendering wireframe to avoid Z-fighting with polygon face.
-
polygonWireframeDepthTrick
protected boolean polygonWireframeDepthTrick
if true, may change the depth range to set lines and polygons in different spaces. Not accurate.
-
polygonOffsetFillEnable
protected boolean polygonOffsetFillEnable
if true, enable polygon offset fill, which is the most clean way of handling polygon fill / line Z fighting, but only available in native mode (not emulgl)
-
polygonOffsetFactor
protected float polygonOffsetFactor
-
polygonOffsetUnit
protected float polygonOffsetUnit
-
reflectLight
protected boolean reflectLight
-
materialAmbiantReflection
protected Color materialAmbiantReflection
-
materialDiffuseReflection
protected Color materialDiffuseReflection
-
materialSpecularReflection
protected Color materialSpecularReflection
-
materialEmission
protected Color materialEmission
-
materialShininess
protected float[] materialShininess
-
NO_OVERLAP_DEPTH_RATIO
public static float NO_OVERLAP_DEPTH_RATIO
The higher the value, the more the line are far from the faces and hence no z-fighting occurs between faces and lines. In case of higher value, line will be display more often, but also lines that should be behind the polygon
-
-
Method Detail
-
isWireframeColorFromPolygonPoints
public boolean isWireframeColorFromPolygonPoints()
-
setWireframeColorFromPolygonPoints
public void setWireframeColorFromPolygonPoints(boolean wireframeColorFromPolygonPoints)
-
setWireframeColor
public void setWireframeColor(Color color)
Set the wireframe color.
-
setWireframeDisplayed
public void setWireframeDisplayed(boolean status)
Set the wireframe display status to on or off.
-
setWireframeWidth
public void setWireframeWidth(float width)
Set the wireframe width.
-
setFaceDisplayed
public void setFaceDisplayed(boolean status)
Set the face display status to on or off.
-
getWireframeColor
public Color getWireframeColor()
Get the wireframe color.
-
isWireframeDisplayed
public boolean isWireframeDisplayed()
Get the wireframe display status to on or off.
-
getWireframeWidth
public float getWireframeWidth()
Get the wireframe width.
-
isFaceDisplayed
public boolean isFaceDisplayed()
Get the face display status to on or off.
-
polygonOffsetFillEnable
protected void polygonOffsetFillEnable(IPainter painter)
-
polygonOffsetFillDisable
protected void polygonOffsetFillDisable(IPainter painter)
-
polygonOffsetLineEnable
protected void polygonOffsetLineEnable(IPainter painter)
-
polygonOffsetLineDisable
protected void polygonOffsetLineDisable(IPainter painter)
-
isPolygonOffsetFillEnable
public boolean isPolygonOffsetFillEnable()
-
setPolygonOffsetFillEnable
public void setPolygonOffsetFillEnable(boolean polygonOffsetFillEnable)
Enable offset fill, which let a polygon with a wireframe render cleanly without weird depth uncertainty between face polygon and wireframe polygon.
-
getPolygonOffsetFactor
public float getPolygonOffsetFactor()
-
setPolygonOffsetFactor
public void setPolygonOffsetFactor(float polygonOffsetFactor)
-
getPolygonOffsetUnit
public float getPolygonOffsetUnit()
-
setPolygonOffsetUnit
public void setPolygonOffsetUnit(float polygonOffsetUnit)
-
setPolygonWireframeDepthTrick
public void setPolygonWireframeDepthTrick(boolean polygonWireframeDepthTrick)
May be used as alternative tosetPolygonOffsetFillEnable(boolean)in case it is not supported by underlying OpenGL version (Polygon offset appears as off version 2).
-
isPolygonWireframeDepthTrick
public boolean isPolygonWireframeDepthTrick()
-
applyDepthRangeForUnderlying
protected void applyDepthRangeForUnderlying(IPainter painter)
-
applyDepthRangeForOverlying
protected void applyDepthRangeForOverlying(IPainter painter)
-
applyDepthRangeDefault
protected void applyDepthRangeDefault(IPainter painter)
-
isReflectLight
public boolean isReflectLight()
-
setReflectLight
public void setReflectLight(boolean reflectLight)
If true, drawing this object will set ambient, diffuse, specular and shininess parameters. If the drawable has no normal defined, then the normal will be automatically processed.- Parameters:
reflectLight-
-
applyMaterial
protected void applyMaterial(IPainter painter)
Applies material settings
-
getMaterialAmbiantReflection
public Color getMaterialAmbiantReflection()
-
setMaterialAmbiantReflection
public void setMaterialAmbiantReflection(Color materialAmbiantReflection)
-
getMaterialDiffuseReflection
public Color getMaterialDiffuseReflection()
-
setMaterialDiffuseReflection
public void setMaterialDiffuseReflection(Color materialDiffuseReflection)
-
getMaterialSpecularReflection
public Color getMaterialSpecularReflection()
-
setMaterialSpecularReflection
public void setMaterialSpecularReflection(Color materialSpecularReflection)
-
getMaterialEmission
public Color getMaterialEmission()
-
setMaterialEmission
public void setMaterialEmission(Color materialEmission)
-
getMaterialShininess
public float getMaterialShininess()
-
setMaterialShininess
public void setMaterialShininess(float shininess)
-
doDrawBoundsIfDisplayed
protected void doDrawBoundsIfDisplayed(IPainter painter)
- Overrides:
doDrawBoundsIfDisplayedin classDrawable
-
-