diff --git a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/graphics/glutils/IndexBufferObject.java b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/graphics/glutils/IndexBufferObject.java index e879153329b..23f7f11ca3b 100644 --- a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/graphics/glutils/IndexBufferObject.java +++ b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/graphics/glutils/IndexBufferObject.java @@ -144,12 +144,12 @@ public ShortBuffer getBuffer () { return buffer; } - @Override - public ShortBuffer getBuffer (boolean forWriting) { - isDirty |= forWriting; - return buffer; - } - + @Override + public ShortBuffer getBuffer (boolean forWriting) { + isDirty |= forWriting; + return buffer; + } + /** Binds this IndexBufferObject for rendering with glDrawElements. */ public void bind () { if (bufferHandle == 0) throw new GdxRuntimeException("No buffer allocated!"); diff --git a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/graphics/glutils/VertexBufferObject.java b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/graphics/glutils/VertexBufferObject.java index fddb8ff63f3..33b1fdaa072 100644 --- a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/graphics/glutils/VertexBufferObject.java +++ b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/graphics/glutils/VertexBufferObject.java @@ -96,20 +96,20 @@ public int getNumMaxVertices () { return buffer.capacity() / (attributes.vertexSize / 4); } - /** @deprecated use {@link #getBuffer(boolean)} instead */ + /** @deprecated use {@link #getBuffer(boolean)} instead */ @Override - @Deprecated + @Deprecated public FloatBuffer getBuffer () { isDirty = true; return buffer; } - @Override - public FloatBuffer getBuffer (boolean forWriting) { - isDirty |= forWriting; - return buffer; - } - + @Override + public FloatBuffer getBuffer (boolean forWriting) { + isDirty |= forWriting; + return buffer; + } + private void bufferChanged () { if (isBound) { Gdx.gl20.glBufferData(GL20.GL_ARRAY_BUFFER, buffer.limit(), buffer, usage); diff --git a/extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btIndexedMesh.java b/extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btIndexedMesh.java index 78d02d74886..6554d3619ab 100644 --- a/extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btIndexedMesh.java +++ b/extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btIndexedMesh.java @@ -172,7 +172,8 @@ public void set (final Object tag, final Mesh mesh, int offset, int count) { if (posAttr == null) throw new com.badlogic.gdx.utils.GdxRuntimeException("Mesh doesn't have a position attribute"); - set(tag, mesh.getVerticesBuffer(false), mesh.getVertexSize(), mesh.getNumVertices(), posAttr.offset, mesh.getIndicesBuffer(false), offset, count); + set(tag, mesh.getVerticesBuffer(false), mesh.getVertexSize(), mesh.getNumVertices(), posAttr.offset, + mesh.getIndicesBuffer(false), offset, count); } /** Convenience method to set this btIndexedMesh to the specified vertex and index data. The specified data must be indexed and diff --git a/gdx/src/com/badlogic/gdx/graphics/Mesh.java b/gdx/src/com/badlogic/gdx/graphics/Mesh.java index d6a99edb417..163cdb6796a 100644 --- a/gdx/src/com/badlogic/gdx/graphics/Mesh.java +++ b/gdx/src/com/badlogic/gdx/graphics/Mesh.java @@ -619,7 +619,7 @@ public void render (ShaderProgram shader, int primitiveType, int offset, int cou if (isVertexArray) { if (indices.getNumIndices() > 0) { - ShortBuffer buffer = indices.getBuffer(false); + ShortBuffer buffer = indices.getBuffer(false); int oldPosition = buffer.position(); int oldLimit = buffer.limit(); ((Buffer)buffer).position(offset); @@ -681,15 +681,15 @@ public VertexAttributes getVertexAttributes () { return vertices.getAttributes(); } - /** @return the backing FloatBuffer holding the vertices. Does not have to be a direct buffer on Android! - * @deprecated use {@link #getVerticesBuffer(boolean)} instead */ - @Deprecated + /** @return the backing FloatBuffer holding the vertices. Does not have to be a direct buffer on Android! + * @deprecated use {@link #getVerticesBuffer(boolean)} instead */ + @Deprecated public FloatBuffer getVerticesBuffer () { - return vertices.getBuffer(true); - } - - public FloatBuffer getVerticesBuffer (boolean forWriting) { - return vertices.getBuffer(forWriting); + return vertices.getBuffer(true); + } + + public FloatBuffer getVerticesBuffer (boolean forWriting) { + return vertices.getBuffer(forWriting); } /** Calculates the {@link BoundingBox} of the vertices contained in this mesh. In case no vertices are defined yet a @@ -710,7 +710,7 @@ public void calculateBoundingBox (BoundingBox bbox) { final int numVertices = getNumVertices(); if (numVertices == 0) throw new GdxRuntimeException("No vertices defined"); - final FloatBuffer verts = vertices.getBuffer(false); + final FloatBuffer verts = vertices.getBuffer(false); bbox.inf(); final VertexAttribute posAttrib = getVertexAttribute(Usage.Position); final int offset = posAttrib.offset / 4; @@ -780,8 +780,8 @@ public BoundingBox extendBoundingBox (final BoundingBox out, int offset, int cou if (offset < 0 || count < 1 || offset + count > max) throw new GdxRuntimeException("Invalid part specified ( offset=" + offset + ", count=" + count + ", max=" + max + " )"); - final FloatBuffer verts = vertices.getBuffer(false); - final ShortBuffer index = indices.getBuffer(false); + final FloatBuffer verts = vertices.getBuffer(false); + final ShortBuffer index = indices.getBuffer(false); final VertexAttribute posAttrib = getVertexAttribute(Usage.Position); final int posoff = posAttrib.offset / 4; final int vertexSize = vertices.getAttributes().vertexSize / 4; @@ -855,8 +855,8 @@ public float calculateRadiusSquared (final float centerX, final float centerY, f int numIndices = getNumIndices(); if (offset < 0 || count < 1 || offset + count > numIndices) throw new GdxRuntimeException("Not enough indices"); - final FloatBuffer verts = vertices.getBuffer(false); - final ShortBuffer index = indices.getBuffer(false); + final FloatBuffer verts = vertices.getBuffer(false); + final ShortBuffer index = indices.getBuffer(false); final VertexAttribute posAttrib = getVertexAttribute(Usage.Position); final int posoff = posAttrib.offset / 4; final int vertexSize = vertices.getAttributes().vertexSize / 4; @@ -953,14 +953,14 @@ public float calculateRadius (final Vector3 center) { return calculateRadius(center.x, center.y, center.z, 0, getNumIndices(), null); } - /** @return the backing shortbuffer holding the indices. Does not have to be a direct buffer on Android! - * @deprecated use {@link #getIndicesBuffer(boolean)} instead */ + /** @return the backing shortbuffer holding the indices. Does not have to be a direct buffer on Android! + * @deprecated use {@link #getIndicesBuffer(boolean)} instead */ public ShortBuffer getIndicesBuffer () { - return indices.getBuffer(true); - } - - public ShortBuffer getIndicesBuffer (boolean forWriting) { - return indices.getBuffer(forWriting); + return indices.getBuffer(true); + } + + public ShortBuffer getIndicesBuffer (boolean forWriting) { + return indices.getBuffer(forWriting); } private static void addManagedMesh (Application app, Mesh mesh) { diff --git a/gdx/src/com/badlogic/gdx/graphics/g2d/SpriteCache.java b/gdx/src/com/badlogic/gdx/graphics/g2d/SpriteCache.java index 3833166c142..b8efe50984b 100644 --- a/gdx/src/com/badlogic/gdx/graphics/g2d/SpriteCache.java +++ b/gdx/src/com/badlogic/gdx/graphics/g2d/SpriteCache.java @@ -183,22 +183,22 @@ public void beginCache () { public void beginCache (int cacheID) { if (drawing) throw new IllegalStateException("end must be called before beginCache"); if (currentCache != null) throw new IllegalStateException("endCache must be called before begin."); - Buffer verticesBuffer = (Buffer)mesh.getVerticesBuffer(true); + Buffer verticesBuffer = (Buffer)mesh.getVerticesBuffer(true); if (cacheID == caches.size - 1) { Cache oldCache = caches.removeIndex(cacheID); - verticesBuffer.limit(oldCache.offset); + verticesBuffer.limit(oldCache.offset); beginCache(); return; } currentCache = caches.get(cacheID); - verticesBuffer.position(currentCache.offset); + verticesBuffer.position(currentCache.offset); } /** Ends the definition of a cache, returning the cache ID to be used with {@link #draw(int)}. */ public int endCache () { if (currentCache == null) throw new IllegalStateException("beginCache must be called before endCache."); Cache cache = currentCache; - int cacheCount = mesh.getVerticesBuffer(false).position() - cache.offset; + int cacheCount = mesh.getVerticesBuffer(false).position() - cache.offset; if (cache.textures == null) { // New cache. cache.maxCount = cacheCount; @@ -208,7 +208,7 @@ public int endCache () { for (int i = 0, n = counts.size; i < n; i++) cache.counts[i] = counts.get(i); - ((Buffer) mesh.getVerticesBuffer(true)).flip(); + ((Buffer)mesh.getVerticesBuffer(true)).flip(); } else { // Redefine existing cache. if (cacheCount > cache.maxCount) { @@ -227,7 +227,7 @@ public int endCache () { for (int i = 0, n = cache.textureCount; i < n; i++) cache.counts[i] = counts.get(i); - FloatBuffer vertices = mesh.getVerticesBuffer(true); + FloatBuffer vertices = mesh.getVerticesBuffer(true); ((Buffer)vertices).position(0); Cache lastCache = caches.get(caches.size - 1); ((Buffer)vertices).limit(lastCache.offset + lastCache.maxCount); @@ -243,7 +243,7 @@ public int endCache () { /** Invalidates all cache IDs and resets the SpriteCache so new caches can be added. */ public void clear () { caches.clear(); - ((Buffer) mesh.getVerticesBuffer(true)).clear().flip(); + ((Buffer)mesh.getVerticesBuffer(true)).clear().flip(); } /** Adds the specified vertices to the cache. Each vertex should have 5 elements, one for each of the attributes: x, y, color, @@ -261,7 +261,7 @@ public void add (Texture texture, float[] vertices, int offset, int length) { } else counts.incr(lastIndex, count); - mesh.getVerticesBuffer(true).put(vertices, offset, length); + mesh.getVerticesBuffer(true).put(vertices, offset, length); } /** Adds the specified texture to the cache. */ diff --git a/gdx/src/com/badlogic/gdx/graphics/g3d/Model.java b/gdx/src/com/badlogic/gdx/graphics/g3d/Model.java index cee9b17275a..962faca85b0 100644 --- a/gdx/src/com/badlogic/gdx/graphics/g3d/Model.java +++ b/gdx/src/com/badlogic/gdx/graphics/g3d/Model.java @@ -56,7 +56,7 @@ import com.badlogic.gdx.utils.ObjectMap; import java.nio.Buffer; -import java.nio.ShortBuffer; +import java.nio.ShortBuffer; /** A model represents a 3D assets. It stores a hierarchy of nodes. A node has a transform and optionally a graphical part in form * of a {@link MeshPart} and {@link Material}. Mesh parts reference subsets of vertices in one of the meshes of the model. @@ -248,7 +248,7 @@ protected void convertMesh (ModelMesh modelMesh) { meshes.add(mesh); disposables.add(mesh); - BufferUtils.copy(modelMesh.vertices, mesh.getVerticesBuffer(true), modelMesh.vertices.length, 0); + BufferUtils.copy(modelMesh.vertices, mesh.getVerticesBuffer(true), modelMesh.vertices.length, 0); int offset = 0; ShortBuffer indicesBuffer = mesh.getIndicesBuffer(true); ((Buffer)indicesBuffer).clear(); @@ -260,12 +260,12 @@ protected void convertMesh (ModelMesh modelMesh) { meshPart.size = hasIndices ? part.indices.length : numVertices; meshPart.mesh = mesh; if (hasIndices) { - indicesBuffer.put(part.indices); + indicesBuffer.put(part.indices); } offset += meshPart.size; meshParts.add(meshPart); } - ((Buffer)indicesBuffer).position(0); + ((Buffer)indicesBuffer).position(0); for (MeshPart part : meshParts) part.update(); } diff --git a/gdx/src/com/badlogic/gdx/graphics/glutils/IndexArray.java b/gdx/src/com/badlogic/gdx/graphics/glutils/IndexArray.java index 287bbc8b2e9..4aa1b839714 100644 --- a/gdx/src/com/badlogic/gdx/graphics/glutils/IndexArray.java +++ b/gdx/src/com/badlogic/gdx/graphics/glutils/IndexArray.java @@ -102,11 +102,11 @@ public ShortBuffer getBuffer () { return buffer; } - @Override - public ShortBuffer getBuffer (boolean forWriting) { - return buffer; - } - + @Override + public ShortBuffer getBuffer (boolean forWriting) { + return buffer; + } + /** Binds this IndexArray for rendering with glDrawElements. */ public void bind () { } diff --git a/gdx/src/com/badlogic/gdx/graphics/glutils/IndexBufferObject.java b/gdx/src/com/badlogic/gdx/graphics/glutils/IndexBufferObject.java index d932b50c30e..5a1c4c3e866 100644 --- a/gdx/src/com/badlogic/gdx/graphics/glutils/IndexBufferObject.java +++ b/gdx/src/com/badlogic/gdx/graphics/glutils/IndexBufferObject.java @@ -176,12 +176,12 @@ public ShortBuffer getBuffer () { return buffer; } - @Override - public ShortBuffer getBuffer (boolean forWriting) { - isDirty |= forWriting; - return buffer; - } - + @Override + public ShortBuffer getBuffer (boolean forWriting) { + isDirty |= forWriting; + return buffer; + } + /** Binds this IndexBufferObject for rendering with glDrawElements. */ public void bind () { if (bufferHandle == 0) throw new GdxRuntimeException("No buffer allocated!"); diff --git a/gdx/src/com/badlogic/gdx/graphics/glutils/IndexBufferObjectSubData.java b/gdx/src/com/badlogic/gdx/graphics/glutils/IndexBufferObjectSubData.java index 4bddfe8d4ae..68bbc1cc8eb 100644 --- a/gdx/src/com/badlogic/gdx/graphics/glutils/IndexBufferObjectSubData.java +++ b/gdx/src/com/badlogic/gdx/graphics/glutils/IndexBufferObjectSubData.java @@ -163,12 +163,12 @@ public ShortBuffer getBuffer () { return buffer; } - @Override - public ShortBuffer getBuffer (boolean forWriting) { - isDirty |= forWriting; - return buffer; - } - + @Override + public ShortBuffer getBuffer (boolean forWriting) { + isDirty |= forWriting; + return buffer; + } + /** Binds this IndexBufferObject for rendering with glDrawElements. */ public void bind () { if (bufferHandle == 0) throw new GdxRuntimeException("IndexBufferObject cannot be used after it has been disposed."); diff --git a/gdx/src/com/badlogic/gdx/graphics/glutils/IndexData.java b/gdx/src/com/badlogic/gdx/graphics/glutils/IndexData.java index 3f6a45cffb0..ede9b0bf64c 100644 --- a/gdx/src/com/badlogic/gdx/graphics/glutils/IndexData.java +++ b/gdx/src/com/badlogic/gdx/graphics/glutils/IndexData.java @@ -60,8 +60,8 @@ public interface IndexData extends Disposable { /** *

- * Returns the underlying ShortBuffer. If you modify the buffer contents they will be uploaded on the next call to {@link #bind()}. - * If you need immediate uploading use {@link #setIndices(short[], int, int)}. + * Returns the underlying ShortBuffer. If you modify the buffer contents they will be uploaded on the next call to + * {@link #bind()}. If you need immediate uploading use {@link #setIndices(short[], int, int)}. *

* * @return the underlying short buffer. diff --git a/gdx/src/com/badlogic/gdx/graphics/glutils/VertexArray.java b/gdx/src/com/badlogic/gdx/graphics/glutils/VertexArray.java index 635130e8821..44725b6d107 100644 --- a/gdx/src/com/badlogic/gdx/graphics/glutils/VertexArray.java +++ b/gdx/src/com/badlogic/gdx/graphics/glutils/VertexArray.java @@ -67,19 +67,19 @@ public void dispose () { BufferUtils.disposeUnsafeByteBuffer(byteBuffer); } - /** @deprecated use {@link #getBuffer(boolean)} instead */ + /** @deprecated use {@link #getBuffer(boolean)} instead */ @Override - @Deprecated + @Deprecated public FloatBuffer getBuffer () { return buffer; } @Override - public FloatBuffer getBuffer (boolean forWriting) { - return buffer; - } - - @Override + public FloatBuffer getBuffer (boolean forWriting) { + return buffer; + } + + @Override public int getNumVertices () { return buffer.limit() * 4 / attributes.vertexSize; } diff --git a/gdx/src/com/badlogic/gdx/graphics/glutils/VertexBufferObject.java b/gdx/src/com/badlogic/gdx/graphics/glutils/VertexBufferObject.java index da4880abdcc..30ba6cba83f 100644 --- a/gdx/src/com/badlogic/gdx/graphics/glutils/VertexBufferObject.java +++ b/gdx/src/com/badlogic/gdx/graphics/glutils/VertexBufferObject.java @@ -94,20 +94,20 @@ public int getNumMaxVertices () { return byteBuffer.capacity() / attributes.vertexSize; } - /** @deprecated use {@link #getBuffer(boolean)} instead */ + /** @deprecated use {@link #getBuffer(boolean)} instead */ @Override - @Deprecated + @Deprecated public FloatBuffer getBuffer () { isDirty = true; return buffer; } - @Override - public FloatBuffer getBuffer (boolean forWriting) { - isDirty |= forWriting; - return buffer; - } - + @Override + public FloatBuffer getBuffer (boolean forWriting) { + isDirty |= forWriting; + return buffer; + } + /** Low level method to reset the buffer and attributes to the specified values. Use with care! * @param data * @param ownsBuffer diff --git a/gdx/src/com/badlogic/gdx/graphics/glutils/VertexBufferObjectSubData.java b/gdx/src/com/badlogic/gdx/graphics/glutils/VertexBufferObjectSubData.java index b1bfb89254b..44ab1755158 100644 --- a/gdx/src/com/badlogic/gdx/graphics/glutils/VertexBufferObjectSubData.java +++ b/gdx/src/com/badlogic/gdx/graphics/glutils/VertexBufferObjectSubData.java @@ -100,20 +100,20 @@ public int getNumMaxVertices () { return byteBuffer.capacity() / attributes.vertexSize; } - /** @deprecated use {@link #getBuffer(boolean)} instead */ + /** @deprecated use {@link #getBuffer(boolean)} instead */ @Override - @Deprecated + @Deprecated public FloatBuffer getBuffer () { isDirty = true; return buffer; } - @Override - public FloatBuffer getBuffer (boolean forWriting) { - isDirty |= forWriting; - return buffer; - } - + @Override + public FloatBuffer getBuffer (boolean forWriting) { + isDirty |= forWriting; + return buffer; + } + private void bufferChanged () { if (isBound) { Gdx.gl20.glBufferSubData(GL20.GL_ARRAY_BUFFER, 0, byteBuffer.limit(), byteBuffer); diff --git a/tests/gdx-tests/src/com/badlogic/gdx/tests/VBOWithVAOPerformanceTest.java b/tests/gdx-tests/src/com/badlogic/gdx/tests/VBOWithVAOPerformanceTest.java index 72142d0e880..585aae0f6d6 100644 --- a/tests/gdx-tests/src/com/badlogic/gdx/tests/VBOWithVAOPerformanceTest.java +++ b/tests/gdx-tests/src/com/badlogic/gdx/tests/VBOWithVAOPerformanceTest.java @@ -352,7 +352,7 @@ public FloatBuffer getBuffer () { isDirty = true; return buffer; } - + @Override public FloatBuffer getBuffer (boolean forWriting) { isDirty |= forWriting; diff --git a/tests/gdx-tests/src/com/badlogic/gdx/tests/VertexBufferObjectShaderTest.java b/tests/gdx-tests/src/com/badlogic/gdx/tests/VertexBufferObjectShaderTest.java index 056f697aeed..f56ddeffb4d 100644 --- a/tests/gdx-tests/src/com/badlogic/gdx/tests/VertexBufferObjectShaderTest.java +++ b/tests/gdx-tests/src/com/badlogic/gdx/tests/VertexBufferObjectShaderTest.java @@ -55,7 +55,7 @@ public void render () { texture.bind(); vbo.bind(shader); indices.bind(); - gl.glDrawElements(GL20.GL_TRIANGLES, 3, GL20.GL_UNSIGNED_SHORT, indices.getBuffer(false).position()); + gl.glDrawElements(GL20.GL_TRIANGLES, 3, GL20.GL_UNSIGNED_SHORT, indices.getBuffer(false).position()); indices.unbind(); vbo.unbind(shader); }