/** * Change the Mesh's mode. By default the mode is {@link Mode#Triangles}. * * @param mode The new mode to set * * @see Mode */ public void setMode(Mode mode) { this.mode = mode; updateCounts(); }
/** * Unsets the {@link VertexBuffer} set on this mesh * with the given type. Does nothing if the vertex buffer type is not set * initially. * * @param type The buffer type to remove */ public void clearBuffer(VertexBuffer.Type type){ VertexBuffer vb = buffers.remove(type.ordinal()); if (vb != null){ buffersList.remove(vb); updateCounts(); } }
makeLods(geomsForMat, mesh); mesh.updateCounts();
newMesh.setStatic(); newMesh.updateBound(); newMesh.updateCounts(); Geometry geom = new Geometry(); geom.setMesh(newMesh); mesh.setStatic(); mesh.updateBound(); mesh.updateCounts(); Geometry geom = new Geometry(); geom.setMesh(mesh);
public static Mesh convert(IndexedMesh mesh) { Mesh jmeMesh = new Mesh(); jmeMesh.setBuffer(Type.Index, 3, BufferUtils.createShortBuffer(mesh.numTriangles * 3)); jmeMesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(mesh.numVertices * 3)); IndexBuffer indicess = jmeMesh.getIndexBuffer(); FloatBuffer vertices = jmeMesh.getFloatBuffer(Type.Position); for (int i = 0; i < mesh.numTriangles * 3; i++) { indicess.put(i, mesh.triangleIndexBase.getInt(i * 4)); } for (int i = 0; i < mesh.numVertices * 3; i++) { vertices.put(i, mesh.vertexBase.getFloat(i * 4)); } jmeMesh.updateCounts(); jmeMesh.updateBound(); jmeMesh.getFloatBuffer(Type.Position).clear(); return jmeMesh; }
/** * Sets the {@link VertexBuffer} on the mesh. * This will update the vertex/triangle counts if needed. * * @param vb The buffer to set * @throws IllegalArgumentException If the buffer type is already set */ public void setBuffer(VertexBuffer vb){ if (buffers.containsKey(vb.getBufferType().ordinal())) { throw new IllegalArgumentException("Buffer type already set: " + vb.getBufferType()); } buffers.put(vb.getBufferType().ordinal(), vb); buffersList.add(vb); updateCounts(); }
jmeMesh.updateCounts(); jmeMesh.updateBound();
/** * Creates a {@link VertexBuffer} for the mesh or modifies * the existing one per the parameters given. * * @param type The type of the buffer * @param components Number of components * @param format Data format * @param buf The buffer data * * @throws UnsupportedOperationException If the buffer already set is * incompatible with the parameters given. */ public void setBuffer(Type type, int components, Format format, Buffer buf){ VertexBuffer vb = buffers.get(type.ordinal()); if (vb == null){ vb = new VertexBuffer(type); vb.setupData(Usage.Dynamic, components, format, buf); setBuffer(vb); }else{ if (vb.getNumComponents() != components || vb.getFormat() != format){ throw new UnsupportedOperationException("The buffer already set " + "is incompatible with the given parameters"); } vb.updateData(buf); updateCounts(); } }
batch.geometry.getMesh().updateCounts(); batch.geometry.updateModelBound(); batches.add(batch);
ib.updateData(sib); m.updateCounts();
GeometryBatchFactory.mergeGeometries(geometries, mesh); applyAtlasCoords(geometries, mesh, atlas); mesh.updateCounts(); mesh.updateBound(); geom.setMesh(mesh);
public void render() { renderState.setBlendMode(convertBlend(blendMode)); vertexPosBuffer.flip(); vertexPos.updateData(vertexPosBuffer); vertexTexCoordBuffer.flip(); vertexTexCoord.updateData(vertexTexCoordBuffer); vertexColorBuffer.flip(); vertexColor.updateData(vertexColorBuffer); indexBufferBuffer.flip(); indexBuffer.updateData(indexBufferBuffer); tempMat.loadIdentity(); renderManager.setWorldMatrix(tempMat); renderManager.setForcedRenderState(renderState); material.setTexture("ColorMap", texture); mesh.updateCounts(); material.render(meshGeometry, renderManager); renderManager.setForcedRenderState(null); }
updateCounts(); updateBound();
@Override public void simpleInitApp() { Mesh mesh = new Mesh(); mesh.setBuffer(VertexBuffer.Type.Index, 1, BufferUtils.createIntBuffer(new int[]{1})); mesh.setBuffer(VertexBuffer.Type.Position, 3, BufferUtils.createFloatBuffer(new float[]{0, 0, 0})); mesh.setMode(Mesh.Mode.Points); mesh.setBound(new BoundingBox(new Vector3f(0, 0, 0), 10, 10, 10)); mesh.updateCounts(); Geometry geometry = new Geometry("Test", mesh); geometry.updateGeometricState(); geometry.setMaterial(new Material(assetManager, "Materials/Geom/SimpleGeom.j3md")); //geometry.getMaterial().getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off); //geometry.setMaterial(assetManager.loadMaterial("Materials/Geom/SimpleTess.j3md")); rootNode.attachChild(geometry); Geometry geometry1 = new Geometry("T1", new Sphere(10, 10, 1)); geometry1.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md")); rootNode.attachChild(geometry1); }
/** * Change the Mesh's mode. By default the mode is {@link Mode#Triangles}. * * @param mode The new mode to set * * @see Mode */ public void setMode(Mode mode) { this.mode = mode; updateCounts(); }
/** * Change the Mesh's mode. By default the mode is {@link Mode#Triangles}. * * @param mode The new mode to set * * @see Mode */ public void setMode(Mode mode) { this.mode = mode; updateCounts(); }
public List<BatchedGeometry> batch(List<Geometry> geom) { if (mesh != null) { geom.add(0, this); } Mesh m = new Mesh(); List<BatchedGeometry> l = mergeGeometries(m, geom); mesh = m; mesh.updateCounts(); mesh.updateBound(); return l; }