also use splice for non-merging sliders instead of reverse

This commit is contained in:
yugecin 2016-12-04 22:03:09 +01:00
parent 0eb09d4e0d
commit 8171cfdec6
3 changed files with 8 additions and 27 deletions

View File

@ -379,14 +379,6 @@ public class Slider extends GameObject {
float curveIntervalTo = Options.isSliderSnaking() ? snakingSliderProgress : 1f; float curveIntervalTo = Options.isSliderSnaking() ? snakingSliderProgress : 1f;
float curveIntervalFrom = 0f; float curveIntervalFrom = 0f;
if (Options.isShrinkingSliders()) { if (Options.isShrinkingSliders()) {
// 1 repeat = no repeats..
if (repeats % 2 == 0 && curveIntervalTo == 1 && !reversed) {
// fix shrinking sliders for odd repeating sliders
reversed = true;
if (!Options.isMergingSliders()) {
curve.reverse();
}
}
float sliderprogress = (trackPosition - getTime() - (sliderTime * (repeats - 1))) / sliderTime; float sliderprogress = (trackPosition - getTime() - (sliderTime * (repeats - 1))) / sliderTime;
if (sliderprogress > 0) { if (sliderprogress > 0) {
curveIntervalFrom = sliderprogress; curveIntervalFrom = sliderprogress;
@ -403,6 +395,13 @@ public class Slider extends GameObject {
} }
game.setSlidercurveTo(baseSliderFrom + (int) (curveIntervalTo * curve.getCurvePoints().length)); game.setSlidercurveTo(baseSliderFrom + (int) (curveIntervalTo * curve.getCurvePoints().length));
} else { } else {
if (Options.isShrinkingSliders() && curveIntervalFrom > 0) {
int curvelen = curve.getCurvePoints().length;
if (repeats % 2 == 0) {
curve.splice((int) ((1f - curveIntervalFrom) * curvelen), curvelen);
curveIntervalFrom = 0f;
}
}
curve.draw(curveColor, curveIntervalFrom, curveIntervalTo); curve.draw(curveColor, curveIntervalFrom, curveIntervalTo);
} }
return curveIntervalTo == 1f; return curveIntervalTo == 1f;

View File

@ -159,10 +159,6 @@ public abstract class Curve {
} }
} }
public void reverse() {
renderState.reverse();
}
public void splice(int from, int to) { public void splice(int from, int to) {
renderState.splice(from, to); renderState.splice(from, to);
} }

View File

@ -66,8 +66,6 @@ public class CurveRenderState {
private int lastPointDrawn; private int lastPointDrawn;
private int firstPointDrawn; private int firstPointDrawn;
private boolean reversed;
private int spliceFrom; private int spliceFrom;
private int spliceTo; private int spliceTo;
@ -115,14 +113,9 @@ public class CurveRenderState {
createVertexBuffer(fbo.getVbo()); createVertexBuffer(fbo.getVbo());
//write impossible value to make sure the fbo is cleared //write impossible value to make sure the fbo is cleared
lastPointDrawn = -1; lastPointDrawn = -1;
reversed = false;
spliceFrom = spliceTo = -1; spliceFrom = spliceTo = -1;
} }
public void reverse() {
reversed = !reversed;
}
public void splice(int from, int to) { public void splice(int from, int to) {
spliceFrom = from * 2; spliceFrom = from * 2;
spliceTo = to * 2; spliceTo = to * 2;
@ -340,14 +333,7 @@ public class CurveRenderState {
if (clearFirst) { if (clearFirst) {
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
} }
from = from * 2; for (int i = from * 2; i < to * 2 - 1; ++i) {
to = to * 2 - 1;
if (reversed) {
int a = from;
from = curve.length * 2 - 1 - to;
to = curve.length * 2 - 1 - a;
}
for (int i = from; i < to; ++i) {
if (spliceFrom <= i && i <= spliceTo) { if (spliceFrom <= i && i <= spliceTo) {
continue; continue;
} }