Buffer srcData = getDataReadOnly();
/** * Creates a deep clone of this VertexBuffer but overrides the * {@link Type}. * * @param overrideType The type of the cloned VertexBuffer * @return A deep clone of the buffer */ public VertexBuffer clone(Type overrideType){ VertexBuffer vb = new VertexBuffer(overrideType); vb.components = components; vb.componentsLength = componentsLength; // Make sure to pass a read-only buffer to clone so that // the position information doesn't get clobbered by another // reading thread during cloning (and vice versa) since this is // a purely read-only operation. vb.data = BufferUtils.clone(getDataReadOnly()); vb.format = format; vb.handleRef = new Object(); vb.id = -1; vb.normalized = normalized; vb.instanceSpan = instanceSpan; vb.offset = offset; vb.stride = stride; vb.updateNeeded = true; vb.usage = usage; return vb; }
Buffer srcData = getDataReadOnly(); outVb.data.clear();
/** * Creates a deep clone of the {@link VertexBuffer}. * * @return Deep clone of this buffer */ @Override public VertexBuffer clone(){ // NOTE: Superclass GLObject automatically creates shallow clone // e.g re-use ID. VertexBuffer vb = (VertexBuffer) super.clone(); vb.handleRef = new Object(); vb.id = -1; if (data != null) { // Make sure to pass a read-only buffer to clone so that // the position information doesn't get clobbered by another // reading thread during cloning (and vice versa) since this is // a purely read-only operation. vb.updateData(BufferUtils.clone(getDataReadOnly())); } return vb; }
private void gatherVertexData(Mesh mesh, List<Vertex> vertexLookup) { //in case the model is currently animating with software animation //attempting to retrieve the bind position instead of the position. VertexBuffer position = mesh.getBuffer(VertexBuffer.Type.BindPosePosition); if (position == null) { position = mesh.getBuffer(VertexBuffer.Type.Position); } FloatBuffer pos = (FloatBuffer) position.getDataReadOnly(); pos.rewind(); while (pos.remaining() != 0) { Vertex v = new Vertex(); v.position.setX(pos.get()); v.position.setY(pos.get()); v.position.setZ(pos.get()); v.isSeam = false; Vertex existingV = findSimilar(v); if (existingV != null) { //vertex position already exists existingV.isSeam = true; v.isSeam = true; } else { vertexList.add(v); } vertexLookup.add(v); } pos.rewind(); }
private void gatherIndexData(Mesh mesh, List<Vertex> vertexLookup) { VertexBuffer indexBuffer = mesh.getBuffer(VertexBuffer.Type.Index); indexCount = indexBuffer.getNumElements() * 3; Buffer b = indexBuffer.getDataReadOnly(); b.rewind();
Buffer boneIndices = biBuf.getDataReadOnly(); FloatBuffer boneWeight = (FloatBuffer) mesh.getBuffer(Type.BoneWeight).getData();
Buffer boneIndices = biBuf.getDataReadOnly(); FloatBuffer boneWeight = (FloatBuffer) mesh.getBuffer(Type.BoneWeight).getData();
for (Mesh mesh : targets) { VertexBuffer biBuf = mesh.getBuffer(VertexBuffer.Type.BoneIndex); Buffer boneIndices = biBuf.getDataReadOnly(); FloatBuffer boneWeight = (FloatBuffer) mesh.getBuffer(Type.BoneWeight).getData();
for (Mesh mesh : targets) { VertexBuffer biBuf = mesh.getBuffer(VertexBuffer.Type.BoneIndex); Buffer boneIndices = biBuf.getDataReadOnly(); FloatBuffer boneWeight = (FloatBuffer) mesh.getBuffer(Type.BoneWeight).getData();
ByteBuffer oldBuffer = (ByteBuffer) vertexBuffer.getDataReadOnly(); int numComponents = oldBuffer.limit(); oldBuffer.rewind();
boolean isShortBuffer = g.getMesh().getLodLevel(i).getFormat() == VertexBuffer.Format.UnsignedShort; if(isShortBuffer){ ShortBuffer buffer = (ShortBuffer) g.getMesh().getLodLevel(i).getDataReadOnly(); for (int j = 0; j < buffer.limit(); j++) { lodData[i][bufferPos[i]] = (buffer.get()& 0xffff) + indexPos[i]; IntBuffer buffer = (IntBuffer) g.getMesh().getLodLevel(i).getDataReadOnly(); for (int j = 0; j < buffer.limit(); j++) { lodData[i][bufferPos[i]] = buffer.get() + indexPos[i];
Buffer roData = getDataReadOnly(); switch (format){ case Float:
FloatBuffer inPos = (FloatBuffer) inBuf.getDataReadOnly(); FloatBuffer outPos = (FloatBuffer) outBuf.getData(); doTransformVerts(inPos, globalVertIndex, outPos, worldMatrix); } else if (Type.Normal.ordinal() == bufType) { FloatBuffer inPos = (FloatBuffer) inBuf.getDataReadOnly(); FloatBuffer outPos = (FloatBuffer) outBuf.getData(); doTransformNorms(inPos, globalVertIndex, outPos, worldMatrix); } else if (Type.Tangent.ordinal() == bufType) { FloatBuffer inPos = (FloatBuffer) inBuf.getDataReadOnly(); FloatBuffer outPos = (FloatBuffer) outBuf.getData(); int components = inBuf.getNumComponents();
Buffer srcData = getDataReadOnly();
/** * Creates a deep clone of this VertexBuffer but overrides the * {@link Type}. * * @param overrideType The type of the cloned VertexBuffer * @return A deep clone of the buffer */ public VertexBuffer clone(Type overrideType){ VertexBuffer vb = new VertexBuffer(overrideType); vb.components = components; vb.componentsLength = componentsLength; // Make sure to pass a read-only buffer to clone so that // the position information doesn't get clobbered by another // reading thread during cloning (and vice versa) since this is // a purely read-only operation. vb.data = BufferUtils.clone(getDataReadOnly()); vb.format = format; vb.handleRef = new Object(); vb.id = -1; vb.normalized = normalized; vb.instanceSpan = instanceSpan; vb.offset = offset; vb.stride = stride; vb.updateNeeded = true; vb.usage = usage; return vb; }
/** * Creates a deep clone of the {@link VertexBuffer}. * * @return Deep clone of this buffer */ @Override public VertexBuffer clone(){ // NOTE: Superclass GLObject automatically creates shallow clone // e.g re-use ID. VertexBuffer vb = (VertexBuffer) super.clone(); vb.handleRef = new Object(); vb.id = -1; if (data != null) { // Make sure to pass a read-only buffer to clone so that // the position information doesn't get clobbered by another // reading thread during cloning (and vice versa) since this is // a purely read-only operation. vb.updateData(BufferUtils.clone(getDataReadOnly())); } return vb; }
private void gatherIndexData(Mesh mesh, List<Vertex> vertexLookup) { VertexBuffer indexBuffer = mesh.getBuffer(VertexBuffer.Type.Index); indexCount = indexBuffer.getNumElements() * 3; Buffer b = indexBuffer.getDataReadOnly(); b.rewind();
private void gatherVertexData(Mesh mesh, List<Vertex> vertexLookup) { //in case the model is currently animating with software animation //attempting to retrieve the bind position instead of the position. VertexBuffer position = mesh.getBuffer(VertexBuffer.Type.BindPosePosition); if (position == null) { position = mesh.getBuffer(VertexBuffer.Type.Position); } FloatBuffer pos = (FloatBuffer) position.getDataReadOnly(); pos.rewind(); while (pos.remaining() != 0) { Vertex v = new Vertex(); v.position.setX(pos.get()); v.position.setY(pos.get()); v.position.setZ(pos.get()); v.isSeam = false; Vertex existingV = findSimilar(v); if (existingV != null) { //vertex position already exists existingV.isSeam = true; v.isSeam = true; } else { vertexList.add(v); } vertexLookup.add(v); } pos.rewind(); }
Buffer roData = getDataReadOnly(); switch (format){ case Float: