public class DrawableTexture extends AbstractDrawable implements ITranslucent
DrawableTexture
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.
A DrawableTexture
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 a
PlaneAxis
. It is thus defined with 2d Coordinates in the plane
defined by the {PlaneAxis
, axisValue}Modifier and Type | Field and 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 |
bbox, boundingBoxColor, boundingBoxDisplayed, displayed, hasListeners, legend, legendDisplayed, listeners, spaceTransformer, transform, transformBefore
Constructor and Description |
---|
DrawableTexture(SharedTexture resource) |
DrawableTexture(SharedTexture resource,
PlaneAxis orientation) |
DrawableTexture(SharedTexture resource,
PlaneAxis orientation,
float axisValue) |
DrawableTexture(SharedTexture resource,
PlaneAxis orientation,
float axisValue,
Color filter) |
DrawableTexture(SharedTexture resource,
PlaneAxis orientation,
float axisValue,
List<Coord2d> coords) |
DrawableTexture(SharedTexture resource,
PlaneAxis orientation,
float axisValue,
List<Coord2d> coords,
Color filter) |
Modifier and Type | Method and Description |
---|---|
protected void |
after(com.jogamp.opengl.GL gl) |
void |
applyGeometryTransform(Transform transform) |
protected void |
before(com.jogamp.opengl.GL gl) |
void |
debugMapping() |
void |
draw(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
Camera cam)
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() |
addDrawableListener, call, call, callWithAlphaFactor, colorGL2, colorGLES2, dispose, doDrawBounds, 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, vertexGL2, vertexGLES2
protected Transform textureScale
protected SharedTexture resource
protected PlaneAxis orientation
protected float[] texMatMix
protected Color filter
protected float axisValue
protected float alpha
protected Coord2d planePosition
public DrawableTexture(SharedTexture resource)
public DrawableTexture(SharedTexture resource, PlaneAxis orientation)
public DrawableTexture(SharedTexture resource, PlaneAxis orientation, float axisValue)
public DrawableTexture(SharedTexture resource, PlaneAxis orientation, float axisValue, Color filter)
public DrawableTexture(SharedTexture resource, PlaneAxis orientation, float axisValue, List<Coord2d> coords)
public DrawableTexture(SharedTexture resource, PlaneAxis orientation, float axisValue, List<Coord2d> coords, Color filter)
public Color getColorFilter()
public void setColorFilter(Color filter)
public void setAlphaFactor(float a)
setAlphaFactor
in interface ITranslucent
protected void initBoundsWithMapping()
protected void initBoundsWithResources()
public static List<Coord2d> getManualTextureMapping(float width, float height, float xoffset, float yoffset)
public static List<Coord2d> getManualTextureMapping(float width, float height)
public void debugMapping()
public BoundingBox3d getBounds()
AbstractDrawable
getBounds
in class AbstractDrawable
public Coord2d getPlanePosition()
public void setPlanePosition(Coord2d planePosition)
public Transform getTextureScale()
public void setTextureScale(Transform textureScale)
public void draw(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam)
AbstractDrawable
draw
in interface IGLRenderer
draw
in class AbstractDrawable
gl
- GL2 contextglu
- GLU contextcam
- a reference to a shooting Camera.protected void before(com.jogamp.opengl.GL gl)
protected void after(com.jogamp.opengl.GL gl)
public SharedTexture getResource()
public void setResource(SharedTexture resource)
public void applyGeometryTransform(Transform transform)
applyGeometryTransform
in class AbstractDrawable
public void updateBounds()
updateBounds
in class AbstractDrawable
Copyright © 2016. All rights reserved.