Class NativeDrawableImage

All Implemented Interfaces:
IGLRenderer, ISortableDraw, ITranslucent
Direct Known Subclasses:
AWTNativeDrawableImage, PickableTexture

public class NativeDrawableImage extends DrawableImage implements ITranslucent
A NativeDrawableImage 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 NativeDrawableImage 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}
Author:
Martin
  • Field Details

    • resource

      protected SharedTexture resource
    • orientation

      protected PlaneAxis orientation
    • texMatMix

      protected float[] texMatMix
    • filter

      protected Color filter
    • axisValue

      protected float axisValue
    • mapping

      protected List<Coord2d> mapping
    • alpha

      protected float alpha
    • planePosition

      protected Coord2d planePosition
    • textureScale

      protected Transform textureScale
  • Constructor Details

  • Method Details

    • getColorFilter

      public Color getColorFilter()
    • setColorFilter

      public void setColorFilter(Color filter)
    • setAlphaFactor

      public void setAlphaFactor(float a)
      Specified by:
      setAlphaFactor in interface ITranslucent
    • initBoundsWithMapping

      protected void initBoundsWithMapping()
    • initBoundsWithResources

      protected void initBoundsWithResources()
    • getDefaultTextureMapping

      protected List<Coord2d> getDefaultTextureMapping()
    • 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.
      Overrides:
      getBounds in class Drawable
      Returns:
      a bounding box
    • 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 interface IGLRenderer
      Specified by:
      draw in class Drawable
    • 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 class Drawable
    • updateBounds

      public void updateBounds()
      Specified by:
      updateBounds in class Drawable