visualizer circle is now properly drawn

This commit is contained in:
Harrison Deng 2018-02-12 21:47:18 -06:00
parent 768f562a25
commit 882600abc6
2 changed files with 5 additions and 5 deletions

View File

@ -40,7 +40,7 @@ import zero1hd.rhythmbullet.util.AdvancedResizeScreen;
public class RhythmBullet extends Game {
public static final int WORLD_WIDTH = 64;
public static final int WORLD_HEIGHT = 48;
public static final int SPAWN_CIRCLE_RADIUS = 4;
public static final int SPAWN_CIRCLE_RADIUS = 6;
public static int pixels_per_unit;
private boolean initComplete = false;
private boolean resizing;

View File

@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.VertexAttribute;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
@ -31,7 +32,7 @@ public class CircularVisualizer extends Visualizer implements Disposable {
Gdx.app.debug("Circular visualizer shader", shader.getLog());
Gdx.app.exit();
}
r = RhythmBullet.pixels_per_unit*2;
r = RhythmBullet.pixels_per_unit*RhythmBullet.SPAWN_CIRCLE_RADIUS;
}
/**
@ -63,8 +64,6 @@ public class CircularVisualizer extends Visualizer implements Disposable {
public void drawVisualizer() {
for (int circlePointIndex = 0; circlePointIndex < circlePoints.length; circlePointIndex++) {
System.out.print("("+ circlePoints[circlePointIndex][0] + "," + circlePoints[circlePointIndex][1] + "),");
for (int componentIndex = 0; componentIndex < componentCount; componentIndex++) {
int index = circlePointIndex*componentCount + componentIndex;
@ -86,11 +85,12 @@ public class CircularVisualizer extends Visualizer implements Disposable {
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
int vertexCount = circlePoints.length;
((OrthographicCamera) camera).setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
shader.begin();
shader.setUniformMatrix("u_projTrans", camera.combined);
mesh.render(shader, GL20.GL_TRIANGLES, 0, vertexCount);
mesh.render(shader, GL20.GL_TRIANGLE_FAN, 0, vertexCount);
shader.end();
Gdx.gl.glDepthMask(true);