Class NativeDrawableImage
- java.lang.Object
-
- org.jzy3d.plot3d.primitives.Drawable
-
- org.jzy3d.plot3d.primitives.DrawableImage
-
- org.jzy3d.plot3d.primitives.textured.NativeDrawableImage
-
- All Implemented Interfaces:
IGLRenderer
,ISortableDraw
,ITranslucent
- Direct Known Subclasses:
AWTNativeDrawableImage
,PickableTexture
public class NativeDrawableImage extends DrawableImage implements ITranslucent
ANativeDrawableImage
can only mount its texture while the GL2 thread is current, so the best is to let draw() automount texture file the first time the resource is required. When a texture is loaded for the first time, it updates the current view bounds since the texture bounds where up to now unknown and fixed to origin with no width. ANativeDrawableImage
requires a color filter (default is white), and a set of coordinates defining the polygon on which the texture should be drawn. This texture implementation impose the texture to be perpendicular to aPlaneAxis
. It is thus defined with 2d Coordinates in the plane defined by the {PlaneAxis
, axisValue}- Author:
- Martin
-
-
Field Summary
Fields Modifier and Type Field Description protected float
alpha
protected float
axisValue
protected Color
filter
protected List<Coord2d>
mapping
protected PlaneAxis
orientation
protected Coord2d
planePosition
protected SharedTexture
resource
protected float[]
texMatMix
protected Transform
textureScale
-
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 NativeDrawableImage(SharedTexture resource)
NativeDrawableImage(SharedTexture resource, PlaneAxis orientation)
NativeDrawableImage(SharedTexture resource, PlaneAxis orientation, float axisValue)
NativeDrawableImage(SharedTexture resource, PlaneAxis orientation, float axisValue, List<Coord2d> coords)
NativeDrawableImage(SharedTexture resource, PlaneAxis orientation, float axisValue, List<Coord2d> coords, Color filter)
NativeDrawableImage(SharedTexture resource, PlaneAxis orientation, float axisValue, Color filter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
after(IPainter painter)
void
applyGeometryTransform(Transform transform)
protected void
before(IPainter painter)
void
debugMapping()
void
draw(IPainter painter)
Call OpenGL2 routines for rendering the object.BoundingBox3d
getBounds()
Return the BoundingBox of this object.Color
getColorFilter()
protected List<Coord2d>
getDefaultTextureMapping()
static List<Coord2d>
getManualTextureMapping(float width, float height)
static List<Coord2d>
getManualTextureMapping(float width, float height, float xoffset, float yoffset)
Must supply the expected size of texture in 3d coordinates.Coord2d
getPlanePosition()
SharedTexture
getResource()
Transform
getTextureScale()
protected void
initBoundsWithMapping()
protected void
initBoundsWithResources()
void
setAlphaFactor(float a)
void
setColorFilter(Color filter)
void
setPlanePosition(Coord2d planePosition)
void
setResource(SharedTexture resource)
void
setTextureScale(Transform textureScale)
void
updateBounds()
-
Methods inherited from class org.jzy3d.plot3d.primitives.Drawable
addDrawableListener, asWireframeable, dispose, doDrawBoundsIfDisplayed, doTransform, fireDrawableChanged, fireDrawableChanged, getBarycentre, getBoundingBoxColor, getDistance, getLegend, getLongestDistance, getShortestDistance, getSpaceTransformer, getTransform, getTransformBefore, hasLegend, isBoundingBoxDisplayed, isDisplayed, isLegendDisplayed, removeDrawableListener, setBoundingBoxColor, setBoundingBoxDisplayed, setDisplayed, setLegend, setLegendDisplayed, setSpaceTransformer, setTransform, setTransformBefore, toString, toString
-
-
-
-
Field Detail
-
resource
protected SharedTexture resource
-
orientation
protected PlaneAxis orientation
-
texMatMix
protected float[] texMatMix
-
filter
protected Color filter
-
axisValue
protected float axisValue
-
alpha
protected float alpha
-
planePosition
protected Coord2d planePosition
-
textureScale
protected Transform textureScale
-
-
Constructor Detail
-
NativeDrawableImage
public NativeDrawableImage(SharedTexture resource)
-
NativeDrawableImage
public NativeDrawableImage(SharedTexture resource, PlaneAxis orientation)
-
NativeDrawableImage
public NativeDrawableImage(SharedTexture resource, PlaneAxis orientation, float axisValue)
-
NativeDrawableImage
public NativeDrawableImage(SharedTexture resource, PlaneAxis orientation, float axisValue, Color filter)
-
NativeDrawableImage
public NativeDrawableImage(SharedTexture resource, PlaneAxis orientation, float axisValue, List<Coord2d> coords)
-
NativeDrawableImage
public NativeDrawableImage(SharedTexture resource, PlaneAxis orientation, float axisValue, List<Coord2d> coords, Color filter)
-
-
Method Detail
-
getColorFilter
public Color getColorFilter()
-
setColorFilter
public void setColorFilter(Color filter)
-
setAlphaFactor
public void setAlphaFactor(float a)
- Specified by:
setAlphaFactor
in interfaceITranslucent
-
initBoundsWithMapping
protected void initBoundsWithMapping()
-
initBoundsWithResources
protected void initBoundsWithResources()
-
getManualTextureMapping
public static List<Coord2d> getManualTextureMapping(float width, float height, float xoffset, float yoffset)
Must supply the expected size of texture in 3d coordinates.- Returns:
-
getManualTextureMapping
public static List<Coord2d> getManualTextureMapping(float width, float height)
-
debugMapping
public void debugMapping()
-
getBounds
public BoundingBox3d getBounds()
Description copied from class:Drawable
Return the BoundingBox of this object.
-
getPlanePosition
public Coord2d getPlanePosition()
-
setPlanePosition
public void setPlanePosition(Coord2d planePosition)
-
getTextureScale
public Transform getTextureScale()
-
setTextureScale
public void setTextureScale(Transform textureScale)
-
draw
public void draw(IPainter painter)
Description copied from class:Drawable
Call OpenGL2 routines for rendering the object.- Specified by:
draw
in interfaceIGLRenderer
- Specified by:
draw
in classDrawable
-
before
protected void before(IPainter painter)
-
after
protected void after(IPainter painter)
-
getResource
public SharedTexture getResource()
-
setResource
public void setResource(SharedTexture resource)
-
applyGeometryTransform
public void applyGeometryTransform(Transform transform)
- Specified by:
applyGeometryTransform
in classDrawable
-
updateBounds
public void updateBounds()
- Specified by:
updateBounds
in classDrawable
-
-