Minor style changes from #134.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
daf3a2aad3
commit
14496050ea
|
@ -907,7 +907,7 @@ public class GameData {
|
||||||
float oldColorAlpha = hitResult.color.a;
|
float oldColorAlpha = hitResult.color.a;
|
||||||
Colors.WHITE_FADE.a = alpha;
|
Colors.WHITE_FADE.a = alpha;
|
||||||
hitResult.color.a = alpha;
|
hitResult.color.a = alpha;
|
||||||
hitResult.curve.draw(hitResult.color,1.0f);
|
hitResult.curve.draw(hitResult.color);
|
||||||
Colors.WHITE_FADE.a = oldWhiteAlpha;
|
Colors.WHITE_FADE.a = oldWhiteAlpha;
|
||||||
hitResult.color.a = oldColorAlpha;
|
hitResult.color.a = oldColorAlpha;
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,12 +188,7 @@ public class Slider implements GameObject {
|
||||||
Image hitCircle = GameImage.HITCIRCLE.getImage();
|
Image hitCircle = GameImage.HITCIRCLE.getImage();
|
||||||
Vec2f endPos = curve.pointAt(1);
|
Vec2f endPos = curve.pointAt(1);
|
||||||
|
|
||||||
float curveInterval;
|
float curveInterval = Options.isSliderSnaking() ? alpha : 1f;
|
||||||
if(Options.isSliderSnaking()){
|
|
||||||
curveInterval = alpha;
|
|
||||||
} else {
|
|
||||||
curveInterval = 1.0f;
|
|
||||||
}
|
|
||||||
curve.draw(color,curveInterval);
|
curve.draw(color,curveInterval);
|
||||||
color.a = alpha;
|
color.a = alpha;
|
||||||
|
|
||||||
|
@ -209,12 +204,12 @@ public class Slider implements GameObject {
|
||||||
|
|
||||||
// ticks
|
// ticks
|
||||||
if (ticksT != null) {
|
if (ticksT != null) {
|
||||||
float tickScale = 0.5f + 0.5f*AnimationEquation.OUT_BACK.calc(decorationsAlpha);
|
float tickScale = 0.5f + 0.5f * AnimationEquation.OUT_BACK.calc(decorationsAlpha);
|
||||||
Image tick = GameImage.SLIDER_TICK.getImage().getScaledCopy(tickScale);
|
Image tick = GameImage.SLIDER_TICK.getImage().getScaledCopy(tickScale);
|
||||||
for (int i = 0; i < ticksT.length; i++) {
|
for (int i = 0; i < ticksT.length; i++) {
|
||||||
Vec2f c = curve.pointAt(ticksT[i]);
|
Vec2f c = curve.pointAt(ticksT[i]);
|
||||||
Colors.WHITE_FADE.a = decorationsAlpha;
|
Colors.WHITE_FADE.a = decorationsAlpha;
|
||||||
tick.drawCentered(c.x , c.y , Colors.WHITE_FADE);
|
tick.drawCentered(c.x, c.y, Colors.WHITE_FADE);
|
||||||
Colors.WHITE_FADE.a = alpha;
|
Colors.WHITE_FADE.a = alpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,18 +235,12 @@ public class Slider implements GameObject {
|
||||||
if (hitObject.getRepeatCount() - 1 > tcurRepeat) {
|
if (hitObject.getRepeatCount() - 1 > tcurRepeat) {
|
||||||
Image arrow = GameImage.REVERSEARROW.getImage();
|
Image arrow = GameImage.REVERSEARROW.getImage();
|
||||||
if (tcurRepeat != currentRepeats) {
|
if (tcurRepeat != currentRepeats) {
|
||||||
if (sliderTime == 0) {
|
if (sliderTime == 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
float t = Math.max(getT(trackPosition, true), 0);
|
float t = Math.max(getT(trackPosition, true), 0);
|
||||||
arrow.setAlpha((float) (t - Math.floor(t)));
|
arrow.setAlpha((float) (t - Math.floor(t)));
|
||||||
} else {
|
} else
|
||||||
if(Options.isSliderSnaking()){
|
arrow.setAlpha(Options.isSliderSnaking() ? decorationsAlpha : 1f);
|
||||||
arrow.setAlpha(decorationsAlpha);
|
|
||||||
} else {
|
|
||||||
arrow.setAlpha(1f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tcurRepeat % 2 == 0) {
|
if (tcurRepeat % 2 == 0) {
|
||||||
// last circle
|
// last circle
|
||||||
arrow.setRotation(curve.getEndAngle());
|
arrow.setRotation(curve.getEndAngle());
|
||||||
|
|
|
@ -111,6 +111,12 @@ public abstract class Curve {
|
||||||
*/
|
*/
|
||||||
public abstract Vec2f pointAt(float t);
|
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.
|
* Draws the curve in the range [0, t] (where the full range is [0, 1]) to the graphics context.
|
||||||
* @param color the color filter
|
* @param color the color filter
|
||||||
|
@ -120,10 +126,11 @@ public abstract class Curve {
|
||||||
if (curve == null)
|
if (curve == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
t = Utils.clamp(t, 0.0f, 1.0f);
|
t = Utils.clamp(t, 0f, 1f);
|
||||||
|
|
||||||
// peppysliders
|
// peppysliders
|
||||||
if (Options.getSkin().getSliderStyle() == Skin.STYLE_PEPPYSLIDER || !mmsliderSupported) {
|
if (Options.getSkin().getSliderStyle() == Skin.STYLE_PEPPYSLIDER || !mmsliderSupported) {
|
||||||
int drawUpTo = (int)(curve.length*t);
|
int drawUpTo = (int) (curve.length * t);
|
||||||
Image hitCircle = GameImage.HITCIRCLE.getImage();
|
Image hitCircle = GameImage.HITCIRCLE.getImage();
|
||||||
Image hitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage();
|
Image hitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage();
|
||||||
for (int i = 0; i < drawUpTo; i++)
|
for (int i = 0; i < drawUpTo; i++)
|
||||||
|
@ -135,7 +142,7 @@ public abstract class Curve {
|
||||||
// mmsliders
|
// mmsliders
|
||||||
else {
|
else {
|
||||||
if (renderState == null)
|
if (renderState == null)
|
||||||
renderState = new CurveRenderState(hitObject,curve);
|
renderState = new CurveRenderState(hitObject, curve);
|
||||||
renderState.draw(color, borderColor, t);
|
renderState.draw(color, borderColor, t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,10 +59,10 @@ public class CurveRenderState {
|
||||||
/** The HitObject associated with the curve to be drawn. */
|
/** The HitObject associated with the curve to be drawn. */
|
||||||
protected HitObject hitObject;
|
protected HitObject hitObject;
|
||||||
|
|
||||||
/** the points along the curve to be drawn */
|
/** The points along the curve to be drawn. */
|
||||||
protected Vec2f[] curve;
|
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;
|
private int lastPointDrawn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,10 +131,8 @@ public class CurveRenderState {
|
||||||
int drawUpTo = (int) (t * curve.length);
|
int drawUpTo = (int) (t * curve.length);
|
||||||
|
|
||||||
if (lastPointDrawn != drawUpTo) {
|
if (lastPointDrawn != drawUpTo) {
|
||||||
|
if (drawUpTo == lastPointDrawn)
|
||||||
if (drawUpTo == lastPointDrawn) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
int oldFb = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
|
int oldFb = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
|
||||||
int oldTex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
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}
|
* 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
|
* @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);
|
int arrayBufferBinding = GL11.glGetInteger(GL15.GL_ARRAY_BUFFER_BINDING);
|
||||||
FloatBuffer buff = BufferUtils.createByteBuffer(4 * (4 + 2) * (2 * curve.length - 1) * (NewCurveStyleState.DIVIDES + 2)).asFloatBuffer();
|
FloatBuffer buff = BufferUtils.createByteBuffer(4 * (4 + 2) * (2 * curve.length - 1) * (NewCurveStyleState.DIVIDES + 2)).asFloatBuffer();
|
||||||
for (int i = 0; i < curve.length; ++i) {
|
for (int i = 0; i < curve.length; ++i) {
|
||||||
|
@ -313,7 +310,7 @@ public class CurveRenderState {
|
||||||
//2*4 is for skipping the first 2 floats (u,v)
|
//2*4 is for skipping the first 2 floats (u,v)
|
||||||
GL20.glVertexAttribPointer(staticState.attribLoc, 4, GL11.GL_FLOAT, false, 6 * 4, 2 * 4);
|
GL20.glVertexAttribPointer(staticState.attribLoc, 4, GL11.GL_FLOAT, false, 6 * 4, 2 * 4);
|
||||||
GL20.glVertexAttribPointer(staticState.texCoordLoc, 2, GL11.GL_FLOAT, false, 6 * 4, 0);
|
GL20.glVertexAttribPointer(staticState.texCoordLoc, 2, GL11.GL_FLOAT, false, 6 * 4, 0);
|
||||||
for (int i = from*2; i < to * 2 - 1; ++i)
|
for (int i = from * 2; i < to * 2 - 1; ++i)
|
||||||
GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, i * (NewCurveStyleState.DIVIDES + 2), NewCurveStyleState.DIVIDES + 2);
|
GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, i * (NewCurveStyleState.DIVIDES + 2), NewCurveStyleState.DIVIDES + 2);
|
||||||
GL11.glFlush();
|
GL11.glFlush();
|
||||||
GL20.glDisableVertexAttribArray(staticState.texCoordLoc);
|
GL20.glDisableVertexAttribArray(staticState.texCoordLoc);
|
||||||
|
@ -335,14 +332,13 @@ public class CurveRenderState {
|
||||||
float offy = 1.0f;
|
float offy = 1.0f;
|
||||||
float radius = scale / 2;
|
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+0]);
|
buff.put(NewCurveStyleState.unitCone[i * 6 + 1]);
|
||||||
buff.put(NewCurveStyleState.unitCone[i*6+1]);
|
buff.put(offx + (x1 + radius * NewCurveStyleState.unitCone[i * 6 + 2]) / divx);
|
||||||
buff.put(offx + (x1 + radius * NewCurveStyleState.unitCone[i*6+2])/divx);
|
buff.put(offy - (y1 + radius * NewCurveStyleState.unitCone[i * 6 + 3]) / divy);
|
||||||
buff.put(offy - (y1 + radius * NewCurveStyleState.unitCone[i*6+3])/divy);
|
buff.put(NewCurveStyleState.unitCone[i * 6 + 4]);
|
||||||
buff.put(NewCurveStyleState.unitCone[i*6+4]);
|
buff.put(NewCurveStyleState.unitCone[i * 6 + 5]);
|
||||||
buff.put(NewCurveStyleState.unitCone[i*6+5]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,7 +360,7 @@ public class CurveRenderState {
|
||||||
* of a cone with DIVIDES vertices at its base, that is centered around
|
* of a cone with DIVIDES vertices at its base, that is centered around
|
||||||
* (0,0) and has a radius of 1 (so that it can be translated and scaled easily).
|
* (0,0) and has a radius of 1 (so that it can be translated and scaled easily).
|
||||||
*/
|
*/
|
||||||
protected static float[] unitCone = new float[(DIVIDES+2)*6];
|
protected static float[] unitCone = new float[(DIVIDES + 2) * 6];
|
||||||
|
|
||||||
/** OpenGL shader program ID used to draw and recolor the curve. */
|
/** OpenGL shader program ID used to draw and recolor the curve. */
|
||||||
protected int program = 0;
|
protected int program = 0;
|
||||||
|
@ -417,8 +413,7 @@ public class CurveRenderState {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
//check if initialization has already happened
|
//check if initialization has already happened
|
||||||
if (unitCone[0] == 0.0f) {
|
if (unitCone[0] == 0.0f) {
|
||||||
|
//tip of the cone
|
||||||
//tip of the cone
|
|
||||||
//vec2 texture coordinates
|
//vec2 texture coordinates
|
||||||
unitCone[index++] = 1.0f;
|
unitCone[index++] = 1.0f;
|
||||||
unitCone[index++] = 0.5f;
|
unitCone[index++] = 0.5f;
|
||||||
|
@ -448,7 +443,6 @@ public class CurveRenderState {
|
||||||
unitCone[index++] = 1.0f;
|
unitCone[index++] = 1.0f;
|
||||||
unitCone[index++] = 1.0f;
|
unitCone[index++] = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class Rendertarget {
|
||||||
/** The dimensions. */
|
/** The dimensions. */
|
||||||
public final int width, height;
|
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;
|
private final int vboID;
|
||||||
|
|
||||||
/** The FBO ID. */
|
/** The FBO ID. */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user