Skip to content

Commit

Permalink
color picker knob and border invisible
Browse files Browse the repository at this point in the history
cant seem to fix hue slider not translucent
  • Loading branch information
Goby56 committed Jan 28, 2025
1 parent f527143 commit c79b5fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
25 changes: 13 additions & 12 deletions src/main/java/com/goby56/wakes/config/gui/ColorPicker.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ protected void renderButton(DrawContext context, int mouseX, int mouseY, float d
BufferBuilder builder = Tessellator.getInstance().getBuffer();
builder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
Matrix4f matrix = context.getMatrices().peek().getPositionMatrix();
builder.vertex(matrix, x, y, 5).texture(0, 0).color(hue, 0f, 1f, 1f).next();
builder.vertex(matrix, x, y + h, 5).texture(0, 1).color(hue, 0f, 0f, 1f).next();
builder.vertex(matrix, x + w, y + h, 5).texture(1, 1).color(hue, 1f, 0f, 1f).next();
builder.vertex(matrix, x + w, y, 5).texture(1, 0).color(hue, 1f, 1f, 1f).next();
builder.vertex(matrix, x, y, 0).texture(0, 0).color(hue, 0f, 1f, 1f).next();
builder.vertex(matrix, x, y + h, 0).texture(0, 1).color(hue, 0f, 0f, 1f).next();
builder.vertex(matrix, x + w, y + h, 0).texture(1, 1).color(hue, 1f, 0f, 1f).next();
builder.vertex(matrix, x + w, y, 0).texture(1, 0).color(hue, 1f, 1f, 1f).next();
Tessellator.getInstance().draw();

// Draw frame
context.drawTexture(FRAME_TEXTURE, x, y, 0, 0, w, h);
context.drawTexture(FRAME_TEXTURE, x, y, 0, 0, w, h, w, h);

// Draw picker knob
int d = pickerKnobDim;
Expand Down Expand Up @@ -286,8 +286,8 @@ public ClickableWidget getWidget() {
}

private static class GradientSlider extends SliderWidget implements Bounded {
private static final Identifier TRANSPARENT_SLIDER_TEXTURE = Identifier.of("wakes", "textures/transparent_slider.png");
private static final Identifier BLANK_SLIDER_TEXTURE = Identifier.of("wakes", "textures/blank_slider.png");
private static final Identifier TRANSPARENT_SLIDER_TEXTURE = Identifier.of(WakesClient.MOD_ID, "textures/transparent_slider.png");
private static final Identifier BLANK_SLIDER_TEXTURE = Identifier.of(WakesClient.MOD_ID, "textures/blank_slider.png");

protected AABB bounds;
private final boolean colored;
Expand Down Expand Up @@ -322,7 +322,8 @@ public float getValue() {
public void renderButton(DrawContext context, int mouseX, int mouseY, float delta) {
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.disableDepthTest();

// RenderSystem.disableDepthTest();

context.drawNineSlicedTexture(TEXTURE, this.getX(), this.getY(), this.getWidth(), this.getHeight(), 20, 4, 200, 20, 0, this.getYImage());
int leftCol, rightCol;
Expand Down Expand Up @@ -354,10 +355,10 @@ public void renderButton(DrawContext context, int mouseX, int mouseY, float delt
builder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
Matrix4f matrix = context.getMatrices().peek().getPositionMatrix();

builder.vertex(matrix, x, y, 5).texture(0, 0).color(leftCol).next();
builder.vertex(matrix, x, y + h, 5).texture(0, 1).color(leftCol).next();
builder.vertex(matrix, x + w, y + h, 5).texture(1, 1).color(rightCol).next();
builder.vertex(matrix, x + w, y, 5).texture(1, 0).color(rightCol).next();
builder.vertex(matrix, x, y, 0).texture(0, 0).color(leftCol).next();
builder.vertex(matrix, x, y + h, 0).texture(0, 1).color(leftCol).next();
builder.vertex(matrix, x + w, y + h, 0).texture(1, 1).color(rightCol).next();
builder.vertex(matrix, x + w, y, 0).texture(1, 0).color(rightCol).next();

Tessellator.getInstance().draw();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ vec3 hsv2rgb(vec3 c) {

void main() {
vec3 rgb = hsv2rgb(vertexColor.xyz);
vec4 color = texture(Sampler0, texCoord0) * vec4(rgb, 1.0);
vec4 color = texture(Sampler0, texCoord0) * vec4(rgb, vertexColor.w);
if (color.a < 0.1) {
discard;
}
Expand Down

0 comments on commit c79b5fd

Please sign in to comment.