/** * Change a specific subset of the buffer's data at the given offset to the given length. * * @param bufferInfo * @param newData * @param index */ public void changeBufferData(BufferInfo bufferInfo, Buffer newData, int index) { this.changeBufferData(bufferInfo, newData, index, false); }
/** * Change a specific subset of the buffer's data at the given offset to the given length. * * @param bufferInfo * @param newData * @param index * @param size */ public void changeBufferData(BufferInfo bufferInfo, Buffer newData, int index, int size) { this.changeBufferData(bufferInfo, newData, index, size, false); }
/** * Change a specific subset of the buffer's data at the given offset to the given length. * * @param bufferInfo * @param newData * @param index * @param resizeBuffer */ public void changeBufferData(BufferInfo bufferInfo, Buffer newData, int index, boolean resizeBuffer) { changeBufferData(bufferInfo, newData, index, newData.capacity(), resizeBuffer); }
/** * Maps the (x,y) coordinates of <code>tileName</code> in <code>atlas</code> * to the TextureCoordinates of this BaseObject3D * * Saves a copy of the original TextureCoordinates in case of future mapping. * * @param tileName * @param atlas */ public void setAtlasTile(String tileName, TextureAtlas atlas) { Tile tile = atlas.getTileNamed(tileName); if(mOriginalTextureCoords == null) { mOriginalTextureCoords = this.getGeometry().getTextureCoords().duplicate(); } FloatBuffer fb = FloatBuffer.allocate(mOriginalTextureCoords.capacity()); for (int i = 0; i < fb.capacity(); i++) { double uvIn = mOriginalTextureCoords.get(i); double uvOut; if (i % 2 == 0) { uvOut = (uvIn * (tile.width / atlas.getWidth())) + tile.x / atlas.getWidth(); } else { uvOut = (uvIn * (tile.height / atlas.getHeight())) + tile.y / atlas.getHeight(); } fb.put(i, (float) uvOut); } mGeometry.changeBufferData(mGeometry.getTexCoordBufferInfo(), fb, 0); }
addVertexToBuffer(b, index++, mFrustumCornersTransformed[4]); mGeometry.changeBufferData( mGeometry.getVertexBufferInfo(), mGeometry.getVertices(), 0);
private void updateBox(BoundingBox bb) { FloatBuffer b = mGeometry.getVertices(); int index = 0; bb.copyPoints(mBBoxVertices); addVertexToBuffer(b, index++, mBBoxVertices[0]); addVertexToBuffer(b, index++, mBBoxVertices[1]); addVertexToBuffer(b, index++, mBBoxVertices[2]); addVertexToBuffer(b, index++, mBBoxVertices[3]); addVertexToBuffer(b, index++, mBBoxVertices[0]); addVertexToBuffer(b, index++, mBBoxVertices[4]); addVertexToBuffer(b, index++, mBBoxVertices[5]); addVertexToBuffer(b, index++, mBBoxVertices[1]); addVertexToBuffer(b, index++, mBBoxVertices[5]); addVertexToBuffer(b, index++, mBBoxVertices[6]); addVertexToBuffer(b, index++, mBBoxVertices[2]); addVertexToBuffer(b, index++, mBBoxVertices[6]); addVertexToBuffer(b, index++, mBBoxVertices[7]); addVertexToBuffer(b, index++, mBBoxVertices[3]); addVertexToBuffer(b, index++, mBBoxVertices[7]); addVertexToBuffer(b, index++, mBBoxVertices[4]); mGeometry.changeBufferData( mGeometry.getVertexBufferInfo(), mGeometry.getVertices(), 0); }
mGeometry.changeBufferData(mBoneMatricesBufferInfo, mBoneMatrices, 0);
/** * Change a specific subset of the buffer's data at the given offset to the given length. * * @param bufferInfo * @param newData * @param index */ public void changeBufferData(BufferInfo bufferInfo, Buffer newData, int index) { this.changeBufferData(bufferInfo, newData, index, false); }
/** * Change a specific subset of the buffer's data at the given offset to the given length. * * @param bufferInfo * @param newData * @param index * @param size */ public void changeBufferData(BufferInfo bufferInfo, Buffer newData, int index, int size) { this.changeBufferData(bufferInfo, newData, index, size, false); }
/** * Change a specific subset of the buffer's data at the given offset to the given length. * * @param bufferInfo * @param newData * @param index * @param size * @param resizeBuffer */ public void changeBufferData(BufferInfo bufferInfo, Buffer newData, int index, boolean resizeBuffer) { changeBufferData(bufferInfo, newData, index, newData.capacity(), resizeBuffer); }
/** * Maps the (x,y) coordinates of <code>tileName</code> in <code>atlas</code> * to the TextureCoordinates of this BaseObject3D * * @param tileName * @param atlas */ public void setAtlasTile(String tileName, TextureAtlas atlas) { Tile tile = atlas.getTileNamed(tileName); FloatBuffer fb = this.getGeometry().getTextureCoords(); for (int i = 0; i < fb.capacity(); i++) { double uvIn = fb.get(i); double uvOut; if (i % 2 == 0) uvOut = (uvIn * (tile.width / atlas.getWidth())) + tile.x / atlas.getWidth(); else uvOut = (uvIn * (tile.height / atlas.getHeight())) + tile.y / atlas.getHeight(); fb.put(i, (float) uvOut); } mGeometry.changeBufferData(mGeometry.mTexCoordBufferInfo, fb, 0); }
addVertexToBuffer(b, index++, mFrustumCornersTransformed[4]); mGeometry.changeBufferData( mGeometry.getVertexBufferInfo(), mGeometry.getVertices(), 0);
mGeometry.changeBufferData(mBoneMatricesBufferInfo, mBoneMatrices, 0);