/** Begin building a mesh. Call {@link #part(String, int)} to start a {@link MeshPart}. */ public void begin (final VertexAttributes attributes) { begin(attributes, -1); }
/** Begin building a mesh. Call {@link #part(String, int)} to start a {@link MeshPart}. */ public void begin (final VertexAttributes attributes) { begin(attributes, -1); }
/** Begin building a mesh. * @param attributes bitwise mask of the {@link com.badlogic.gdx.graphics.VertexAttributes.Usage}, only Position, Color, Normal * and TextureCoordinates is supported. */ public void begin (final long attributes, int primitiveType) { begin(createAttributes(attributes), primitiveType); }
/** Begin building a mesh. Call {@link #part(String, int)} to start a {@link MeshPart}. * @param attributes bitwise mask of the {@link com.badlogic.gdx.graphics.VertexAttributes.Usage}, only Position, Color, Normal * and TextureCoordinates is supported. */ public void begin (final long attributes) { begin(createAttributes(attributes), -1); }
/** Begin building a mesh. Call {@link #part(String, int)} to start a {@link MeshPart}. * @param attributes bitwise mask of the {@link com.badlogic.gdx.graphics.VertexAttributes.Usage}, only Position, Color, Normal * and TextureCoordinates is supported. */ public void begin (final long attributes) { begin(createAttributes(attributes), -1); }
/** Begin building a mesh. * @param attributes bitwise mask of the {@link com.badlogic.gdx.graphics.VertexAttributes.Usage}, only Position, Color, Normal * and TextureCoordinates is supported. */ public void begin (final long attributes, int primitiveType) { begin(createAttributes(attributes), primitiveType); }
/** Initialize ShapeCache for mesh generation * @param primitiveType OpenGL primitive type */ public MeshPartBuilder begin (int primitiveType) { if (building) throw new GdxRuntimeException("Call end() after calling begin()"); building = true; builder.begin(mesh.getVertexAttributes()); builder.part(id, primitiveType, renderable.meshPart); return builder; }
/** Initialize ShapeCache for mesh generation * @param primitiveType OpenGL primitive type */ public MeshPartBuilder begin (int primitiveType) { if (building) throw new GdxRuntimeException("Call end() after calling begin()"); building = true; builder.begin(mesh.getVertexAttributes()); builder.part(id, primitiveType, renderable.meshPart); return builder; }
private MeshBuilder getBuilder (final VertexAttributes attributes) { for (final MeshBuilder mb : builders) if (mb.getAttributes().equals(attributes) && mb.lastIndex() < Short.MAX_VALUE / 2) return mb; final MeshBuilder result = new MeshBuilder(); result.begin(attributes); builders.add(result); return result; }
private MeshBuilder getBuilder (final VertexAttributes attributes) { for (final MeshBuilder mb : builders) if (mb.getAttributes().equals(attributes) && mb.lastIndex() < Short.MAX_VALUE / 2) return mb; final MeshBuilder result = new MeshBuilder(); result.begin(attributes); builders.add(result); return result; }
int offset = renderables.size; meshBuilder.begin(vertexAttributes); MeshPart part = meshBuilder.part("", primitiveType, meshPartPool.obtain()); renderables.add(obtainRenderable(material, primitiveType)); while (offset < renderables.size) renderables.get(offset++).meshPart.mesh = mesh; meshBuilder.begin(vertexAttributes = va);
int offset = renderables.size; meshBuilder.begin(vertexAttributes); MeshPart part = meshBuilder.part("", primitiveType, meshPartPool.obtain()); renderables.add(obtainRenderable(material, primitiveType)); while (offset < renderables.size) renderables.get(offset++).meshPart.mesh = mesh; meshBuilder.begin(vertexAttributes = va);
/** Begin building a mesh. Call {@link #part(String, int)} to start a {@link MeshPart}. */ public void begin (final VertexAttributes attributes) { begin(attributes, -1); }
meshBuilder.begin(Usage.Position | Usage.Normal | Usage.ColorPacked | Usage.TextureCoordinates, GL20.GL_TRIANGLES); meshBuilder.box(1f, 1f, 1f); Mesh mesh = new Mesh(true, meshBuilder.getNumVertices(), meshBuilder.getNumIndices(), meshBuilder.getAttributes());
/** Begin building a mesh. * @param attributes bitwise mask of the {@link com.badlogic.gdx.graphics.VertexAttributes.Usage}, only Position, Color, Normal * and TextureCoordinates is supported. */ public void begin (final long attributes, int primitiveType) { begin(createAttributes(attributes), primitiveType); }
/** Begin building a mesh. Call {@link #part(String, int)} to start a {@link MeshPart}. * @param attributes bitwise mask of the {@link com.badlogic.gdx.graphics.VertexAttributes.Usage}, only Position, Color, Normal * and TextureCoordinates is supported. */ public void begin (final long attributes) { begin(createAttributes(attributes), -1); }
public Mesh meshFaces(List<Face> faces, MeshBuilder builder) { builder.begin(VertexAttributes.Usage.Position | VertexAttributes.Usage.TextureCoordinates | VertexAttributes.Usage.ColorPacked | VertexAttributes.Usage.Normal, GL20.GL_TRIANGLES); builder.ensureVertices(faces.size() * 4); for (Face f : faces) { f.render(builder); } return builder.end(); }
/** Initialize ShapeCache for mesh generation * @param primitiveType OpenGL primitive type */ public MeshPartBuilder begin (int primitiveType) { if (building) throw new GdxRuntimeException("Call end() after calling begin()"); building = true; builder.begin(mesh.getVertexAttributes()); builder.part(id, primitiveType, renderable.meshPart); return builder; }
private MeshBuilder getBuilder (final VertexAttributes attributes) { for (final MeshBuilder mb : builders) if (mb.getAttributes().equals(attributes) && mb.lastIndex() < Short.MAX_VALUE / 2) return mb; final MeshBuilder result = new MeshBuilder(); result.begin(attributes); builders.add(result); return result; }
MeshBuilder meb = new MeshBuilder(); final long atr = Usage.Position | Usage.Color; //Add Usage.TextureCoordinates or similar here if you need it //Create mesh #1 meb.begin(atr); meb.cylinder(4f, 6f, 4f, 16); Mesh cyl1 = meb.end(); //Create mesh #2 meb.begin(atr); meb.cylinder(4f, 6f, 4f, 16); Mesh cyl2 = meb.end(); //Combine the two meshes into one model using ModelBuilder ModelBuilder mob = new ModelBuilder(); mob.begin(); mob.part("cylinder1", cyl1, Usage.Position | Usage.Normal | Usage.TextureCoordinates, new Material(ColorAttribute.createDiffuse(Color.RED), ColorAttribute.createSpecular(1, 1, 1, 1), FloatAttribute.createShininess(8f))); mob.part("cylinder2", cyl2, Usage.Position | Usage.Normal | Usage.TextureCoordinates, new Material(ColorAttribute.createDiffuse(Color.GREEN), ColorAttribute.createSpecular(1, 1, 1, 1), FloatAttribute.createShininess(8f))).mesh.transform(new Matrix4().translate(0, 0, -2f)); Model cyl = mob.end();