/** * Acquires an index buffer that will read the vertices on the mesh * as a list. * * @return A virtual or wrapped index buffer to read the data as a list */ public IndexBuffer getIndicesAsList(){ if (mode == Mode.Hybrid) { throw new UnsupportedOperationException("Hybrid mode not supported"); } IndexBuffer ib = getIndexBuffer(); if (ib != null){ if (mode.isListMode()){ // already in list mode return ib; }else{ // not in list mode but it does have an index buffer // wrap it so the data is converted to list format return new WrappedIndexBuffer(this); } }else{ // return a virtual index buffer that will supply // "fake" indices in list format return new VirtualIndexBuffer(vertCount, mode); } }
@Override public int get() { int i = get(position); position++; return i; }
public BIHTree(Mesh mesh, int maxTrisPerNode) { this.mesh = mesh; this.maxTrisPerNode = maxTrisPerNode; if (maxTrisPerNode < 1) { throw new IllegalArgumentException("maxTrisPerNode cannot be less than 1"); } if (mesh == null) { throw new IllegalArgumentException("Mesh cannot be null"); } bihSwapTmp = new float[9]; VertexBuffer vBuffer = mesh.getBuffer(Type.Position); if(vBuffer == null){ throw new IllegalArgumentException("A mesh should at least contain a Position buffer"); } IndexBuffer ib = mesh.getIndexBuffer(); FloatBuffer vb = (FloatBuffer) vBuffer.getData(); if (ib == null) { ib = new VirtualIndexBuffer(mesh.getVertexCount(), mesh.getMode()); } else if (mesh.getMode() != Mode.Triangles) { ib = new WrappedIndexBuffer(mesh); } numTris = ib.size() / 3; initTriList(vb, ib); }
@Override public int get(int i) { int superIdx = super.get(i); return ib.get(superIdx); }
/** * Acquires an index buffer that will read the vertices on the mesh * as a list. * * @return A virtual or wrapped index buffer to read the data as a list */ public IndexBuffer getIndicesAsList(){ if (mode == Mode.Hybrid) throw new UnsupportedOperationException("Hybrid mode not supported"); IndexBuffer ib = getIndexBuffer(); if (ib != null){ if (mode.isListMode()){ // already in list mode return ib; }else{ // not in list mode but it does have an index buffer // wrap it so the data is converted to list format return new WrappedIndexBuffer(this); } }else{ // return a virtual index buffer that will supply // "fake" indices in list format return new VirtualIndexBuffer(vertCount, mode); } }
@Override public int get() { int i = get(position); position++; return i; }
/** * Acquires an index buffer that will read the vertices on the mesh * as a list. * * @return A virtual or wrapped index buffer to read the data as a list */ public IndexBuffer getIndicesAsList(){ if (mode == Mode.Hybrid) throw new UnsupportedOperationException("Hybrid mode not supported"); IndexBuffer ib = getIndexBuffer(); if (ib != null){ if (mode.isListMode()){ // already in list mode return ib; }else{ // not in list mode but it does have an index buffer // wrap it so the data is converted to list format return new WrappedIndexBuffer(this); } }else{ // return a virtual index buffer that will supply // "fake" indices in list format return new VirtualIndexBuffer(vertCount, mode); } }
@Override public int get(int i) { int superIdx = super.get(i); return ib.get(superIdx); }
public BIHTree(Mesh mesh, int maxTrisPerNode) { this.mesh = mesh; this.maxTrisPerNode = maxTrisPerNode; if (maxTrisPerNode < 1) { throw new IllegalArgumentException("maxTrisPerNode cannot be less than 1"); } if (mesh == null) { throw new IllegalArgumentException("Mesh cannot be null"); } bihSwapTmp = new float[9]; VertexBuffer vBuffer = mesh.getBuffer(Type.Position); if(vBuffer == null){ throw new IllegalArgumentException("A mesh should at least contain a Position buffer"); } IndexBuffer ib = mesh.getIndexBuffer(); FloatBuffer vb = (FloatBuffer) vBuffer.getData(); if (ib == null) { ib = new VirtualIndexBuffer(mesh.getVertexCount(), mesh.getMode()); } else if (mesh.getMode() != Mode.Triangles) { ib = new WrappedIndexBuffer(mesh); } numTris = ib.size() / 3; initTriList(vb, ib); }
@Override public int get(int i) { int superIdx = super.get(i); return ib.get(superIdx); }
public BIHTree(Mesh mesh, int maxTrisPerNode) { this.mesh = mesh; this.maxTrisPerNode = maxTrisPerNode; if (maxTrisPerNode < 1 || mesh == null) { throw new IllegalArgumentException(); } bihSwapTmp = new float[9]; FloatBuffer vb = (FloatBuffer) mesh.getBuffer(Type.Position).getData(); IndexBuffer ib = mesh.getIndexBuffer(); if (ib == null) { ib = new VirtualIndexBuffer(mesh.getVertexCount(), mesh.getMode()); } else if (mesh.getMode() != Mode.Triangles) { ib = new WrappedIndexBuffer(mesh); } numTris = ib.size() / 3; initTriList(vb, ib); }