org.deegree.rendering.r3d.opengl.rendering.dem
Class RenderMeshFragment

java.lang.Object
  extended by org.deegree.rendering.r3d.opengl.rendering.dem.RenderMeshFragment
All Implemented Interfaces:
Comparable<RenderMeshFragment>

public class RenderMeshFragment
extends Object
implements Comparable<RenderMeshFragment>

Encapsulates a MeshFragment of a MultiresolutionMesh that can be rendered via JOGL.

The geometry data of a RenderMeshFragment has one of the following states:

Version:
$Revision: 30126 $
Author:
Markus Schneider, last edited by: $Author: aschmitz $
See Also:
FragmentTexture, MultiresolutionMesh, MeshFragment

Constructor Summary
RenderMeshFragment(MeshFragment fragment)
           
 
Method Summary
 boolean canAllocateEnoughMemory()
           
 int compareTo(RenderMeshFragment o)
           
 void disable(javax.media.opengl.GL gl)
          Disables the fragment in the given OpenGL context and frees the associated VBOs and texture object.
 void enable(javax.media.opengl.GL gl)
          Enables the fragment in the given OpenGL context, so it can be rendered.
 boolean equals(Object other)
           
 float[][] getBBox()
           
 MeshFragmentData getData()
           
 float getGeometricError()
           
 int getId()
           
 float[][] getTrianglePoints()
           
 int hashCode()
          Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast.
 boolean isEnabled()
          Returns whether fragment is ready for rendering (prepared VBOs).
 boolean isLoaded()
          Returns whether the geometry data is available in main memory.
 void load()
          Loads the geometry data into main memory.
 void render(javax.media.opengl.GL gl)
          Render the fragment data.
 void render(javax.media.opengl.GL gl, List<FragmentTexture> textures, ShaderProgram shaderProgram)
          Renders this fragment to the given OpenGL context with given (optional) textures.
 int size()
           
 void unload()
          Removes the geometry data from main memory (and disables it).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RenderMeshFragment

public RenderMeshFragment(MeshFragment fragment)
Parameters:
fragment - a MultiresolutionMesh fragment to create a renderable fragment from.
Method Detail

getId

public int getId()
Returns:
the macro triangle fragment id.

getBBox

public float[][] getBBox()
Returns:
the bbox of the MultiresolutionMesh fragment.

getGeometricError

public float getGeometricError()
Returns:
the geometric error of the MultiresolutionMesh fragment.

getData

public MeshFragmentData getData()
Returns:
the actual data of the MultiresolutionMesh fragment.

isLoaded

public boolean isLoaded()
Returns whether the geometry data is available in main memory.

Returns:
true, if the geometry data is available in main memory, false otherwise

load

public void load()
          throws IOException
Loads the geometry data into main memory.

Throws:
IOException

unload

public void unload()
Removes the geometry data from main memory (and disables it).


isEnabled

public boolean isEnabled()
Returns whether fragment is ready for rendering (prepared VBOs).

Returns:
true, if the fragment is ready to be rendered

enable

public void enable(javax.media.opengl.GL gl)
            throws IOException
Enables the fragment in the given OpenGL context, so it can be rendered.

Parameters:
gl -
Throws:
IOException

disable

public void disable(javax.media.opengl.GL gl)
Disables the fragment in the given OpenGL context and frees the associated VBOs and texture object.

Parameters:
gl -

render

public void render(javax.media.opengl.GL gl)
Render the fragment data.

Parameters:
gl -

render

public void render(javax.media.opengl.GL gl,
                   List<FragmentTexture> textures,
                   ShaderProgram shaderProgram)
Renders this fragment to the given OpenGL context with given (optional) textures.

Parameters:
gl - context to render in.
textures - may be empty, or null
shaderProgram - the shader program containing composite texturing code.
Throws:
RuntimeException - if the geometry data is currently not bound to VBOs

compareTo

public int compareTo(RenderMeshFragment o)
Specified by:
compareTo in interface Comparable<RenderMeshFragment>

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast. It is created from field f as follows:

Combining the hash code(s) computed above: result = 37 * result + code;

Overrides:
hashCode in class Object
Returns:
(int) ( result >>> 32 ) ^ (int) result;
See Also:
Object.hashCode()

size

public int size()
Returns:
size in bytes of this fragment.

canAllocateEnoughMemory

public boolean canAllocateEnoughMemory()
Returns:
true if the used direct buffer pool can allocate enough direct memory for the given data.

getTrianglePoints

public float[][] getTrianglePoints()
Returns:
the vertices of the macro triangle of this Mesh fragment. The returned array will have size [3][2], never null.


Copyright © 2011. All Rights Reserved.