Merge branch 'mergemirror'
This commit is contained in:
commit
bcb805a23a
|
@ -541,6 +541,17 @@ public class Options {
|
||||||
return !FALLBACK_SLIDERS.bool;
|
return !FALLBACK_SLIDERS.bool;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
MERGING_SLIDERS_MIRROR_POOL ("Merging sliders mirror pool", "MergingSliderMirrorPool", "Amount of mirrors to calculate for merging sliders (impacts performance)", 2, 1, 5) {
|
||||||
|
@Override
|
||||||
|
public String getValueString() {
|
||||||
|
return String.valueOf(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean showCondition() {
|
||||||
|
return MERGING_SLIDERS.showCondition() && MERGING_SLIDERS.getBooleanValue();
|
||||||
|
}
|
||||||
|
},
|
||||||
DRAW_SLIDER_ENDCIRCLES ("Draw slider endcircles", "DrawSliderEndCircles", "Old slider style", false),
|
DRAW_SLIDER_ENDCIRCLES ("Draw slider endcircles", "DrawSliderEndCircles", "Old slider style", false),
|
||||||
SHOW_HIT_LIGHTING ("Show Hit Lighting", "HitLighting", "Adds an effect behind hit explosions.", true),
|
SHOW_HIT_LIGHTING ("Show Hit Lighting", "HitLighting", "Adds an effect behind hit explosions.", true),
|
||||||
SHOW_HIT_ANIMATIONS ("Show Hit Animations", "HitAnimations", "Fade out circles and curves.", true),
|
SHOW_HIT_ANIMATIONS ("Show Hit Animations", "HitAnimations", "Fade out circles and curves.", true),
|
||||||
|
@ -1544,6 +1555,7 @@ public class Options {
|
||||||
|
|
||||||
public static boolean isShrinkingSliders() { return GameOption.SHRINKING_SLIDERS.getBooleanValue(); }
|
public static boolean isShrinkingSliders() { return GameOption.SHRINKING_SLIDERS.getBooleanValue(); }
|
||||||
public static boolean isMergingSliders() { return !isFallbackSliders() && GameOption.MERGING_SLIDERS.getBooleanValue(); }
|
public static boolean isMergingSliders() { return !isFallbackSliders() && GameOption.MERGING_SLIDERS.getBooleanValue(); }
|
||||||
|
public static int getMergingSlidersMirrorPool() { return GameOption.MERGING_SLIDERS_MIRROR_POOL.getIntegerValue(); }
|
||||||
public static boolean isDrawSliderEndCircles() { return GameOption.DRAW_SLIDER_ENDCIRCLES.getBooleanValue(); }
|
public static boolean isDrawSliderEndCircles() { return GameOption.DRAW_SLIDER_ENDCIRCLES.getBooleanValue(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -661,4 +661,15 @@ public class Utils {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float[] mirrorPoint(float x, float y, float degrees) {
|
||||||
|
double dx = x - Options.width / 2d;
|
||||||
|
double dy = y - Options.height / 2d;
|
||||||
|
double ang = Math.atan2(dy, dx) + (degrees * Math.PI / 180d);
|
||||||
|
double d = Math.sqrt(dx * dx + dy * dy);
|
||||||
|
return new float[]{
|
||||||
|
(float) (Options.width / 2d + Math.cos(ang) * d),
|
||||||
|
(float) (Options.height / 2d + Math.sin(ang) * d)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.lwjgl.opengl.GLContext;
|
||||||
import org.newdawn.slick.Color;
|
import org.newdawn.slick.Color;
|
||||||
import org.newdawn.slick.Image;
|
import org.newdawn.slick.Image;
|
||||||
import org.newdawn.slick.util.Log;
|
import org.newdawn.slick.util.Log;
|
||||||
|
import yugecin.opsudance.objects.curves.FakeCombinedCurve;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Representation of a curve.
|
* Representation of a curve.
|
||||||
|
@ -149,14 +150,14 @@ public abstract class Curve {
|
||||||
// mmsliders
|
// mmsliders
|
||||||
else {
|
else {
|
||||||
if (renderState == null)
|
if (renderState == null)
|
||||||
renderState = new CurveRenderState(hitObject, curve);
|
renderState = new CurveRenderState(hitObject, curve, this instanceof FakeCombinedCurve);
|
||||||
renderState.draw(color, borderColor, from, to);
|
renderState.draw(color, borderColor, from, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void splice(int from, int to) {
|
public void splice(int from, int to) {
|
||||||
if (renderState == null)
|
if (renderState == null)
|
||||||
renderState = new CurveRenderState(hitObject, curve);
|
renderState = new CurveRenderState(hitObject, curve, this instanceof FakeCombinedCurve);
|
||||||
renderState.splice(from, to);
|
renderState.splice(from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package itdelatrisu.opsu.render;
|
package itdelatrisu.opsu.render;
|
||||||
|
|
||||||
import itdelatrisu.opsu.GameImage;
|
import itdelatrisu.opsu.GameImage;
|
||||||
|
import itdelatrisu.opsu.Options;
|
||||||
import itdelatrisu.opsu.Utils;
|
import itdelatrisu.opsu.Utils;
|
||||||
import itdelatrisu.opsu.beatmap.HitObject;
|
import itdelatrisu.opsu.beatmap.HitObject;
|
||||||
import itdelatrisu.opsu.objects.Circle;
|
import itdelatrisu.opsu.objects.Circle;
|
||||||
|
@ -31,7 +32,6 @@ import org.lwjgl.BufferUtils;
|
||||||
import org.lwjgl.opengl.EXTFramebufferObject;
|
import org.lwjgl.opengl.EXTFramebufferObject;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.opengl.GL13;
|
import org.lwjgl.opengl.GL13;
|
||||||
import org.lwjgl.opengl.GL14;
|
|
||||||
import org.lwjgl.opengl.GL15;
|
import org.lwjgl.opengl.GL15;
|
||||||
import org.lwjgl.opengl.GL20;
|
import org.lwjgl.opengl.GL20;
|
||||||
import org.newdawn.slick.Color;
|
import org.newdawn.slick.Color;
|
||||||
|
@ -69,6 +69,8 @@ public class CurveRenderState {
|
||||||
private int spliceFrom;
|
private int spliceFrom;
|
||||||
private int spliceTo;
|
private int spliceTo;
|
||||||
|
|
||||||
|
private final int mirrors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the width and height of the container that Curves get drawn into.
|
* Set the width and height of the container that Curves get drawn into.
|
||||||
* Should be called before any curves are drawn.
|
* Should be called before any curves are drawn.
|
||||||
|
@ -102,9 +104,14 @@ public class CurveRenderState {
|
||||||
* @param hitObject the HitObject that represents this curve, just used as a unique ID
|
* @param hitObject the HitObject that represents this curve, just used as a unique ID
|
||||||
* @param curve the points along the curve to be drawn
|
* @param curve the points along the curve to be drawn
|
||||||
*/
|
*/
|
||||||
public CurveRenderState(HitObject hitObject, Vec2f[] curve) {
|
public CurveRenderState(HitObject hitObject, Vec2f[] curve, boolean isKnorkeSlider) {
|
||||||
this.hitObject = hitObject;
|
this.hitObject = hitObject;
|
||||||
this.curve = curve;
|
this.curve = curve;
|
||||||
|
if (isKnorkeSlider) {
|
||||||
|
this.mirrors = Options.getMergingSlidersMirrorPool();
|
||||||
|
} else {
|
||||||
|
this.mirrors = 1;
|
||||||
|
}
|
||||||
initFBO();
|
initFBO();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,28 +287,32 @@ public class CurveRenderState {
|
||||||
*/
|
*/
|
||||||
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) * mirrors * (NewCurveStyleState.DIVIDES + 2)).asFloatBuffer();
|
||||||
if (curve.length > 0) {
|
if (curve.length > 0) {
|
||||||
fillCone(buff, curve[0].x, curve[0].y);
|
fillCone(buff, curve[0].x, curve[0].y, 0);
|
||||||
}
|
}
|
||||||
for (int i = 1; i < curve.length; ++i) {
|
|
||||||
float x = curve[i].x;
|
for (int mirror = 0; mirror < mirrors; mirror++) {
|
||||||
float y = curve[i].y;
|
final float angle = 360f * mirror / mirrors;
|
||||||
fillCone(buff, x, y);
|
for (int i = 1; i < curve.length; ++i) {
|
||||||
float last_x = curve[i - 1].x;
|
float x = curve[i].x;
|
||||||
float last_y = curve[i - 1].y;
|
float y = curve[i].y;
|
||||||
double diff_x = x - last_x;
|
fillCone(buff, x, y, angle);
|
||||||
double diff_y = y - last_y;
|
float last_x = curve[i - 1].x;
|
||||||
float dist = Utils.distance(x, y, last_x, last_y);
|
float last_y = curve[i - 1].y;
|
||||||
if (dist < Circle.diameter / 8) {
|
double diff_x = x - last_x;
|
||||||
x = (float) (x - diff_x / 2);
|
double diff_y = y - last_y;
|
||||||
y = (float) (y - diff_y / 2);
|
float dist = Utils.distance(x, y, last_x, last_y);
|
||||||
} else {
|
if (dist < Circle.diameter / 8) {
|
||||||
// don't mind me
|
x = (float) (x - diff_x / 2);
|
||||||
x = -100f;
|
y = (float) (y - diff_y / 2);
|
||||||
y = -100f;
|
} else {
|
||||||
|
// don't mind me
|
||||||
|
x = -100f;
|
||||||
|
y = -100f;
|
||||||
|
}
|
||||||
|
fillCone(buff, x, y, angle);
|
||||||
}
|
}
|
||||||
fillCone(buff, x, y);
|
|
||||||
}
|
}
|
||||||
buff.flip();
|
buff.flip();
|
||||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, bufferID);
|
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, bufferID);
|
||||||
|
@ -332,11 +343,12 @@ 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);
|
||||||
}
|
}
|
||||||
for (int i = from * 2; i < to * 2 - 1; ++i) {
|
int max = mirrors;
|
||||||
if (spliceFrom <= i && i <= spliceTo) {
|
if (!Options.isMirror()) {
|
||||||
continue;
|
max = 1;
|
||||||
}
|
}
|
||||||
GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, i * (NewCurveStyleState.DIVIDES + 2), NewCurveStyleState.DIVIDES + 2);
|
for (int i = 0; i < max; i++) {
|
||||||
|
renderCurve(from, to, i);
|
||||||
}
|
}
|
||||||
GL11.glFlush();
|
GL11.glFlush();
|
||||||
GL20.glDisableVertexAttribArray(staticState.texCoordLoc);
|
GL20.glDisableVertexAttribArray(staticState.texCoordLoc);
|
||||||
|
@ -344,6 +356,20 @@ public class CurveRenderState {
|
||||||
restoreRenderState(state);
|
restoreRenderState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void renderCurve(int from, int to, int mirror) {
|
||||||
|
if (from > 0) {
|
||||||
|
from -= mirror;
|
||||||
|
}
|
||||||
|
to -= mirror;
|
||||||
|
for (int i = from * 2; i < to * 2 - 1; ++i) {
|
||||||
|
if (spliceFrom <= i && i <= spliceTo) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
final int index = i + curve.length * 2 * mirror;
|
||||||
|
GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, index * (NewCurveStyleState.DIVIDES + 2), NewCurveStyleState.DIVIDES + 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill {@code buff} with the texture coordinates and positions for a cone
|
* Fill {@code buff} with the texture coordinates and positions for a cone
|
||||||
* that has its center at the coordinates {@code (x1,y1)}.
|
* that has its center at the coordinates {@code (x1,y1)}.
|
||||||
|
@ -351,7 +377,12 @@ public class CurveRenderState {
|
||||||
* @param x1 x-coordinate of the cone
|
* @param x1 x-coordinate of the cone
|
||||||
* @param y1 y-coordinate of the cone
|
* @param y1 y-coordinate of the cone
|
||||||
*/
|
*/
|
||||||
protected void fillCone(FloatBuffer buff, float x1, float y1) {
|
protected void fillCone(FloatBuffer buff, float x1, float y1, float angle) {
|
||||||
|
if (mirrors > 1) {
|
||||||
|
float[] m = Utils.mirrorPoint(x1, y1, angle);
|
||||||
|
x1 = m[0];
|
||||||
|
y1 = m[1];
|
||||||
|
}
|
||||||
float divx = containerWidth / 2.0f;
|
float divx = containerWidth / 2.0f;
|
||||||
float divy = containerHeight / 2.0f;
|
float divy = containerHeight / 2.0f;
|
||||||
float offx = -1.0f;
|
float offx = -1.0f;
|
||||||
|
|
|
@ -1692,12 +1692,14 @@ public class Game extends BasicGameState {
|
||||||
|
|
||||||
if (Options.isMergingSliders() && knorkesliders != null) {
|
if (Options.isMergingSliders() && knorkesliders != null) {
|
||||||
knorkesliders.draw(Color.white, this.slidercurveFrom, this.slidercurveTo);
|
knorkesliders.draw(Color.white, this.slidercurveFrom, this.slidercurveTo);
|
||||||
|
/*
|
||||||
if (Options.isMirror()) {
|
if (Options.isMirror()) {
|
||||||
g.pushTransform();
|
g.pushTransform();
|
||||||
g.rotate(Options.width / 2f, Options.height / 2f, 180f);
|
g.rotate(Options.width / 2f, Options.height / 2f, 180f);
|
||||||
knorkesliders.draw(Color.white, this.slidercurveFrom, this.slidercurveTo);
|
knorkesliders.draw(Color.white, this.slidercurveFrom, this.slidercurveTo);
|
||||||
g.popTransform();
|
g.popTransform();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// include previous object in follow points
|
// include previous object in follow points
|
||||||
|
|
|
@ -79,6 +79,7 @@ public class OptionsMenu extends BasicGameState implements OptionsOverlay.Parent
|
||||||
GameOption.SHRINKING_SLIDERS,
|
GameOption.SHRINKING_SLIDERS,
|
||||||
GameOption.FALLBACK_SLIDERS,
|
GameOption.FALLBACK_SLIDERS,
|
||||||
GameOption.MERGING_SLIDERS,
|
GameOption.MERGING_SLIDERS,
|
||||||
|
GameOption.MERGING_SLIDERS_MIRROR_POOL,
|
||||||
GameOption.DRAW_SLIDER_ENDCIRCLES,
|
GameOption.DRAW_SLIDER_ENDCIRCLES,
|
||||||
GameOption.SHOW_HIT_LIGHTING,
|
GameOption.SHOW_HIT_LIGHTING,
|
||||||
GameOption.SHOW_HIT_ANIMATIONS,
|
GameOption.SHOW_HIT_ANIMATIONS,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user