org.jzy3d.plot3d.primitives.textured
Class DrawableTexture

java.lang.Object
  extended by org.jzy3d.plot3d.primitives.AbstractDrawable
      extended by org.jzy3d.plot3d.primitives.textured.DrawableTexture
All Implemented Interfaces:
IGLRenderer, ISortableDraw, ITranslucent
Direct Known Subclasses:
PickableTexture

public class DrawableTexture
extends AbstractDrawable
implements ITranslucent

A DrawableTexture can only mount its texture while the GL 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.

Author:
Martin

Constructor Summary
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, java.util.List<Coord2d> coords)
           
DrawableTexture(SharedTexture resource, PlaneAxis orientation, float axisValue, java.util.List<Coord2d> coords, Color filter)
           
 
Method Summary
 void debugMapping()
           
 void draw(javax.media.opengl.GL gl, javax.media.opengl.glu.GLU glu, Camera cam)
          Call OpenGL routines for rendering the object.
 BoundingBox3d getBounds()
          Return the BoundingBox of this object.
 Color getColorFilter()
           
static java.util.List<Coord2d> getManualTextureMapping(float width, float height)
           
static java.util.List<Coord2d> getManualTextureMapping(float width, float height, float xoffset, float yoffset)
          Must supply the expected size of texture in 3d coordinates.
 Coord2d getPlanePosition()
           
 void setAlphaFactor(float a)
           
 void setColorFilter(Color filter)
           
 void setPlanePosition(Coord2d planePosition)
           
 
Methods inherited from class org.jzy3d.plot3d.primitives.AbstractDrawable
addDrawableListener, dispose, getBarycentre, getDistance, getFace, getLongestDistance, getShortestDistance, getTransform, hasFace, isDisplayed, isFace2dDisplayed, removeDrawableListener, setDisplayed, setLegend, setLegendDisplayed, setTransform, toString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DrawableTexture

public DrawableTexture(SharedTexture resource)

DrawableTexture

public DrawableTexture(SharedTexture resource,
                       PlaneAxis orientation)

DrawableTexture

public DrawableTexture(SharedTexture resource,
                       PlaneAxis orientation,
                       float axisValue)

DrawableTexture

public DrawableTexture(SharedTexture resource,
                       PlaneAxis orientation,
                       float axisValue,
                       Color filter)

DrawableTexture

public DrawableTexture(SharedTexture resource,
                       PlaneAxis orientation,
                       float axisValue,
                       java.util.List<Coord2d> coords)

DrawableTexture

public DrawableTexture(SharedTexture resource,
                       PlaneAxis orientation,
                       float axisValue,
                       java.util.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 interface ITranslucent

getManualTextureMapping

public static java.util.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 java.util.List<Coord2d> getManualTextureMapping(float width,
                                                              float height)

debugMapping

public void debugMapping()

getBounds

public BoundingBox3d getBounds()
Description copied from class: AbstractDrawable
Return the BoundingBox of this object.

Overrides:
getBounds in class AbstractDrawable
Returns:
a bounding box

getPlanePosition

public Coord2d getPlanePosition()

setPlanePosition

public void setPlanePosition(Coord2d planePosition)

draw

public void draw(javax.media.opengl.GL gl,
                 javax.media.opengl.glu.GLU glu,
                 Camera cam)
Description copied from class: AbstractDrawable
Call OpenGL routines for rendering the object.

Specified by:
draw in interface IGLRenderer
Specified by:
draw in class AbstractDrawable
Parameters:
gl - GL context
glu - GLU context
cam - a reference to a shooting Camera.