recolor the slider border from the skin or beatmap settings
This commit is contained in:
parent
447a0f371a
commit
890a69c1a9
|
@ -18,7 +18,9 @@
|
||||||
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.audio.MusicController;
|
||||||
import itdelatrisu.opsu.beatmap.HitObject;
|
import itdelatrisu.opsu.beatmap.HitObject;
|
||||||
import itdelatrisu.opsu.objects.curves.Vec2f;
|
import itdelatrisu.opsu.objects.curves.Vec2f;
|
||||||
|
|
||||||
|
@ -260,6 +262,12 @@ public class CurveRenderState {
|
||||||
GL20.glEnableVertexAttribArray(staticState.texCoordLoc);
|
GL20.glEnableVertexAttribArray(staticState.texCoordLoc);
|
||||||
GL20.glUniform1i(staticState.texLoc, 0);
|
GL20.glUniform1i(staticState.texLoc, 0);
|
||||||
GL20.glUniform3f(staticState.colLoc, color.r, color.g, color.b);
|
GL20.glUniform3f(staticState.colLoc, color.r, color.g, color.b);
|
||||||
|
Color borderColor;
|
||||||
|
if(Options.isBeatmapSkinIgnored())
|
||||||
|
borderColor = Options.getSkin().getSliderBorderColor();
|
||||||
|
else
|
||||||
|
borderColor = MusicController.getBeatmap().getSliderBorderColor();
|
||||||
|
GL20.glUniform4f(staticState.colBorderLoc,borderColor.r,borderColor.g,borderColor.b,borderColor.a);
|
||||||
//stride is 6*4 for the floats (4 bytes) (u,v)(x,y,z,w)
|
//stride is 6*4 for the floats (4 bytes) (u,v)(x,y,z,w)
|
||||||
//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);
|
||||||
|
@ -348,6 +356,9 @@ public class CurveRenderState {
|
||||||
/** OpenGL shader uniform location of the color attribute. */
|
/** OpenGL shader uniform location of the color attribute. */
|
||||||
protected int colLoc = 0;
|
protected int colLoc = 0;
|
||||||
|
|
||||||
|
/** OpenGL shader uniform location of the border color attribute */
|
||||||
|
protected int colBorderLoc = 0;
|
||||||
|
|
||||||
/** OpenGL shader uniform location of the texture sampler attribute. */
|
/** OpenGL shader uniform location of the texture sampler attribute. */
|
||||||
protected int texLoc = 0;
|
protected int texLoc = 0;
|
||||||
|
|
||||||
|
@ -408,6 +419,7 @@ public class CurveRenderState {
|
||||||
+ "uniform sampler1D tex;\n"
|
+ "uniform sampler1D tex;\n"
|
||||||
+ "uniform vec2 tex_size;\n"
|
+ "uniform vec2 tex_size;\n"
|
||||||
+ "uniform vec3 col_tint;\n"
|
+ "uniform vec3 col_tint;\n"
|
||||||
|
+ "uniform vec4 col_border;\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "in vec2 tex_coord;\n"
|
+ "in vec2 tex_coord;\n"
|
||||||
+ "layout(location = 0) out vec4 out_colour;\n"
|
+ "layout(location = 0) out vec4 out_colour;\n"
|
||||||
|
@ -416,7 +428,7 @@ public class CurveRenderState {
|
||||||
+ "{\n"
|
+ "{\n"
|
||||||
+ " vec4 in_color = texture(tex, tex_coord.x);\n"
|
+ " vec4 in_color = texture(tex, tex_coord.x);\n"
|
||||||
+ " float blend_factor = in_color.r-in_color.b;\n"
|
+ " float blend_factor = in_color.r-in_color.b;\n"
|
||||||
+ " vec4 new_color = vec4(mix(in_color.xyz,col_tint,blend_factor),in_color.w);\n"
|
+ " vec4 new_color = vec4(mix(in_color.xyz*col_border.xyz,col_tint,blend_factor),in_color.w);\n"
|
||||||
+ " out_colour = new_color;\n"
|
+ " out_colour = new_color;\n"
|
||||||
+ "}");
|
+ "}");
|
||||||
GL20.glCompileShader(frgShdr);
|
GL20.glCompileShader(frgShdr);
|
||||||
|
@ -437,6 +449,7 @@ public class CurveRenderState {
|
||||||
texCoordLoc = GL20.glGetAttribLocation(program, "in_tex_coord");
|
texCoordLoc = GL20.glGetAttribLocation(program, "in_tex_coord");
|
||||||
texLoc = GL20.glGetUniformLocation(program, "tex");
|
texLoc = GL20.glGetUniformLocation(program, "tex");
|
||||||
colLoc = GL20.glGetUniformLocation(program, "col_tint");
|
colLoc = GL20.glGetUniformLocation(program, "col_tint");
|
||||||
|
colBorderLoc = GL20.glGetUniformLocation(program, "col_border");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class Skin {
|
||||||
private static final Color DEFAULT_MENU_GLOW = new Color(0, 78, 155);
|
private static final Color DEFAULT_MENU_GLOW = new Color(0, 78, 155);
|
||||||
|
|
||||||
/** The default slider border color. */
|
/** The default slider border color. */
|
||||||
private static final Color DEFAULT_SLIDER_BORDER = new Color(38, 38, 38);
|
private static final Color DEFAULT_SLIDER_BORDER = new Color(255, 255, 255);
|
||||||
|
|
||||||
/** The default slider ball color. */
|
/** The default slider ball color. */
|
||||||
private static final Color DEFAULT_SLIDER_BALL = new Color(2, 170, 255);
|
private static final Color DEFAULT_SLIDER_BALL = new Color(2, 170, 255);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user