org.deegree.rendering.r3d.opengl.tesselation
Class GeometryCallBack

java.lang.Object
  extended by javax.media.opengl.glu.GLUtessellatorCallbackAdapter
      extended by org.deegree.rendering.r3d.opengl.tesselation.GeometryCallBack
All Implemented Interfaces:
javax.media.opengl.glu.GLUtessellatorCallback
Direct Known Subclasses:
TexturedGeometryCallBack

public class GeometryCallBack
extends javax.media.opengl.glu.GLUtessellatorCallbackAdapter

The GeometryCallBack class will be called by the Tesselator if a SimpleAccessGeometry must be triangulated. This class will calculate the normals from the resulting vertices as well.

Version:
$Revision: 30126 $, $Date: 2011-03-22 11:11:00 +0100 (Tue, 22 Mar 2011) $
Author:
Rutger Bezema, last edited by: $Author: aschmitz $

Method Summary
 void addVertex(Vertex vertex)
           
 void begin(int openGLType)
           
protected  float[] calculateNormals()
          Calculate the normals according to the openGL type.
 void combineData(double[] coords, Object[] coordinateData, float[] weights, Object[] outData, Object originalVertex)
           
 Vertex createNewVertex(int currentVertexLocation)
          Create a vertex appropriate for the tesselation of the given type of geometry.
 RenderableGeometry createRenderableGeometry(boolean useDirectBuffers)
          Calculate the normals for the tesselated geometry and return a renderable geometry created from the given SimpleAccessGeometry
 void edgeFlagData(boolean arg0, Object originalVertex)
           
 void end()
           
 void errorData(int arg0, Object originalVertex)
           
 SimpleAccessGeometry getGeometry()
           
 int getOpenGLType()
           
protected  float[] getTesselatedCoordinates()
           
 List<Vertex> getTesselatedVertices()
           
 void vertexData(Object newVertex, Object originalVertex)
           
 
Methods inherited from class javax.media.opengl.glu.GLUtessellatorCallbackAdapter
beginData, combine, edgeFlag, endData, error, vertex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

begin

public void begin(int openGLType)
Specified by:
begin in interface javax.media.opengl.glu.GLUtessellatorCallback
Overrides:
begin in class javax.media.opengl.glu.GLUtessellatorCallbackAdapter

end

public void end()
Specified by:
end in interface javax.media.opengl.glu.GLUtessellatorCallback
Overrides:
end in class javax.media.opengl.glu.GLUtessellatorCallbackAdapter

errorData

public void errorData(int arg0,
                      Object originalVertex)
Specified by:
errorData in interface javax.media.opengl.glu.GLUtessellatorCallback
Overrides:
errorData in class javax.media.opengl.glu.GLUtessellatorCallbackAdapter

combineData

public void combineData(double[] coords,
                        Object[] coordinateData,
                        float[] weights,
                        Object[] outData,
                        Object originalVertex)
Specified by:
combineData in interface javax.media.opengl.glu.GLUtessellatorCallback
Overrides:
combineData in class javax.media.opengl.glu.GLUtessellatorCallbackAdapter

edgeFlagData

public void edgeFlagData(boolean arg0,
                         Object originalVertex)
Specified by:
edgeFlagData in interface javax.media.opengl.glu.GLUtessellatorCallback
Overrides:
edgeFlagData in class javax.media.opengl.glu.GLUtessellatorCallbackAdapter

vertexData

public void vertexData(Object newVertex,
                       Object originalVertex)
Specified by:
vertexData in interface javax.media.opengl.glu.GLUtessellatorCallback
Overrides:
vertexData in class javax.media.opengl.glu.GLUtessellatorCallbackAdapter

getTesselatedVertices

public List<Vertex> getTesselatedVertices()
Returns:
the vertices of the tesselated geometry

addVertex

public void addVertex(Vertex vertex)
Parameters:
vertex -

getGeometry

public final SimpleAccessGeometry getGeometry()
Returns:
the geometry object currently tesselated

createNewVertex

public Vertex createNewVertex(int currentVertexLocation)
Create a vertex appropriate for the tesselation of the given type of geometry.

Parameters:
currentVertexLocation - of the coordinates (the Vertex count)
Returns:
the vertex used for the tesselation process.

createRenderableGeometry

public RenderableGeometry createRenderableGeometry(boolean useDirectBuffers)
Calculate the normals for the tesselated geometry and return a renderable geometry created from the given SimpleAccessGeometry

Parameters:
useDirectBuffers - to use direct buffers instead of heap buffers.
Returns:
the tesselated SimpleAccessGeometry as a RenderableGeometry

getTesselatedCoordinates

protected float[] getTesselatedCoordinates()
Returns:
the coordinates of the vertices created by the tesselation process.

calculateNormals

protected float[] calculateNormals()
Calculate the normals according to the openGL type.

Returns:
the normals appropriate for the openGL type.

getOpenGLType

public final int getOpenGLType()
Returns:
the openGLType


Copyright © 2011. All Rights Reserved.