/** * Gets the color buffer. * * @return the color buffer */ public FloatBuffer getColorBuffer() { if (_colorCoords == null) { return null; } return _colorCoords.getBuffer(); }
/** * Gets the tangent buffer. * * @return the tangent buffer */ public FloatBuffer getTangentBuffer() { if (_tangentCoords == null) { return null; } return _tangentCoords.getBuffer(); }
/** * Retrieves the interleaved buffer, if set or created through packInterleaved. * * @return the interleaved buffer */ public FloatBuffer getInterleavedBuffer() { if (_interleaved == null) { return null; } return _interleaved.getBuffer(); }
/** * Gets the vertex buffer. * * @return the vertex buffer */ public FloatBuffer getVertexBuffer() { if (_vertexCoords == null) { return null; } return _vertexCoords.getBuffer(); }
/** * Gets the normal buffer. * * @return the normal buffer */ public FloatBuffer getNormalBuffer() { if (_normalCoords == null) { return null; } return _normalCoords.getBuffer(); }
/** * Gets the fog buffer. * * @return the fog buffer */ public FloatBuffer getFogBuffer() { if (_fogCoords == null) { return null; } return _fogCoords.getBuffer(); }
@Override public boolean hasData() { return data != null && data.getBuffer() != null; }
/** * Translate points. * * @param amount * the amount */ public void translatePoints(final Vector3 amount) { for (int x = 0; x < _vertexCount; x++) { BufferUtils.addInBuffer(amount, _vertexCoords.getBuffer(), x); } }
private void setTextureData() { _meshData.getTextureCoords(0).getBuffer().put(0.25f).put(0); _meshData.getTextureCoords(0).getBuffer().put(0.75f).put(0); _meshData.getTextureCoords(0).getBuffer().put(1.0f).put(0.5f); _meshData.getTextureCoords(0).getBuffer().put(0.75f).put(1.0f); _meshData.getTextureCoords(0).getBuffer().put(0.25f).put(1.0f); _meshData.getTextureCoords(0).getBuffer().put(0.0f).put(0.5f); _meshData.getTextureCoords(0).getBuffer().put(0.5f).put(0.5f); }
private void setTextureData() { _meshData.getTextureCoords(0).getBuffer().put(0.25f).put(0); _meshData.getTextureCoords(0).getBuffer().put(0.75f).put(0); _meshData.getTextureCoords(0).getBuffer().put(1.0f).put(0.5f); _meshData.getTextureCoords(0).getBuffer().put(0.75f).put(1.0f); _meshData.getTextureCoords(0).getBuffer().put(0.25f).put(1.0f); _meshData.getTextureCoords(0).getBuffer().put(0.0f).put(0.5f); _meshData.getTextureCoords(0).getBuffer().put(0.5f).put(0.5f); }
private void remap() { final FloatBuffer fb = _meshData.getTextureCoords(0).getBuffer(); fb.rewind(); for (int i = 0; i < 6; i++) { final float bottom = i / 8f; final float top = (i + 1) / 8f; final float[] tex = new float[] { 1, bottom, 0, bottom, 0, top, 1, top }; fb.put(tex); } } }
private void remap() { final FloatBuffer fb = _meshData.getTextureCoords(0).getBuffer(); fb.rewind(); for (int i = 0; i < 6; i++) { final float bottom = i / 8f; final float top = (i + 1) / 8f; final float[] tex = new float[] { 1, bottom, 0, bottom, 0, top, 1, top }; fb.put(tex); } } }
public void transformVertices(final Transform transform) { final Vector3 store = new Vector3(); for (int x = 0; x < _vertexCount; x++) { BufferUtils.populateFromBuffer(store, _vertexCoords.getBuffer(), x); transform.applyForward(store, store); BufferUtils.setInBuffer(store, _vertexCoords.getBuffer(), x); } }
private void addNormal(final Md2GlCommand cmd, final Md2Frame frame, final int normalIndex, final FloatBufferData norms) { final int index = cmd.vertIndices[normalIndex]; final byte[] vertData = frame.vertData; Md2Normals.getNormalVector(vertData[index * 4 + 3], calcVert); norms.getBuffer().put(calcVert.getXf()).put(calcVert.getYf()).put(calcVert.getZf()); }
public void transformNormals(final Transform transform, final boolean normalize) { final Vector3 store = new Vector3(); for (int x = 0; x < _vertexCount; x++) { BufferUtils.populateFromBuffer(store, _normalCoords.getBuffer(), x); transform.applyForwardVector(store, store); if (normalize) { store.normalizeLocal(); } BufferUtils.setInBuffer(store, _normalCoords.getBuffer(), x); } }
private void addVert(final Md2GlCommand cmd, final Md2Frame frame, final int vertIndex, final FloatBufferData verts) { final int index = cmd.vertIndices[vertIndex]; final byte[] vertData = frame.vertData; calcVert.set(vertData[index * 4 + 0] & 0xFF, vertData[index * 4 + 1] & 0xFF, vertData[index * 4 + 2] & 0xFF); calcVert.multiplyLocal(frame.scale).addLocal(frame.translate); verts.getBuffer().put(calcVert.getXf()).put(calcVert.getYf()).put(calcVert.getZf()); }
public void setupNormalData(final FloatBufferData normalBufferData) { final FloatBuffer normalBuffer = normalBufferData != null ? normalBufferData.getBuffer() : null; if (normalBuffer == null) { GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); } else { GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); normalBuffer.rewind(); GL11.glNormalPointer(0, normalBuffer); } }
public void setupFogData(final FloatBufferData fogBufferData) { final FloatBuffer fogBuffer = fogBufferData != null ? fogBufferData.getBuffer() : null; if (fogBuffer == null) { GL11.glDisableClientState(EXTFogCoord.GL_FOG_COORDINATE_ARRAY_EXT); } else { GL11.glEnableClientState(EXTFogCoord.GL_FOG_COORDINATE_ARRAY_EXT); fogBuffer.rewind(); EXTFogCoord.glFogCoordPointerEXT(0, fogBuffer); } }
public void setupColorData(final FloatBufferData colorBufferData) { final FloatBuffer colorBuffer = colorBufferData != null ? colorBufferData.getBuffer() : null; if (colorBuffer == null) { GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); } else { GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); colorBuffer.rewind(); GL11.glColorPointer(colorBufferData.getValuesPerTuple(), 0, colorBuffer); } }
public void setupVertexData(final FloatBufferData vertexBufferData) { final FloatBuffer vertexBuffer = vertexBufferData != null ? vertexBufferData.getBuffer() : null; if (vertexBuffer == null) { GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); } else { GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); vertexBuffer.rewind(); GL11.glVertexPointer(vertexBufferData.getValuesPerTuple(), 0, vertexBuffer); } }