Skip to content

Commit 532de6f

Browse files
committed
fix block outline rendering
1 parent 22b6433 commit 532de6f

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/main/java/de/bixilon/minosoft/data/text/formatting/color/RGBAColor.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
package de.bixilon.minosoft.data.text.formatting.color
1515

16-
import glm_.vec3.Vec3
17-
import glm_.vec4.Vec4
1816
import de.bixilon.kutil.primitive.IntUtil.toHex
1917
import de.bixilon.minosoft.data.text.ChatComponent
2018
import de.bixilon.minosoft.data.text.TextComponent
@@ -24,16 +22,16 @@ import de.bixilon.minosoft.data.text.formatting.color.Color.Companion.MASK
2422
import de.bixilon.minosoft.data.text.formatting.color.Color.Companion.MAX
2523
import de.bixilon.minosoft.data.text.formatting.color.Color.Companion.TIMES
2624
import de.bixilon.minosoft.data.text.formatting.color.Color.Companion.clamp
25+
import glm_.vec3.Vec3
26+
import glm_.vec4.Vec4
2727

2828

2929
@JvmInline
3030
value class RGBAColor(val rgba: Int) : Color, TextFormattable {
3131

32-
constructor(red: Int, green: Int, blue: Int) : this(red, green, blue, MAX)
33-
constructor(red: Int, green: Int, blue: Int, alpha: Int) : this(((alpha.clamp() and MASK) shl ALPHA_SHIFT) or ((red.clamp() and MASK) shl RED_SHIFT) or ((green.clamp() and MASK) shl GREEN_SHIFT) or ((blue.clamp() and MASK) shl BLUE_SHIFT))
32+
constructor(red: Int, green: Int, blue: Int, alpha: Int = MAX) : this(((alpha.clamp() and MASK) shl ALPHA_SHIFT) or ((red.clamp() and MASK) shl RED_SHIFT) or ((green.clamp() and MASK) shl GREEN_SHIFT) or ((blue.clamp() and MASK) shl BLUE_SHIFT))
3433

35-
constructor(red: Float, green: Float, blue: Float) : this(Color.fromFloat(red), Color.fromFloat(green), Color.fromFloat(blue))
36-
constructor(red: Float, green: Float, blue: Float, alpha: Float) : this(Color.fromFloat(red), Color.fromFloat(green), Color.fromFloat(blue), Color.fromFloat(alpha))
34+
constructor(red: Float, green: Float, blue: Float, alpha: Float = 1.0f) : this(Color.fromFloat(red), Color.fromFloat(green), Color.fromFloat(blue), Color.fromFloat(alpha))
3735

3836
override inline val red: Int get() = (rgba ushr RED_SHIFT) and MASK
3937
override inline val green: Int get() = (rgba ushr GREEN_SHIFT) and MASK

src/main/java/de/bixilon/minosoft/gui/rendering/util/mesh/LineMesh.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
package de.bixilon.minosoft.gui.rendering.util.mesh
1515

16-
import glm_.vec3.Vec3
17-
import glm_.vec3.Vec3d
1816
import de.bixilon.kutil.exception.Broken
1917
import de.bixilon.minosoft.data.direction.Directions
2018
import de.bixilon.minosoft.data.registries.shapes.aabb.AABB
@@ -26,6 +24,8 @@ import de.bixilon.minosoft.gui.rendering.models.util.CuboidUtil
2624
import de.bixilon.minosoft.gui.rendering.system.base.MeshUtil.buffer
2725
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.minus
2826
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3dUtil.minus
27+
import glm_.vec3.Vec3
28+
import glm_.vec3.Vec3d
2929

3030
open class LineMesh(context: RenderContext, initialCacheSize: Int = 1000) : GenericColorMesh(context, initialCacheSize = initialCacheSize) {
3131

@@ -70,7 +70,7 @@ open class LineMesh(context: RenderContext, initialCacheSize: Int = 1000) : Gene
7070
}
7171

7272
fun tryDrawLine(startX: Float, startY: Float, startZ: Float, endX: Float, endY: Float, endZ: Float, lineWidth: Float = RenderConstants.DEFAULT_LINE_WIDTH, color: RGBAColor, shape: Shape? = null) {
73-
if (shape != null) { // && !shape.shouldDrawLine(startX, startY, startZ, endX, endY, endZ)
73+
if (shape != null && !shape.shouldDrawLine(Vec3(startX, startY, startZ), Vec3(endX, endY, endZ))) {
7474
return
7575
}
7676
drawLine(startX, startY, startZ, endX, endY, endZ, lineWidth, color)

0 commit comments

Comments
 (0)