remove the pair

This commit is contained in:
yugecin 2017-03-05 21:20:56 +01:00
parent 2f1f860ca3
commit 8d19288f81
3 changed files with 13 additions and 20 deletions

View File

@ -660,14 +660,4 @@ public class Utils {
(float) (Options.height / 2d + Math.sin(ang) * d) (float) (Options.height / 2d + Math.sin(ang) * d)
}; };
} }
public static class Pair<F, S> {
public F first;
public S second;
public Pair(F first, S second) {
this.first = first;
this.second = second;
}
}
} }

View File

@ -26,7 +26,8 @@ import itdelatrisu.opsu.objects.curves.Vec2f;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
import java.nio.IntBuffer; import java.nio.IntBuffer;
import java.util.LinkedList; import java.util.Iterator;
import java.util.List;
import org.lwjgl.BufferUtils; import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.EXTFramebufferObject; import org.lwjgl.opengl.EXTFramebufferObject;
@ -70,7 +71,7 @@ public class CurveRenderState {
private int spliceFrom; private int spliceFrom;
private int spliceTo; private int spliceTo;
protected LinkedList<Utils.Pair<Integer, Integer>> pointsToRender; protected List<Integer> pointsToRender;
private final int mirrors; private final int mirrors;
@ -141,7 +142,7 @@ public class CurveRenderState {
lastPointDrawn = -1; // force redraw lastPointDrawn = -1; // force redraw
} }
public void draw(Color color, Color borderColor, LinkedList<Utils.Pair<Integer, Integer>> pointsToRender) { public void draw(Color color, Color borderColor, List<Integer> pointsToRender) {
lastPointDrawn = -1; lastPointDrawn = -1;
firstPointDrawn = -1; firstPointDrawn = -1;
this.pointsToRender = pointsToRender; this.pointsToRender = pointsToRender;
@ -386,8 +387,9 @@ public class CurveRenderState {
} }
private void renderCurve(int mirror) { private void renderCurve(int mirror) {
for (Utils.Pair<Integer, Integer> point : pointsToRender) { Iterator<Integer> iter = pointsToRender.iterator();
for (int i = point.first * 2; i < point.second * 2 - 1; ++i) { while (iter.hasNext()) {
for (int i = iter.next() * 2, end = iter.next() * 2 - 1; i < end; ++i) {
final int index = i + curve.length * 2 * mirror; final int index = i + curve.length * 2 * mirror;
GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, index * (NewCurveStyleState.DIVIDES + 2), NewCurveStyleState.DIVIDES + 2); GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, index * (NewCurveStyleState.DIVIDES + 2), NewCurveStyleState.DIVIDES + 2);
} }

View File

@ -17,23 +17,23 @@
*/ */
package yugecin.opsudance.objects.curves; package yugecin.opsudance.objects.curves;
import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.beatmap.HitObject; import itdelatrisu.opsu.beatmap.HitObject;
import itdelatrisu.opsu.objects.curves.Curve; import itdelatrisu.opsu.objects.curves.Curve;
import itdelatrisu.opsu.objects.curves.Vec2f; import itdelatrisu.opsu.objects.curves.Vec2f;
import itdelatrisu.opsu.render.CurveRenderState; import itdelatrisu.opsu.render.CurveRenderState;
import org.newdawn.slick.Color; import org.newdawn.slick.Color;
import java.util.LinkedList; import java.util.ArrayList;
import java.util.List;
public class FakeCombinedCurve extends Curve { public class FakeCombinedCurve extends Curve {
private LinkedList<Utils.Pair<Integer, Integer>> pointsToRender; private List<Integer> pointsToRender;
public FakeCombinedCurve(Vec2f[] points) { public FakeCombinedCurve(Vec2f[] points) {
super(new HitObject(0, 0, 0), false); super(new HitObject(0, 0, 0), false);
this.curve = points; this.curve = points;
pointsToRender = new LinkedList<>(); pointsToRender = new ArrayList<>();
} }
public void initForFrame() { public void initForFrame() {
@ -41,7 +41,8 @@ public class FakeCombinedCurve extends Curve {
} }
public void addRange(int from, int to) { public void addRange(int from, int to) {
pointsToRender.add(new Utils.Pair<>(from, to)); pointsToRender.add(from);
pointsToRender.add(to);
} }
@Override @Override