Minor style changes from #134.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-09-18 16:02:19 -04:00
parent daf3a2aad3
commit 14496050ea
5 changed files with 33 additions and 43 deletions

View File

@ -907,7 +907,7 @@ public class GameData {
float oldColorAlpha = hitResult.color.a;
Colors.WHITE_FADE.a = alpha;
hitResult.color.a = alpha;
hitResult.curve.draw(hitResult.color,1.0f);
hitResult.curve.draw(hitResult.color);
Colors.WHITE_FADE.a = oldWhiteAlpha;
hitResult.color.a = oldColorAlpha;
}

View File

@ -188,12 +188,7 @@ public class Slider implements GameObject {
Image hitCircle = GameImage.HITCIRCLE.getImage();
Vec2f endPos = curve.pointAt(1);
float curveInterval;
if(Options.isSliderSnaking()){
curveInterval = alpha;
} else {
curveInterval = 1.0f;
}
float curveInterval = Options.isSliderSnaking() ? alpha : 1f;
curve.draw(color,curveInterval);
color.a = alpha;
@ -240,18 +235,12 @@ public class Slider implements GameObject {
if (hitObject.getRepeatCount() - 1 > tcurRepeat) {
Image arrow = GameImage.REVERSEARROW.getImage();
if (tcurRepeat != currentRepeats) {
if (sliderTime == 0) {
if (sliderTime == 0)
continue;
}
float t = Math.max(getT(trackPosition, true), 0);
arrow.setAlpha((float) (t - Math.floor(t)));
} else {
if(Options.isSliderSnaking()){
arrow.setAlpha(decorationsAlpha);
} else {
arrow.setAlpha(1f);
}
}
} else
arrow.setAlpha(Options.isSliderSnaking() ? decorationsAlpha : 1f);
if (tcurRepeat % 2 == 0) {
// last circle
arrow.setRotation(curve.getEndAngle());

View File

@ -111,6 +111,12 @@ public abstract class Curve {
*/
public abstract Vec2f pointAt(float t);
/**
* Draws the full curve to the graphics context.
* @param color the color filter
*/
public void draw(Color color) { draw(color, 1f); }
/**
* Draws the curve in the range [0, t] (where the full range is [0, 1]) to the graphics context.
* @param color the color filter
@ -120,7 +126,8 @@ public abstract class Curve {
if (curve == null)
return;
t = Utils.clamp(t, 0.0f, 1.0f);
t = Utils.clamp(t, 0f, 1f);
// peppysliders
if (Options.getSkin().getSliderStyle() == Skin.STYLE_PEPPYSLIDER || !mmsliderSupported) {
int drawUpTo = (int) (curve.length * t);

View File

@ -59,10 +59,10 @@ public class CurveRenderState {
/** The HitObject associated with the curve to be drawn. */
protected HitObject hitObject;
/** the points along the curve to be drawn */
/** The points along the curve to be drawn. */
protected Vec2f[] curve;
/** The point to which the curve has last been rendered into the texture (as an index into {@code curve}) */
/** The point to which the curve has last been rendered into the texture (as an index into {@code curve}). */
private int lastPointDrawn;
/**
@ -131,10 +131,8 @@ public class CurveRenderState {
int drawUpTo = (int) (t * curve.length);
if (lastPointDrawn != drawUpTo) {
if (drawUpTo == lastPointDrawn) {
if (drawUpTo == lastPointDrawn)
return;
}
int oldFb = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
int oldTex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
@ -269,8 +267,7 @@ public class CurveRenderState {
* curve into the OpenGL buffer with the ID specified by {@code bufferID}
* @param bufferID the buffer ID for the OpenGL buffer the vertices should be written into
*/
private void createVertexBuffer(int bufferID)
{
private void createVertexBuffer(int bufferID) {
int arrayBufferBinding = GL11.glGetInteger(GL15.GL_ARRAY_BUFFER_BINDING);
FloatBuffer buff = BufferUtils.createByteBuffer(4 * (4 + 2) * (2 * curve.length - 1) * (NewCurveStyleState.DIVIDES + 2)).asFloatBuffer();
for (int i = 0; i < curve.length; ++i) {
@ -335,8 +332,7 @@ public class CurveRenderState {
float offy = 1.0f;
float radius = scale / 2;
for(int i = 0; i<NewCurveStyleState.unitCone.length/6; ++i)
{
for (int i = 0; i < NewCurveStyleState.unitCone.length / 6; ++i) {
buff.put(NewCurveStyleState.unitCone[i * 6 + 0]);
buff.put(NewCurveStyleState.unitCone[i * 6 + 1]);
buff.put(offx + (x1 + radius * NewCurveStyleState.unitCone[i * 6 + 2]) / divx);
@ -417,7 +413,6 @@ public class CurveRenderState {
int index = 0;
//check if initialization has already happened
if (unitCone[0] == 0.0f) {
//tip of the cone
//vec2 texture coordinates
unitCone[index++] = 1.0f;
@ -448,7 +443,6 @@ public class CurveRenderState {
unitCone[index++] = 1.0f;
unitCone[index++] = 1.0f;
}
}
/**

View File

@ -32,7 +32,7 @@ public class Rendertarget {
/** The dimensions. */
public final int width, height;
/** ID of the vertex buffer associated with this rendertarget*/
/** The ID of the vertex buffer associated with this rendertarget. */
private final int vboID;
/** The FBO ID. */