de.grogra.imp3d.gl20
Class GL20DisplayVisitor

java.lang.Object
  extended by de.grogra.imp3d.Visitor3D
      extended by de.grogra.imp3d.DisplayVisitor
          extended by de.grogra.imp3d.gl20.GL20DisplayVisitor
All Implemented Interfaces:
Visitor, RenderState

public class GL20DisplayVisitor
extends DisplayVisitor
implements RenderState

The GL20DisplayVisitor travels through the graph and collect information about it.

Author:
Jack Weinert

Field Summary
 
Fields inherited from class de.grogra.imp3d.DisplayVisitor
lastEntered, lastEnteredIsNode
 
Fields inherited from class de.grogra.imp3d.Visitor3D
layer, state, transformation
 
Fields inherited from interface de.grogra.imp3d.RenderState
CURRENT_HIGHLIGHT
 
Fields inherited from interface de.grogra.graph.Visitor
STOP
 
Constructor Summary
GL20DisplayVisitor()
           
 
Method Summary
 void drawBox(float halfWidth, float halfLength, float height, Shader s, int highlight, Matrix4d t)
           
 void drawFrustum(float height, float baseRadius, float topRadius, boolean baseClosed, boolean topClosed, float scaleV, Shader s, int highlight, Matrix4d t)
           
 void drawLine(Tuple3f start, Tuple3f end, Tuple3f color, int highlight, Matrix4d t)
           
 void drawParallelogram(float axis, Vector3f secondAxis, float scaleU, float scaleV, Shader s, int highlight, Matrix4d t)
           
 void drawPlane(Shader s, int highlight, Matrix4d t)
           
 void drawPoint(Tuple3f location, int pixelSize, Tuple3f color, int highlight, Matrix4d t)
           
 void drawPointCloud(float[] locations, float pointSize, Tuple3f color, int highlight, Matrix4d t)
          Draw a set of points.
 void drawPolygons(Polygonizable polygons, java.lang.Object obj, boolean asNode, Shader s, int highlight, Matrix4d t)
           
 void drawRectangle(int x, int y, int w, int h, Tuple3f color)
           
 void drawSphere(float radius, Shader s, int highlight, Matrix4d t)
           
 void drawString(int x, int y, java.lang.String text, java.awt.Font font, Tuple3f color)
           
 void drawSupershape(float a, float b, float m1, float n11, float n12, float n13, float m2, float n21, float n22, float n23, Shader sh, int highlight, Matrix4d t)
          Draw a supershape around the origin (0/0/0).
 float estimateScaleAt(Tuple3f point)
           
 void fillRectangle(int x, int y, int w, int h, Tuple3f color)
           
 int getCurrentHighlight()
           
 java.awt.FontMetrics getFontMetrics(java.awt.Font font)
           
 Pool getPool()
           
 GraphState getRenderGraphState()
           
 boolean getWindowPos(Tuple3f location, Tuple2f out)
          Computes the window coordinates in pixels of a location in the current object coordinates.
 void initialize(GraphState gs, View3D view, boolean toolTravel)
          initialize a complete new visiting
protected  void visitEnterImpl(java.lang.Object object, boolean asNode, Path path)
          this is just a wrapper when entering a Node, the associated GL20Node will be entered
protected  void visitImpl(java.lang.Object object, boolean asNode, Shader s, Path path)
          this method collect all data from Nodes that have information for displaying
protected  void visitLeaveImpl(java.lang.Object object, boolean asNode, Path path)
          this is just a wrapper when leaving a Node, the associated GL20Node will be leaved
 
Methods inherited from class de.grogra.imp3d.DisplayVisitor
getCurrentShader, init, isInVisibleLayer, resolveShader
 
Methods inherited from class de.grogra.imp3d.Visitor3D
getCurrentTransformation, getGraphState, init, visitEnter, visitEnter, visitInstanceEnter, visitInstanceLeave, visitLeave
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.grogra.imp3d.RenderState
getCurrentShader
 

Constructor Detail

GL20DisplayVisitor

public GL20DisplayVisitor()
Method Detail

drawBox

public void drawBox(float halfWidth,
                    float halfLength,
                    float height,
                    Shader s,
                    int highlight,
                    Matrix4d t)
Specified by:
drawBox in interface RenderState

drawFrustum

public void drawFrustum(float height,
                        float baseRadius,
                        float topRadius,
                        boolean baseClosed,
                        boolean topClosed,
                        float scaleV,
                        Shader s,
                        int highlight,
                        Matrix4d t)
Specified by:
drawFrustum in interface RenderState

drawLine

public void drawLine(Tuple3f start,
                     Tuple3f end,
                     Tuple3f color,
                     int highlight,
                     Matrix4d t)
Specified by:
drawLine in interface RenderState

drawParallelogram

public void drawParallelogram(float axis,
                              Vector3f secondAxis,
                              float scaleU,
                              float scaleV,
                              Shader s,
                              int highlight,
                              Matrix4d t)
