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
AnWireframeable
is aDrawable
that has a wireframe mode for display, i.e. almost all objects exceptPoint
. Defining an object asWireframeable
means 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 geometryPoint
s' colors.Wireframeable
objects 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 boolean
depthFunctionChangeForWireframe
if true, may change depth function while rendering wireframe to avoid Z-fighting with polygon face.protected boolean
faceDisplayed
protected Color
materialAmbiantReflection
protected Color
materialDiffuseReflection
protected Color
materialEmission
protected float[]
materialShininess
protected Color
materialSpecularReflection
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.protected float
polygonOffsetFactor
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)protected float
polygonOffsetUnit
protected boolean
polygonWireframeDepthTrick
if true, may change the depth range to set lines and polygons in different spaces.protected boolean
reflectLight
protected Color
wireframeColor
protected boolean
wireframeColorFromPolygonPoints
protected boolean
wireframeDisplayed
protected float
wireframeWidth
protected boolean
wireframeWithLineLoop
if 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 void
applyDepthRangeDefault(IPainter painter)
protected void
applyDepthRangeForOverlying(IPainter painter)
protected void
applyDepthRangeForUnderlying(IPainter painter)
protected void
applyMaterial(IPainter painter)
Applies material settingsprotected void
doDrawBoundsIfDisplayed(IPainter painter)
Color
getMaterialAmbiantReflection()
Color
getMaterialDiffuseReflection()
Color
getMaterialEmission()
float
getMaterialShininess()
Color
getMaterialSpecularReflection()
float
getPolygonOffsetFactor()
float
getPolygonOffsetUnit()
Color
getWireframeColor()
Get the wireframe color.float
getWireframeWidth()
Get the wireframe width.boolean
isFaceDisplayed()
Get the face display status to on or off.boolean
isPolygonOffsetFillEnable()
boolean
isPolygonWireframeDepthTrick()
boolean
isReflectLight()
boolean
isWireframeColorFromPolygonPoints()
boolean
isWireframeDisplayed()
Get the wireframe display status to on or off.protected void
polygonOffsetFillDisable(IPainter painter)
protected void
polygonOffsetFillEnable(IPainter painter)
protected void
polygonOffsetLineDisable(IPainter painter)
protected void
polygonOffsetLineEnable(IPainter painter)
void
setFaceDisplayed(boolean status)
Set the face display status to on or off.void
setMaterialAmbiantReflection(Color materialAmbiantReflection)
void
setMaterialDiffuseReflection(Color materialDiffuseReflection)
void
setMaterialEmission(Color materialEmission)
void
setMaterialShininess(float shininess)
void
setMaterialSpecularReflection(Color materialSpecularReflection)
void
setPolygonOffsetFactor(float polygonOffsetFactor)
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.void
setPolygonOffsetUnit(float polygonOffsetUnit)
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).void
setReflectLight(boolean reflectLight)
If true, drawing this object will set ambient, diffuse, specular and shininess parameters.void
setWireframeColor(Color color)
Set the wireframe color.void
setWireframeColorFromPolygonPoints(boolean wireframeColorFromPolygonPoints)
void
setWireframeDisplayed(boolean status)
Set the wireframe display status to on or off.void
setWireframeWidth(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:
doDrawBoundsIfDisplayed
in classDrawable
-
-