Class CompileableComposite

All Implemented Interfaces:
IMultiColorable, ISingleColorable, IGLRenderer, ISortableDraw

public class CompileableComposite extends Wireframeable implements ISingleColorable, IMultiColorable
A CompileableComposite allows storage and subsequent faster execution of individual contained instances drawing routines in an OpenGL display list. Compiling the object take the time needed to render it as a standard Composite, and rendering it once it is compiled seems to take roughly half the time up to now. Since compilation occurs during a
invalid @link
draw()
, the first call to
invalid @link
draw()
is supposed to be 1.5x longer than a standard Composite, while all next cycles would be 0.5x longer. Compilation occurs when the content or the display attributes of this Composite changes (then all add(), remove(), setColor(), setWireFrameDisplayed(), etc). One can also force rebuilding the object by calling recompile(); IMPORTANT: for the moment, CompileableComposite should not be use in a charts using a Quality superior to Intermediate, in other word, you should not desire to have alpha enabled in your scene. Indeed, alpha requires ordering of polygons each time the viewpoint changes, which would require to recompile the object. Unsupported in Android / OpenGL ES
Author:
Nils Hoffmann
  • Field Details

    • mapper

      protected ColorMapper mapper
    • color

      protected Color color
    • detailedToString

      protected boolean detailedToString
    • components

      protected List<Drawable> components
  • Constructor Details

    • CompileableComposite

      public CompileableComposite()
  • Method Details

    • recompile

      public void recompile()
      Force the object to be rebuilt and stored as a display list at the next call to draw().
    • draw

      public void draw(IPainter painter)
      Reset the object if required, compile the object if it is not compiled, and execute actual rendering.
      Specified by:
      draw in interface IGLRenderer
      Specified by:
      draw in class Drawable
    • compile

      protected void compile(IPainter painter)
      If you call compile, the display list will be regenerated.
      Parameters:
      painter - TODO
    • execute

      protected void execute(IPainter painter)
    • reset

      protected void reset(IPainter painter)
    • nullifyChildrenTransforms

      protected void nullifyChildrenTransforms()
      When a drawable has a null transform, no transform is applied at draw(...).
    • drawComponents

      protected void drawComponents(IPainter painter)
    • applyGeometryTransform

      public void applyGeometryTransform(Transform transform)
      Specified by:
      applyGeometryTransform in class Drawable
    • getBounds

      public BoundingBox3d getBounds()
      Description copied from class: Drawable
      Return the BoundingBox of this object.
      Overrides:
      getBounds in class Drawable
      Returns:
      a bounding box
    • updateBounds

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

      public void add(List<? extends Drawable> drawables)
      Append a list of Drawables to this composite.
    • clear

      public void clear()
      Clear the list of Drawables from this composite.
    • add

      public void add(Drawable drawable)
      Add a Drawable to this composite.
    • remove

      public void remove(Drawable drawable)
      Remove a Drawable from this composite.
    • get

      public Drawable get(int p)
      Get a Drawable stored by this composite.
    • getDrawables

      public List<Drawable> getDrawables()
    • size

      public int size()
      Return the number of Drawable stored by this composite.
    • setWireframeColor

      public void setWireframeColor(Color color)
      Description copied from class: Wireframeable
      Set the wireframe color.
      Overrides:
      setWireframeColor in class Wireframeable
    • setWireframeDisplayed

      public void setWireframeDisplayed(boolean status)
      Description copied from class: Wireframeable
      Set the wireframe display status to on or off.
      Overrides:
      setWireframeDisplayed in class Wireframeable
    • setWireframeWidth

      public void setWireframeWidth(float width)
      Description copied from class: Wireframeable
      Set the wireframe width.
      Overrides:
      setWireframeWidth in class Wireframeable
    • setFaceDisplayed

      public void setFaceDisplayed(boolean status)
      Description copied from class: Wireframeable
      Set the face display status to on or off.
      Overrides:
      setFaceDisplayed in class Wireframeable
    • setColorMapper

      public void setColorMapper(ColorMapper mapper)
      Description copied from interface: IMultiColorable
      Set the colormapper that will be used by the Drawable, instead of using precomputed colors.
      Specified by:
      setColorMapper in interface IMultiColorable
    • getColorMapper

      public ColorMapper getColorMapper()
      Description copied from interface: IMultiColorable
      Get the colormapper.
      Specified by:
      getColorMapper in interface IMultiColorable
    • setColor

      public void setColor(Color color)
      Description copied from interface: ISingleColorable
      Set the color.
      Specified by:
      setColor in interface ISingleColorable
      Parameters:
      color - the color
    • getColor

      public Color getColor()
      Description copied from interface: ISingleColorable
      Get the color.
      Specified by:
      getColor in interface ISingleColorable
      Returns:
      color the color.
    • toString

      public String toString()
      Print out information concerning all Drawable of this composite.
      Overrides:
      toString in class Drawable
    • toString

      public String toString(int depth)
      Overrides:
      toString in class Drawable
    • isDetailedToString

      public boolean isDetailedToString()
    • setDetailedToString

      public void setDetailedToString(boolean detailedToString)
      When to true, the toString() method will give the detail of each element of this composite object in a tree like layout.