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
ANativeDrawableImagecan 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. ANativeDrawableImagerequires 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 floatalphaprotected floataxisValueprotected Colorfilterprotected List<Coord2d>mappingprotected PlaneAxisorientationprotected Coord2dplanePositionprotected SharedTextureresourceprotected float[]texMatMixprotected TransformtextureScale-
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 voidafter(IPainter painter)voidapplyGeometryTransform(Transform transform)protected voidbefore(IPainter painter)voiddebugMapping()voiddraw(IPainter painter)Call OpenGL2 routines for rendering the object.BoundingBox3dgetBounds()Return the BoundingBox of this object.ColorgetColorFilter()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.Coord2dgetPlanePosition()SharedTexturegetResource()TransformgetTextureScale()protected voidinitBoundsWithMapping()protected voidinitBoundsWithResources()voidsetAlphaFactor(float a)voidsetColorFilter(Color filter)voidsetPlanePosition(Coord2d planePosition)voidsetResource(SharedTexture resource)voidsetTextureScale(Transform textureScale)voidupdateBounds()-
Methods inherited from class org.jzy3d.plot3d.primitives.Drawable
addDrawableListener, dispose, doDrawBoundsIfDisplayed, doTransform, fireDrawableChanged, fireDrawableChanged, getBarycentre, getBoundingBoxColor, getDistance, getLegend, getLongestDistance, getShortestDistance, getSpaceTransformer, getTransform, getTransformBefore, hasLegend, isBoundingBoxDisplayed, isDisplayed, isLegendDisplayed, negative, 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:
setAlphaFactorin 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:DrawableReturn 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:DrawableCall OpenGL2 routines for rendering the object.- Specified by:
drawin interfaceIGLRenderer- Specified by:
drawin 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:
applyGeometryTransformin classDrawable
-
updateBounds
public void updateBounds()
- Specified by:
updateBoundsin classDrawable
-
-