org.jzy3d.plot3d.primitives
Class CompileableComposite

java.lang.Object
  extended by org.jzy3d.plot3d.primitives.AbstractDrawable
      extended by org.jzy3d.plot3d.primitives.AbstractWireframeable
          extended by org.jzy3d.plot3d.primitives.CompileableComposite
All Implemented Interfaces:
IMultiColorable, ISingleColorable, IGLRenderer, ISortableDraw

public class CompileableComposite
extends AbstractWireframeable
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 AbstractComposite, and rendering it once it is compiled seems to take roughly half the time up to now. Since compilation occurs during a draw(), the first call to draw() is supposed to be 1.5x longer than a standard AbstractComposite, 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 Summary
protected  Color color
           
protected  List<AbstractDrawable> components
           
protected  boolean detailedToString
           
protected  ColorMapper mapper
           
 
Fields inherited from class org.jzy3d.plot3d.primitives.AbstractWireframeable
facestatus, wfcolor, wfstatus, wfwidth
 
Fields inherited from class org.jzy3d.plot3d.primitives.AbstractDrawable
bbox, boundingBoxColor, boundingBoxDisplayed, displayed, hasListeners, legend, legendDisplayed, listeners, transform, transformBefore
 
Constructor Summary
CompileableComposite()
           
 
Method Summary
 void add(AbstractDrawable drawable)
          Add a Drawable to this composite.
 void add(List<? extends AbstractDrawable> drawables)
          Append a list of Drawables to this composite.
 void applyGeometryTransform(Transform transform)
           
 void clear()
          Clear the list of Drawables from this composite.
protected  void compile(javax.media.opengl.GL gl, javax.media.opengl.glu.GLU glu, Camera cam)
          If you call compile, the display list will be regenerated.
 void draw(javax.media.opengl.GL gl, javax.media.opengl.glu.GLU glu, Camera cam)
          Reset the object if required, compile the object if it is not compiled, and execute actual rendering.
protected  void drawComponents(javax.media.opengl.GL gl, javax.media.opengl.glu.GLU glu, Camera cam)
           
protected  void execute(javax.media.opengl.GL gl, javax.media.opengl.glu.GLU glu, Camera cam)
           
 AbstractDrawable get(int p)
          Get a Drawable stored by this composite.
 BoundingBox3d getBounds()
          Return the BoundingBox of this object.
 Color getColor()
          Get the color.
 ColorMapper getColorMapper()
          Get the colormapper.
 List<AbstractDrawable> getDrawables()
           
 boolean isDetailedToString()
           
protected  void nullifyChildrenTransforms()
          When a drawable has a null transform, no transform is applied at draw(...).
 void recompile()
          Force the object to be rebuilt and stored as a display list at the next call to draw().
 void remove(AbstractDrawable drawable)
          Remove a Drawable from this composite.
protected  void reset(javax.media.opengl.GL gl)
           
 void setColor(Color color)
          Set the color.
 void setColorMapper(ColorMapper mapper)
          Set the colormapper that will be used by the Drawable, instead of using precomputed colors.
 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.
 void setFaceDisplayed(boolean status)
          Set the face display status to on or off.
 void setWireframeColor(Color color)
          Set the wireframe color.
 void setWireframeDisplayed(boolean status)
          Set the wireframe display status to on or off.
 void setWireframeWidth(float width)
          Set the wireframe width.
 int size()
          Return the number of Drawable stored by this composite.
 String toString()
          Print out information concerning all Drawable of this composite.
 String toString(int depth)
           
 void updateBounds()
           
 
Methods inherited from class org.jzy3d.plot3d.primitives.AbstractWireframeable
getFaceDisplayed, getWireframeColor, getWireframeDisplayed, getWireframeWidth
 
Methods inherited from class org.jzy3d.plot3d.primitives.AbstractDrawable
addDrawableListener, call, call, callWithAlphaFactor, dispose, doDrawBounds, doTransform, fireDrawableChanged, fireDrawableChanged, getBarycentre, getBoundingBoxColor, getDistance, getLegend, getLongestDistance, getShortestDistance, getTransform, getTransformBefore, hasLegend, isBoundingBoxDisplayed, isDisplayed, isLegendDisplayed, negative, removeDrawableListener, setBoundingBoxColor, setBoundingBoxDisplayed, setDisplayed, setLegend, setLegendDisplayed, setTransform, setTransformBefore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mapper

protected ColorMapper mapper

color

protected Color color

detailedToString

protected boolean detailedToString

components

protected List<AbstractDrawable> components
Constructor Detail

CompileableComposite

public CompileableComposite()
Method Detail

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(javax.media.opengl.GL gl,
                 javax.media.opengl.glu.GLU glu,
                 Camera cam)
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 AbstractDrawable
Parameters:
gl - GL2 context
glu - GLU context
cam - a reference to a shooting Camera.

compile

protected void compile(javax.media.opengl.GL gl,
                       javax.media.opengl.glu.GLU glu,
                       Camera cam)
If you call compile, the display list will be regenerated.


execute

protected void execute(javax.media.opengl.GL gl,
                       javax.media.opengl.glu.GLU glu,
                       Camera cam)

reset

protected void reset(javax.media.opengl.GL gl)

nullifyChildrenTransforms

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


drawComponents

protected void drawComponents(javax.media.opengl.GL gl,
                              javax.media.opengl.glu.GLU glu,
                              Camera cam)

applyGeometryTransform

public void applyGeometryTransform(Transform transform)
Specified by:
applyGeometryTransform in class AbstractDrawable

getBounds

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

Overrides:
getBounds in class AbstractDrawable
Returns:
a bounding box

updateBounds

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

add

public void add(List<? extends AbstractDrawable> 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(AbstractDrawable drawable)
Add a Drawable to this composite.


remove

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


get

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


getDrawables

public List<AbstractDrawable> getDrawables()

size

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


setWireframeColor

public void setWireframeColor(Color color)
Description copied from class: AbstractWireframeable
Set the wireframe color.

Overrides:
setWireframeColor in class AbstractWireframeable

setWireframeDisplayed

public void setWireframeDisplayed(boolean status)
Description copied from class: AbstractWireframeable
Set the wireframe display status to on or off.

Overrides:
setWireframeDisplayed in class AbstractWireframeable

setWireframeWidth

public void setWireframeWidth(float width)
Description copied from class: AbstractWireframeable
Set the wireframe width.

Overrides:
setWireframeWidth in class AbstractWireframeable

setFaceDisplayed

public void setFaceDisplayed(boolean status)
Description copied from class: AbstractWireframeable
Set the face display status to on or off.

Overrides:
setFaceDisplayed in class AbstractWireframeable

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 AbstractDrawable

toString

public String toString(int depth)
Overrides:
toString in class AbstractDrawable

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.



Copyright © 2013. All rights reserved.