attemt to fix shrinking sliders with odd amount of repeats with merged slider rendering

This commit is contained in:
yugecin
2016-12-04 21:52:15 +01:00
parent 50f475e0f7
commit a3af1c71b8
4 changed files with 32 additions and 8 deletions

View File

@@ -68,6 +68,9 @@ public class CurveRenderState {
private boolean reversed;
private int spliceFrom;
private int spliceTo;
/**
* Set the width and height of the container that Curves get drawn into.
* Should be called before any curves are drawn.
@@ -113,12 +116,20 @@ public class CurveRenderState {
//write impossible value to make sure the fbo is cleared
lastPointDrawn = -1;
reversed = false;
spliceFrom = spliceTo = -1;
}
public void reverse() {
reversed = !reversed;
}
public void splice(int from, int to) {
spliceFrom = from * 2;
spliceTo = to * 2;
firstPointDrawn = -1; // force redraw
lastPointDrawn = -1; // force redraw
}
/**
* Draw a curve to the screen that's tinted with `color`. The first time
* this is called this caches the image result of the curve and on subsequent
@@ -336,8 +347,12 @@ public class CurveRenderState {
from = curve.length * 2 - 1 - to;
to = curve.length * 2 - 1 - a;
}
for (int i = from; i < to; ++i)
for (int i = from; i < to; ++i) {
if (spliceFrom <= i && i <= spliceTo) {
continue;
}
GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, i * (NewCurveStyleState.DIVIDES + 2), NewCurveStyleState.DIVIDES + 2);
}
GL11.glFlush();
GL20.glDisableVertexAttribArray(staticState.texCoordLoc);
GL20.glDisableVertexAttribArray(staticState.attribLoc);