@Override public Mesh makeCopy(final boolean shareGeometricData) { // get copy of basic spatial info final Mesh mesh = (Mesh) super.makeCopy(shareGeometricData); // if we are sharing, just reuse meshdata if (shareGeometricData) { mesh.setMeshData(_meshData); } else { // make a copy of our data mesh.setMeshData(_meshData.makeCopy()); } // copy our basic properties mesh.setModelBound(_modelBound != null ? _modelBound.clone(null) : null); mesh.setVisible(_isVisible); mesh.setRenderMaterial(_material); mesh._properties.putAll(_properties); // return return mesh; }
/** * Construct a new TextCaret */ public TextCaret() { _strip.setRenderMaterial("ui/untextured/default_color.yaml"); final MeshData md = _strip.getMeshData(); md.setVertexBuffer(BufferUtils.createVector3Buffer(4)); md.setIndices(BufferUtils.createIndexBufferData(new int[] { 0, 1, 3, 2 }, 3)); md.setIndexMode(IndexMode.TriangleStrip); final float[] vals = new float[] { 0, 0, 0, // 1, 0, 0, // 1, 1, 0, // 0, 1, 0 // }; md.getVertexBuffer().put(vals); _strip.updateGeometricState(0); setCaretColor(ColorRGBA.BLACK); }
protected Mesh createSelectionMesh() { final Mesh mesh = new Mesh("selectionMesh"); mesh.setRenderMaterial("ui/untextured/default_color.yaml"); final MeshData mData = mesh.getMeshData(); mData.setVertexBuffer(BufferUtils.createVector3Buffer(6)); mData.setIndexMode(IndexMode.Triangles); final BlendState blend = new BlendState(); blend.setBlendEnabled(true); blend.setSourceFunction(SourceFunction.SourceAlpha); blend.setDestinationFunction(DestinationFunction.OneMinusSourceAlpha); mesh.setRenderState(blend); mesh.updateWorldRenderStates(false); mesh.setDefaultColor(ColorRGBA.LIGHT_GRAY); return mesh; }
private static Mesh createMesh() { final Mesh mesh = new Mesh(); mesh.setRenderMaterial("ui/textured/default_color.yaml"); final MeshData meshData = mesh.getMeshData(); meshData.setVertexCoords(new FloatBufferData(BufferUtils.createVector2Buffer(4), 2)); meshData.setTextureBuffer(BufferUtils.createVector2Buffer(4), 0); meshData.setIndexMode(IndexMode.TriangleFan); meshData.getVertexCoords().setVboAccessMode(VBOAccessMode.DynamicDraw); mesh.setRenderState(SubTexUtil._tstate); final BlendState blend = new BlendState(); blend.setBlendEnabled(true); blend.setSourceFunction(SourceFunction.SourceAlpha); blend.setDestinationFunction(DestinationFunction.OneMinusSourceAlpha); mesh.setRenderState(blend); mesh.updateWorldRenderStates(false); return mesh; } }
private static Mesh createMesh() { final Mesh mesh = new Mesh(); mesh.setRenderMaterial("ui/untextured/vertex_color.yaml"); final MeshData meshData = mesh.getMeshData(); meshData.setVertexBuffer(BufferUtils.createVector3Buffer(4)); meshData.getVertexCoords().setVboAccessMode(VBOAccessMode.DynamicDraw); meshData.setColorBuffer(BufferUtils.createColorBuffer(4)); meshData.getColorCoords().setVboAccessMode(VBOAccessMode.DynamicDraw); meshData.setIndexMode(IndexMode.TriangleFan); final BlendState blend = new BlendState(); blend.setBlendEnabled(true); blend.setSourceFunction(SourceFunction.SourceAlpha); blend.setDestinationFunction(DestinationFunction.OneMinusSourceAlpha); mesh.setRenderState(blend); mesh.updateWorldRenderStates(false); return mesh; } }
private static Mesh createMesh() { // create a triangle strip of 8 triangles. final Mesh mesh = new Mesh(); mesh.setRenderMaterial("ui/untextured/vertex_color_flat.yaml"); mesh.getMeshData().setVertexCoords(new FloatBufferData(BufferUtils.createVector2Buffer(8), 2)); mesh.getMeshData().setColorBuffer(BufferUtils.createColorBuffer(8)); mesh.getMeshData().setIndexMode(IndexMode.TriangleStrip); final IndexBufferData<?> indices = BufferUtils.createIndexBufferData(10, 7); indices.put(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 0, 1 }); mesh.getMeshData().setIndices(indices); // set up alpha blending. final BlendState blend = new BlendState(); blend.setBlendEnabled(true); blend.setSourceFunction(SourceFunction.SourceAlpha); blend.setDestinationFunction(DestinationFunction.OneMinusSourceAlpha); mesh.setRenderState(blend); mesh.updateWorldRenderStates(false); return mesh; } }