/** * Initialize the meshdata object with data. * * @param vertices * @param normals * @param colors * @param coords */ private void setupData(final FloatBuffer vertices, final FloatBuffer normals, final FloatBuffer colors, final FloatBufferData coords) { _meshData.setVertexBuffer(vertices); _meshData.setNormalBuffer(normals); _meshData.setColorBuffer(colors); _meshData.setTextureCoords(coords, 0); }
/** * Initialize the meshdata object with data. * * @param vertices * @param normals * @param colors * @param coords */ private void setupData(final FloatBuffer vertices, final FloatBuffer normals, final FloatBuffer colors, final FloatBufferData coords) { _meshData.setVertexBuffer(vertices); _meshData.setNormalBuffer(normals); _meshData.setColorBuffer(colors); _meshData.setTextureCoords(coords, 0); }
/** * Initialize the meshdata object with data. * * @param vertices * @param normals * @param colors * @param coords */ private void setupData(final FloatBuffer vertices, final FloatBuffer normals, final FloatBuffer colors, final FloatBufferData coords) { _meshData.setVertexBuffer(vertices); _meshData.setNormalBuffer(normals); _meshData.setColorBuffer(colors); _meshData.setTextureCoords(coords, 0); _meshData.setIndices(null); }
/** * Initialize the meshdata object with data. * * @param vertices * @param normals * @param colors * @param coords */ private void setupData(final FloatBuffer vertices, final FloatBuffer normals, final FloatBuffer colors, final FloatBufferData coords) { _meshData.setVertexBuffer(vertices); _meshData.setNormalBuffer(normals); _meshData.setColorBuffer(colors); _meshData.setTextureCoords(coords, 0); _meshData.setIndices(null); }
/** * Construct a new TextCaret */ public TextCaret() { 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"); 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; }
public BMTextBackground(final String name, final BMText text, final Texture texture, final ReadOnlyVector4 textureBorderOffsets) { super(name); _text = text; _texture = texture; _textureBorderOffsets.set(textureBorderOffsets); setRenderStates(texture); // allocate vertex data _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(16)); _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(16), 0); _meshData.setIndices(BufferUtils.createIndexBufferData(28, 15)); // Set initial static data. setTextureData(); setIndexData(); setRenderMaterial("ui/textured/default_color.yaml"); // -- add self as change listener _text.addChangeListener(this); }
private void setData() { getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(getMeshData().getVertexBuffer(), trailVertices)); getMeshData().setNormalBuffer(BufferUtils.createVector3Buffer(getMeshData().getNormalBuffer(), trailVertices)); setDefaultColor(new ColorRGBA(ColorRGBA.WHITE)); setTextureData(); setIndexData(); }
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.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(4)); mesh.getMeshData().setColorBuffer(BufferUtils.createColorBuffer(4)); mesh.getMeshData().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 void allocateVertices() { final int verts = (2 * (_axisSamples + 1) * (_radialSamples + 1) + _radialSamples * 4); _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(_meshData.getVertexBuffer(), verts)); _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(_meshData.getNormalBuffer(), verts)); _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(_meshData.getTextureBuffer(0), verts), 0); final int tris = (4 * _radialSamples * (1 + _axisSamples)); if (_meshData.getIndices() == null || _meshData.getIndices().getBufferLimit() != 3 * tris) { _meshData.setIndices(BufferUtils.createIndexBufferData(3 * tris, verts - 1)); } setGeometryData(); setIndexData(); }
public AreaEntry(final int maxSamples, final StatType type) { this.maxSamples = maxSamples; area = new Mesh("a"); area.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(maxSamples * 2)); area.getSceneHints().setRenderBucketType(RenderBucketType.Ortho); area.getMeshData().setIndexMode(IndexMode.LineStrip); area.setDefaultColor(getColorConfig(type, ConfigKeys.Color.name(), new ColorRGBA(ColorRGBA.LIGHT_GRAY))); if (!getBooleanConfig(type, ConfigKeys.ShowAreas.name(), true)) { area.getSceneHints().setCullHint(CullHint.Always); } } }
private void allocateVertices() { final int verts = (2 * (_axisSamples + 1) * (_radialSamples + 1) + _radialSamples * 4); _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(_meshData.getVertexBuffer(), verts)); _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(_meshData.getNormalBuffer(), verts)); _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(_meshData.getTextureBuffer(0), verts), 0); final int tris = (4 * _radialSamples * (1 + _axisSamples)); if (_meshData.getIndices() == null || _meshData.getIndices().getBufferLimit() != 3 * tris) { _meshData.setIndices(BufferUtils.createIndexBufferData(3 * tris, verts - 1)); } setGeometryData(); setIndexData(); }
public AreaEntry(final int maxSamples, final StatType type) { this.maxSamples = maxSamples; area = new Mesh("a"); area.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(maxSamples * 2)); area.getSceneHints().setRenderBucketType(RenderBucketType.OrthoOrder); area.getMeshData().setIndexMode(IndexMode.LineStrip); area.setDefaultColor(getColorConfig(type, ConfigKeys.Color.name(), new ColorRGBA(ColorRGBA.LIGHT_GRAY))); if (!getBooleanConfig(type, ConfigKeys.ShowAreas.name(), true)) { area.getSceneHints().setCullHint(CullHint.Always); } } }
private void allocateVertices() { // allocate vertices final int verts = _axisSamples * (_radialSamples + 1) + (_closed ? 2 : 0); _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(_meshData.getVertexBuffer(), verts)); // allocate normals if requested _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(_meshData.getNormalBuffer(), verts)); // allocate texture coordinates _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(verts), 0); final int count = ((_closed ? 2 : 0) + 2 * (_axisSamples - 1)) * _radialSamples; if (_meshData.getIndices() == null || _meshData.getIndices().getBufferLimit() != 3 * count) { _meshData.setIndices(BufferUtils.createIndexBufferData(3 * count, verts - 1)); } setGeometryData(); setIndexData(); }
private void allocateVertices() { // allocate vertices final int verts = _axisSamples * (_radialSamples + 1) + (_closed ? 2 : 0); _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(_meshData.getVertexBuffer(), verts)); // allocate normals if requested _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(_meshData.getNormalBuffer(), verts)); // allocate texture coordinates _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(verts), 0); final int count = ((_closed ? 2 : 0) + 2 * (_axisSamples - 1)) * _radialSamples; if (_meshData.getIndices() == null || _meshData.getIndices().getBufferLimit() != 3 * count) { _meshData.setIndices(BufferUtils.createIndexBufferData(3 * count, verts - 1)); } setGeometryData(); setIndexData(); }
private void recreateBuffers() { // determine vert quantity - first the sphere caps final int sampleLines = (2 * sphereSamples - 1 + axisSamples); final int verts = (radialSamples + 1) * sampleLines + 2; _meshData.setVertexBuffer(BufferUtils.createVector3Buffer(_meshData.getVertexBuffer(), verts)); // allocate normals _meshData.setNormalBuffer(BufferUtils.createVector3Buffer(_meshData.getNormalBuffer(), verts)); // allocate texture coordinates _meshData.setTextureBuffer(BufferUtils.createVector2Buffer(verts), 0); // determine tri quantity final int tris = 2 * radialSamples * sampleLines; if (_meshData.getIndices() == null || _meshData.getIndices().getBufferLimit() != 3 * tris) { _meshData.setIndices(BufferUtils.createIndexBufferData(3 * tris, verts - 1)); } setGeometryData(); setIndexData(); }
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; } }
protected Mesh getFullScreenQuad() { if (_fsq != null) { return _fsq; } _fsq = new Mesh("fsq"); _fsq.getMeshData().setVertexBuffer(BufferUtils.createFloatBuffer(-1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1)); _fsq.getMeshData().setTextureBuffer(BufferUtils.createFloatBuffer(0, 0, 1, 0, 1, 1, 0, 1), 0); _fsq.getMeshData().setIndices(BufferUtils.createIndexBufferData(new int[] { 0, 1, 3, 1, 2, 3 }, 3)); _fsq.getSceneHints().setCullHint(CullHint.Never); _fsq.getSceneHints().setLightCombineMode(LightCombineMode.Off); final ZBufferState zState = new ZBufferState(); zState.setEnabled(false); _fsq.setRenderState(zState); _fsq.updateGeometricState(0); return _fsq; }
public Line updateLineKey(final StatType type, Line lineKey) { if (lineKey == null) { lineKey = new Line("lk", BufferUtils.createVector3Buffer(2), null, null, null); final FloatBuffer fb = BufferUtils .createFloatBuffer(new Vector3[] { new Vector3(0, 0, 0), new Vector3(30, 0, 0) }); fb.rewind(); lineKey.getMeshData().setVertexBuffer(fb); } lineKey.getSceneHints().setRenderBucketType(RenderBucketType.OrthoOrder); lineKey.getMeshData().setIndexMode(IndexMode.LineLoop); lineKey.setDefaultColor(getColorConfig(type, ConfigKeys.Color.name(), new ColorRGBA(ColorRGBA.LIGHT_GRAY))); lineKey.setLineWidth(getIntConfig(type, ConfigKeys.Width.name(), 3)); lineKey.setAntialiased(getBooleanConfig(type, ConfigKeys.Antialias.name(), true)); if (!getBooleanConfig(type, ConfigKeys.ShowAreas.name(), true)) { lineKey.getSceneHints().setCullHint(CullHint.Always); } return lineKey; }