org.deegree.rendering.r3d.opengl.rendering.model.geometry
Class DirectGeometryBuffer

java.lang.Object
  extended by org.deegree.rendering.r3d.opengl.rendering.model.geometry.DirectGeometryBuffer

public class DirectGeometryBuffer
extends Object

The DirectGeometryBuffer encapsulates the directbuffers (coordinate, normals and texture) for all buildings defined in a scene.

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

Constructor Summary
DirectGeometryBuffer(int coordinateCapacity, int textureCapacity)
           
 
Method Summary
 int addCoordinates(FloatBuffer coordBuffer)
          Add the given FloatBuffer to the direct coordinates buffer, if the direct coordinate buffer does not have the capacity this method will return -1;
 int addNormals(FloatBuffer normalBuffer)
          Add the given FloatBuffer to the direct coordinates buffer, if the direct normal buffer does not have the capacity this method will return -1;
 int addTexture(FloatBuffer textureBuffer)
          Add the given FloatBuffer to the direct texture buffer, if the direct texture buffer does not have the capacity this method will return -1;
 FloatBuffer getCoords(int position, int limit)
           
 FloatBuffer getNormals(int position, int limit)
           
 FloatBuffer getTextureCoordinates(int position, int limit)
           
 int[] readCoordinates(DataInputStream in)
          Read the floats from the given DataInputStream to the direct coordinates buffer, if the direct coordinate buffer does not have the capacity this method will return -1,-1;
 int readCoordsFromStream(ObjectInputStream in)
          Add the floats read from the given ObjectInputStream to the direct coordinate FloatBuffer, if the direct coordinate buffer does not have the capacity this method will return -1.
 int[] readNormals(DataInputStream in)
          Read the floats from the given DataInputStream to the direct normal buffer, if the direct normal buffer does not have the capacity this method will return -1,-1;
 int readNormalsFromStream(ObjectInputStream in)
          Add the floats read from the given ObjectInputStream to the direct normal FloatBuffer, if the direct normal buffer does not have the capacity this method will return -1.
 int readTexCoordsFromStream(ObjectInputStream in)
          Add the floats read from the given ObjectInputStream to the direct texture FloatBuffer, if the direct texture buffer does not have the capacity this method will return -1.
 int[] readTextureOrdinates(DataInputStream in)
          Read the floats from the given DataInputStream to the direct texture buffer, if the direct texture buffer does not have the capacity this method will return -1,-1;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectGeometryBuffer

public DirectGeometryBuffer(int coordinateCapacity,
                            int textureCapacity)
Parameters:
coordinateCapacity -
textureCapacity -
Method Detail

getCoords

public FloatBuffer getCoords(int position,
                             int limit)
Parameters:
position - in the coordinates buffer.
limit - the number of ordinates to copy
Returns:
a copy of the direct coordinate floatbuffer, or null if the position /limit is out of range.

getNormals

public FloatBuffer getNormals(int position,
                              int limit)
Parameters:
position - in the normal buffer.
limit - the number of ordinates to copy
Returns:
a copy of the direct normal floatbuffer, or null if the position /limit is out of range.

getTextureCoordinates

public FloatBuffer getTextureCoordinates(int position,
                                         int limit)
Parameters:
position - in the texture buffer.
limit - the number of ordinates to copy
Returns:
a copy of the direct texture floatbuffer, or null if the position/limit is out of range.

addCoordinates

public int addCoordinates(FloatBuffer coordBuffer)
Add the given FloatBuffer to the direct coordinates buffer, if the direct coordinate buffer does not have the capacity this method will return -1;

Parameters:
coordBuffer - to add to the coordinates direct buffer.
Returns:
the position of the copy in the coordinate buffer or -1 if the given buffer could not be copied in the direct buffer.

addNormals

public int addNormals(FloatBuffer normalBuffer)
Add the given FloatBuffer to the direct coordinates buffer, if the direct normal buffer does not have the capacity this method will return -1;

Parameters:
normalBuffer - to add to the normal direct buffer.
Returns:
the position of the copy in the coordinate buffer or -1 if the given buffer could not be copied in the direct buffer.

addTexture

public int addTexture(FloatBuffer textureBuffer)
Add the given FloatBuffer to the direct texture buffer, if the direct texture buffer does not have the capacity this method will return -1;

Parameters:
textureBuffer - to add to the texture direct buffer.
Returns:
the position of the copy in the texture buffer or -1 if the given buffer could not be copied in the direct buffer.

readCoordinates

public int[] readCoordinates(DataInputStream in)
                      throws IOException
Read the floats from the given DataInputStream to the direct coordinates buffer, if the direct coordinate buffer does not have the capacity this method will return -1,-1;

Parameters:
in - the stream to add to the coordinates from.
Returns:
the position [0] of the copy in the coordinate buffer and the number of ordinates [1] inserted. Both will have -1 if the given ordinates could not be copied in the direct buffer.
Throws:
IOException

readNormals

public int[] readNormals(DataInputStream in)
                  throws IOException
Read the floats from the given DataInputStream to the direct normal buffer, if the direct normal buffer does not have the capacity this method will return -1,-1;

Parameters:
in - the stream to add to the coordinates from.
Returns:
the position [0] of the copy in the normal buffer and the number of ordinates [1] inserted. Both will have -1 if the given ordinates could not be copied in the direct buffer.
Throws:
IOException

readTextureOrdinates

public int[] readTextureOrdinates(DataInputStream in)
                           throws IOException
Read the floats from the given DataInputStream to the direct texture buffer, if the direct texture buffer does not have the capacity this method will return -1,-1;

Parameters:
in - the stream to add to the coordinates from.
Returns:
the position [0] of the copy in the texture buffer and the number of ordinates [1] inserted. Both will have -1 if the given ordinates could not be copied in the direct buffer.
Throws:
IOException

readCoordsFromStream

public int readCoordsFromStream(ObjectInputStream in)
                         throws IOException
Add the floats read from the given ObjectInputStream to the direct coordinate FloatBuffer, if the direct coordinate buffer does not have the capacity this method will return -1. This method assumes that the stream is positioned so, that the next value is an int, declaring the size of the number of floats to be read.

Parameters:
in - the stream to get the floats from.
Returns:
the position of the copy in the texture buffer or -1 if the given buffer could not be copied in the direct buffer.
Throws:
IOException - if the stream throws this exception while reading.

readNormalsFromStream

public int readNormalsFromStream(ObjectInputStream in)
                          throws IOException
Add the floats read from the given ObjectInputStream to the direct normal FloatBuffer, if the direct normal buffer does not have the capacity this method will return -1. This method assumes that the stream is positioned so, that the next value is an int, declaring the size of the number of floats to be read.

Parameters:
in - the stream to get the floats from.
Returns:
the position of the copy in the normal buffer or -1 if the given buffer could not be copied in the direct buffer.
Throws:
IOException - if the stream throws this exception while reading.

readTexCoordsFromStream

public int readTexCoordsFromStream(ObjectInputStream in)
                            throws IOException
Add the floats read from the given ObjectInputStream to the direct texture FloatBuffer, if the direct texture buffer does not have the capacity this method will return -1. This method assumes that the stream is positioned so, that the next value is an int, declaring the size of the number of floats to be read.

Parameters:
in - the stream to get the floats from.
Returns:
the position of the copy in the texture buffer or -1 if the given buffer could not be copied in the direct buffer.
Throws:
IOException - if the stream throws this exception while reading.


Copyright © 2011. All Rights Reserved.