Specified by:
drawParallelogram in interface RenderState

drawPlane

public void drawPlane(Shader s,
                      int highlight,
                      Matrix4d t)
Specified by:
drawPlane in interface RenderState

drawPoint

public void drawPoint(Tuple3f location,
                      int pixelSize,
                      Tuple3f color,
                      int highlight,
                      Matrix4d t)
Specified by:
drawPoint in interface RenderState

drawPointCloud

public void drawPointCloud(float[] locations,
                           float pointSize,
                           Tuple3f color,
                           int highlight,
                           Matrix4d t)
Description copied from interface: RenderState
Draw a set of points. The array locations contains a sequence of points given as triples of floats for x, y and z position of each point. If the same reference for the array location is passed in the implementation might assume that the contents of the array are the same as well. This is necessary for GLDisplay, for instance, to ensure a performant implementation. The class PointCloud ensures that this is the case.

Specified by:
drawPointCloud in interface RenderState
Parameters:
locations - array containing a sequence (x,y,z) of points
pointSize - size of the point on screen
color - color of the point
t - transformation of the point cloud

drawPolygons

public void drawPolygons(Polygonizable polygons,
                         java.lang.Object obj,
                         boolean asNode,
                         Shader s,
                         int highlight,
                         Matrix4d t)
Specified by:
drawPolygons in interface RenderState

drawRectangle

public void drawRectangle(int x,
                          int y,
                          int w,
                          int h,
                          Tuple3f color)
Specified by:
drawRectangle in interface RenderState

drawSphere

public void drawSphere(float radius,
                       Shader s,
                       int highlight,
                       Matrix4d t)
Specified by:
drawSphere in interface RenderState

drawString

public void drawString(int x,
                       int y,
                       java.lang.String text,
                       java.awt.Font font,
                       Tuple3f color)
Specified by:
drawString in interface RenderState

drawSupershape

public void drawSupershape(float a,
                           float b,
                           float m1,
                           float n11,
                           float n12,
                           float n13,
                           float m2,
                           float n21,
                           float n22,
                           float n23,
                           Shader sh,
                           int highlight,
                           Matrix4d t)
Description copied from interface: RenderState
Draw a supershape around the origin (0/0/0). An implementation of Johan Gielis's Superformula which was published in the American Journal of Botany 90(3): 333–338. 2003. INVITED SPECIAL PAPER A GENERIC GEOMETRIC TRANSFORMATION THAT UNIFIES A WIDE RANGE OF NATURAL AND ABSTRACT SHAPES

Specified by:
drawSupershape in interface RenderState
t - transformation of the point cloud

estimateScaleAt

public float estimateScaleAt(Tuple3f point)
Specified by:
estimateScaleAt in interface RenderState

fillRectangle

public void fillRectangle(int x,
                          int y,
                          int w,
                          int h,
                          Tuple3f color)
Specified by:
fillRectangle in interface RenderState

getCurrentHighlight

public int getCurrentHighlight()
Specified by:
getCurrentHighlight in interface RenderState

getFontMetrics

public java.awt.FontMetrics getFontMetrics(java.awt.Font font)
Specified by:
getFontMetrics in interface RenderState

getPool

public Pool getPool()
Specified by:
getPool in interface RenderState

getRenderGraphState

public GraphState getRenderGraphState()
Specified by:
getRenderGraphState in interface RenderState

getWindowPos

public boolean getWindowPos(Tuple3f location,
                            Tuple2f out)
Description copied from interface: RenderState
Computes the window coordinates in pixels of a location in the current object coordinates.

Specified by:
getWindowPos in interface RenderState
Parameters:
location - a location in local object coordinates
out - the computed window coordinates are placed in here
Returns:
true iff the window coordinates are valid (i.e., the location is in the clipping region)

initialize

public void initialize(GraphState gs,
                       View3D view,
                       boolean toolTravel)
initialize a complete new visiting

Parameters:
gs - the current GraphState
view -
toolTravel - true - when this run is the tool traveling run

visitEnterImpl

protected void visitEnterImpl(java.lang.Object object,
                              boolean asNode,
                              Path path)
this is just a wrapper when entering a Node, the associated GL20Node will be entered

Overrides:
visitEnterImpl in class DisplayVisitor
Parameters:
object - the object being entered
asNode - is object a node or an edge?
path - the path to object if object is a node, the path to the node where object points to if object is an edge

visitImpl

protected void visitImpl(java.lang.Object object,
                         boolean asNode,
                         Shader s,
                         Path path)
this method collect all data from Nodes that have information for displaying

Specified by:
visitImpl in class DisplayVisitor

visitLeaveImpl

protected void visitLeaveImpl(java.lang.Object object,
                              boolean asNode,
                              Path path)
this is just a wrapper when leaving a Node, the associated GL20Node will be leaved

Overrides:
visitLeaveImpl in class DisplayVisitor
Parameters:
object - the object being left
asNode - is object a node or an edge?
path - the path to object if object is a node, the path to the node where object points to if object is an edge