/** * Add the given {@link FloatBuffer} to the direct coordinates buffer, if the direct coordinate buffer does not have * the capacity this method will return -1; * * @param coordBuffer * to add to the coordinates direct buffer. * @return the position of the copy in the coordinate buffer or -1 if the given buffer could not be copied in the * direct buffer. */ public synchronized int addCoordinates( FloatBuffer coordBuffer ) { return addBuffer( this.coordBuffer, coordBuffer ); }
/** * @param vertices * the vertices to set * @param openGLType */ public final void setVertices( float[] vertices, int openGLType ) { vertexCount = loadVertexBuffer( vertices ); this.openGLType = openGLType; }
/** * @return the insertedOrdinates */ public final int getInsertedOrdinates() { if ( insertedOrdinates == 0 ) { if ( data instanceof WorldRenderableObject ) { insertedOrdinates = ( (WorldRenderableObject) data ).getOrdinateCount(); } } return insertedOrdinates; }
/** * This method assumes the coordinates and normals are located in the given {@link DirectGeometryBuffer}. * * @param glRenderContext * @param geomBuffer * to be get the coordinates from. */ public void renderPrepared( RenderContext glRenderContext, DirectGeometryBuffer geomBuffer ) { render( glRenderContext, calcQualityLevel( glRenderContext ), geomBuffer ); }
/** * @return the number of ordinates in all qualitylevels, needed for the initialization of the direct buffer. */ public int getOrdinateCount() { int result = 0; if ( qualityLevels != null ) { for ( RenderableQualityModel model : qualityLevels ) { if ( model != null ) { result += model.getOrdinateCount(); } } } return result; }
/** * @return the number of ordinates in all qualitylevels, needed for the initialization of the direct buffer. */ public int getTextureOrdinateCount() { int result = 0; if ( qualityLevels != null ) { for ( RenderableQualityModel model : qualityLevels ) { if ( model != null ) { result += model.getTextureOrdinateCount(); } } } return result; }
/** * @param vertices * @param openGLType * @param vertexNormals * @param style * @param useDirectBuffers * to use direct buffers instead of heap buffers. */ public RenderableGeometry( float[] vertices, int openGLType, float[] vertexNormals, SimpleGeometryStyle style, boolean useDirectBuffers ) { this( openGLType, style, useDirectBuffers ); this.vertexCount = loadVertexBuffer( vertices ); vertices = null; setVertexNormals( vertexNormals ); coordPosition = -1; normalPosition = -1; }
/** * Read the floats from the given {@link DataInputStream} to the direct coordinates buffer, if the direct coordinate * buffer does not have the capacity this method will return -1,-1; * * @param in * the stream to add to the coordinates from. * @return 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 */ public synchronized int[] readCoordinates( DataInputStream in ) throws IOException { return readFromStreamBuffer( this.coordBuffer, in ); }
/** * @param textureCoordinates * the textureCoordinates to set */ public final void setTextureCoordinates( float[] textureCoordinates ) { loadTextureCoordinates( textureCoordinates ); }
/** * @return the insertedTextureOrdinates */ public final int getInsertedTextureOrdinates() { if ( insertedTextureOrdinates == 0 ) { if ( data instanceof WorldRenderableObject ) { insertedTextureOrdinates = ( (WorldRenderableObject) data ).getTextureOrdinateCount(); } } return insertedTextureOrdinates; }
@Override protected void enableArrays( RenderContext glRenderContext, DirectGeometryBuffer geomBuffer ) { super.disableArrays( glRenderContext ); }
@Override public void render( RenderContext glRenderContext ) { this.renderPrepared( glRenderContext, null ); }
@Override public void render( RenderContext glRenderContext ) { this.renderPrepared( glRenderContext, null ); }
/** * Add the floats read from the given {@link ObjectInputStream} to the direct texture {@link 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. * * @param in * the stream to get the floats from. * @return 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. */ public synchronized int readTexCoordsFromStream( ObjectInputStream in ) throws IOException { return addFromStream( textureBuffer, in ); }
@Override public void render( RenderContext glRenderContext ) { render( glRenderContext, calcQualityLevel( glRenderContext ), null ); }
/** * Add the given {@link FloatBuffer} to the direct coordinates buffer, if the direct normal buffer does not have the * capacity this method will return -1; * * @param normalBuffer * to add to the normal direct buffer. * @return the position of the copy in the coordinate buffer or -1 if the given buffer could not be copied in the * direct buffer. */ public synchronized int addNormals( FloatBuffer normalBuffer ) { return addBuffer( this.normalBuffer, normalBuffer ); }
/** * Read the floats from the given {@link DataInputStream} to the direct normal buffer, if the direct normal buffer * does not have the capacity this method will return -1,-1; * * @param in * the stream to add to the coordinates from. * @return 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 */ public synchronized int[] readNormals( DataInputStream in ) throws IOException { return readFromStreamBuffer( this.normalBuffer, in ); }
/** * * @param vertices * @param openGLType * @param vertexNormals * @param texture * @param textureCoordinates * @param useDirectBuffers * to use direct buffers instead of heap buffers. */ public RenderableTexturedGeometry( float[] vertices, int openGLType, float[] vertexNormals, String texture, float[] textureCoordinates, boolean useDirectBuffers ) { super( vertices, openGLType, vertexNormals, useDirectBuffers ); this.texture = texture; loadTextureCoordinates( textureCoordinates ); }
/** * Add the given {@link FloatBuffer} to the direct texture buffer, if the direct texture buffer does not have the * capacity this method will return -1; * * @param textureBuffer * to add to the texture direct buffer. * @return the position of the copy in the texture buffer or -1 if the given buffer could not be copied in the * direct buffer. */ public synchronized int addTexture( FloatBuffer textureBuffer ) { return addBuffer( this.textureBuffer, textureBuffer ); }
/** * Read the floats from the given {@link DataInputStream} to the direct texture buffer, if the direct texture buffer * does not have the capacity this method will return -1,-1; * * @param in * the stream to add to the coordinates from. * @return 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 */ public synchronized int[] readTextureOrdinates( DataInputStream in ) throws IOException { return readFromStreamBuffer( this.textureBuffer, in ); }