List of usage examples for com.badlogic.gdx.graphics GL20 GL_LINES
int GL_LINES
To view the source code for com.badlogic.gdx.graphics GL20 GL_LINES.
Click Source Link
From source file:gaia.cu9.ari.gaiaorbit.util.g3d.MeshBuilder2.java
License:Apache License
@Override public void box(VertexInfo corner000, VertexInfo corner010, VertexInfo corner100, VertexInfo corner110, VertexInfo corner001, VertexInfo corner011, VertexInfo corner101, VertexInfo corner111) { ensureVertices(8);//from ww w.j av a 2 s . c o m final short i000 = vertex(corner000); final short i100 = vertex(corner100); final short i110 = vertex(corner110); final short i010 = vertex(corner010); final short i001 = vertex(corner001); final short i101 = vertex(corner101); final short i111 = vertex(corner111); final short i011 = vertex(corner011); if (primitiveType == GL20.GL_LINES) { ensureIndices(24); rect(i000, i100, i110, i010); rect(i101, i001, i011, i111); index(i000, i001, i010, i011, i110, i111, i100, i101); } else if (primitiveType == GL20.GL_POINTS) { ensureRectangleIndices(2); rect(i000, i100, i110, i010); rect(i101, i001, i011, i111); } else { // GL10.GL_TRIANGLES ensureRectangleIndices(6); rect(i000, i100, i110, i010); rect(i101, i001, i011, i111); rect(i000, i010, i011, i001); rect(i101, i111, i110, i100); rect(i101, i100, i000, i001); rect(i110, i111, i011, i010); } }
From source file:gaia.cu9.ari.gaiaorbit.util.g3d.MeshBuilder2.java
License:Apache License
@Override public void ellipse(float width, float height, float innerWidth, float innerHeight, int divisions, float centerX, float centerY, float centerZ, float normalX, float normalY, float normalZ, float tangentX, float tangentY, float tangentZ, float binormalX, float binormalY, float binormalZ, float angleFrom, float angleTo) { if (innerWidth <= 0 || innerHeight <= 0) { ensureTriangles(divisions + 2, divisions); } else if (innerWidth == width && innerHeight == height) { ensureVertices(divisions + 1);/* w w w .j a v a 2s . c o m*/ ensureIndices(divisions + 1); if (primitiveType != GL20.GL_LINES) throw new GdxRuntimeException( "Incorrect primitive type : expect GL_LINES because innerWidth == width && innerHeight == height"); } else { ensureRectangles((divisions + 1) * 2, divisions + 1); } final float ao = MathUtils.degreesToRadians * angleFrom; final float step = (MathUtils.degreesToRadians * (angleTo - angleFrom)) / divisions; final Vector3 sxEx = tempV1.set(tangentX, tangentY, tangentZ).scl(width * 0.5f); final Vector3 syEx = tempV2.set(binormalX, binormalY, binormalZ).scl(height * 0.5f); final Vector3 sxIn = tempV3.set(tangentX, tangentY, tangentZ).scl(innerWidth * 0.5f); final Vector3 syIn = tempV4.set(binormalX, binormalY, binormalZ).scl(innerHeight * 0.5f); VertexInfo currIn = vertTmp3.set(null, null, null, null); currIn.hasUV = currIn.hasPosition = currIn.hasNormal = true; currIn.uv.set(.5f, .5f); currIn.position.set(centerX, centerY, centerZ); currIn.normal.set(normalX, normalY, normalZ); VertexInfo currEx = vertTmp4.set(null, null, null, null); currEx.hasUV = currEx.hasPosition = currEx.hasNormal = true; currEx.uv.set(.5f, .5f); currEx.position.set(centerX, centerY, centerZ); currEx.normal.set(normalX, normalY, normalZ); final short center = vertex(currEx); float angle = 0f; final float us = 0.5f * (innerWidth / width); final float vs = 0.5f * (innerHeight / height); short i1, i2 = 0, i3 = 0, i4 = 0; for (int i = 0; i <= divisions; i++) { angle = ao + step * i; final float x = MathUtils.cos(angle); final float y = MathUtils.sin(angle); currEx.position.set(centerX, centerY, centerZ).add(sxEx.x * x + syEx.x * y, sxEx.y * x + syEx.y * y, sxEx.z * x + syEx.z * y); currEx.uv.set(.5f + .5f * x, .5f + .5f * y); i1 = vertex(currEx); if (innerWidth <= 0f || innerHeight <= 0f) { if (i != 0) triangle(i1, i2, center); i2 = i1; } else if (innerWidth == width && innerHeight == height) { if (i != 0) line(i1, i2); i2 = i1; } else { currIn.position.set(centerX, centerY, centerZ).add(sxIn.x * x + syIn.x * y, sxIn.y * x + syIn.y * y, sxIn.z * x + syIn.z * y); currIn.uv.set(.5f + us * x, .5f + vs * y); i2 = i1; i1 = vertex(currIn); if (i != 0) rect(i1, i2, i4, i3); i4 = i2; i3 = i1; } } }
From source file:gaia.cu9.ari.gaiaorbit.util.g3d.ModelBuilder2.java
License:Apache License
/** Convenience method to create a model which represents a grid of lines on the XZ plane. The resources the Material might * contain are not managed, use {@link Model#manageDisposable(Disposable)} to add those to the model. * @param xDivisions row count along x axis. * @param zDivisions row count along z axis. * @param xSize Length of a single row on x. * @param zSize Length of a single row on z. */ public Model createLineGrid(int xDivisions, int zDivisions, float xSize, float zSize, Material material, long attributes) { begin();/* www. ja va 2 s .c o m*/ MeshPartBuilder2 partBuilder = part("lines", GL20.GL_LINES, attributes, material); float xlength = xDivisions * xSize, zlength = zDivisions * zSize, hxlength = xlength / 2, hzlength = zlength / 2; float x1 = -hxlength, y1 = 0, z1 = hzlength, x2 = -hxlength, y2 = 0, z2 = -hzlength; for (int i = 0; i <= xDivisions; ++i) { partBuilder.line(x1, y1, z1, x2, y2, z2); x1 += xSize; x2 += xSize; } x1 = -hxlength; y1 = 0; z1 = -hzlength; x2 = hxlength; y2 = 0; z2 = -hzlength; for (int j = 0; j <= zDivisions; ++j) { partBuilder.line(x1, y1, z1, x2, y2, z2); z1 += zSize; z2 += zSize; } return end(); }
From source file:mobi.shad.s3lib.gfx.node.filter.FxObject3D.java
License:Apache License
/** * *//*from ww w. ja v a2 s.c o m*/ @Override protected void processLocal() { data.type = Data.Type.EFFECT_3D; if (formGui != null) { objectType = formGui.getInt("objectType"); objectId = formGui.getInt("objectName"); } switch (objectType) { default: data.primitiveType = GL20.GL_POINTS; break; case 1: data.primitiveType = GL20.GL_LINES; break; case 2: data.primitiveType = GL20.GL_TRIANGLES; break; } switch (objectId) { default: data.objectMesh = Cube.cube(2.0f, 2.0f, 2.0f); break; case 1: data.objectMesh = Sphere.sphere(2.0f, 2.0f, 2.0f, 10f, 10f); break; case 2: data.objectMesh = Cylinder.cylinder(2.0f, 2.0f, 10f, 10f); break; case 3: data.objectMesh = Plane.plane(2.0f, 2.0f); break; } }
From source file:mobi.shad.s3lib.gfx.node.filter.FxPoint3D.java
License:Apache License
/** * *//*from w w w. java2s . c o m*/ @Override protected void processLocal() { data.type = Data.Type.EFFECT_3D; if (formGui != null) { objectType = formGui.getInt("objectType"); countX = formGui.getInt("countX"); countY = formGui.getInt("countY"); countStepX = formGui.getFloat("countStepX") / 10; countStepY = formGui.getFloat("countStepY") / 10; speedX1 = formGui.getFloat("speedX1"); speedY1 = formGui.getFloat("speedY1"); stepX1 = formGui.getFloat("stepX1"); stepY1 = formGui.getFloat("stepY1"); amplitudeX1 = formGui.getFloat("amplitudeX1") / 10; amplitudeY1 = formGui.getFloat("amplitudeY1") / 10; speedX2 = formGui.getFloat("speedX2"); speedY2 = formGui.getFloat("speedY2"); stepX2 = formGui.getFloat("stepX2"); stepY2 = formGui.getFloat("stepY2"); amplitudeX2 = formGui.getFloat("amplitudeX2") / 10; amplitudeY2 = formGui.getFloat("amplitudeY2") / 10; speedX3 = formGui.getFloat("speedX3"); speedY3 = formGui.getFloat("speedY3"); stepX3 = formGui.getFloat("stepX3"); stepY3 = formGui.getFloat("stepY3"); amplitudeX3 = formGui.getFloat("amplitudeX3") / 10; amplitudeY3 = formGui.getFloat("amplitudeY3") / 10; } switch (objectType) { default: data.primitiveType = GL20.GL_POINTS; break; case 1: data.primitiveType = GL20.GL_LINES; break; case 2: data.primitiveType = GL20.GL_TRIANGLES; break; } data.objectMesh = new ObjectMesh(false, true, false); data.objectMesh.useIndicesIndex = false; int tmpC = countX * countY; for (int i = 0; i < tmpC; i++) { data.objectMesh.addVertex((float) Math.round(data.startX + S3Math.randomize(data.width, data.centerX)), (float) Math.round(data.startY + S3Math.randomize(data.height, data.centerY)), (float) Math.round(data.startY + S3Math.randomize(data.height, data.centerX))); } }
From source file:mobi.shad.s3lib.gfx.node.filter.FxSinusLine.java
License:Apache License
/** * *///from w ww . ja v a2 s . com @Override protected void processLocal() { if (formGui != null) { count = formGui.getInt("count"); speed = formGui.getFloat("speed1"); step = formGui.getFloat("step1"); amplitudeX = formGui.getFloat("amplitudeX1") * data.width / 5.0f; amplitudeY = formGui.getFloat("amplitudeY1") * data.height / 5.0f; multiplerX = formGui.getFloat("multiplerX1"); multiplerY = formGui.getFloat("multiplerY1"); speed2 = formGui.getFloat("speed2"); step2 = formGui.getFloat("step2"); amplitudeX2 = formGui.getFloat("amplitudeX2") * data.width / 5.0f; amplitudeY2 = formGui.getFloat("amplitudeY2") * data.height / 5.0f; multiplerX2 = formGui.getFloat("multiplerX2"); multiplerY2 = formGui.getFloat("multiplerY2"); } data.type = Data.Type.EFFECT_2D; data.primitiveType = GL20.GL_LINES; data.objectMesh = new ObjectMesh(false, true, false); data.objectMesh.useIndicesIndex = false; for (int i = 0; i < count; i++) { data.objectMesh.addVertex(0, 0); } S3Log.log("processLocal", data.objectMesh.toString()); }
From source file:org.bladecoder.bladeengine.util.Utils3D.java
License:Apache License
private static void createAxes() { ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.begin();//ww w.j a v a 2 s .c om MeshPartBuilder builder = modelBuilder.part("grid", GL20.GL_LINES, Usage.Position | Usage.Color, new Material()); builder.setColor(Color.LIGHT_GRAY); for (float t = GRID_MIN; t <= GRID_MAX; t += GRID_STEP) { builder.line(t, 0, GRID_MIN, t, 0, GRID_MAX); builder.line(GRID_MIN, 0, t, GRID_MAX, 0, t); } builder = modelBuilder.part("axes", GL20.GL_LINES, Usage.Position | Usage.Color, new Material()); builder.setColor(Color.RED); builder.line(0, 0, 0, 10, 0, 0); builder.setColor(Color.GREEN); builder.line(0, 0, 0, 0, 10, 0); builder.setColor(Color.BLUE); builder.line(0, 0, 0, 0, 0, 10); axesModel = modelBuilder.end(); axesInstance = new ModelInstance(axesModel); }