add static offset to clouds

("fixes" face fighting with blocks/general)
This commit is contained in:
Bixilon 2022-11-07 19:19:54 +01:00
parent 199d8abe2a
commit a3a98c2897
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -31,8 +31,8 @@ class CloudMesh(renderWindow: RenderWindow) : Mesh(renderWindow, CloudMeshStruct
fun createCloud(start: Vec2i, end: Vec2i, yStart: Int, yEnd: Int, culling: BooleanArray) {
val start = Vec3(start.x, yStart, start.y)
val end = Vec3(end.x, yEnd, end.y)
val start = Vec3(start.x, yStart, start.y) + CLOUD_OFFSET
val end = Vec3(end.x, yEnd, end.y) + CLOUD_OFFSET
addYQuad(Vec2(start.x, start.z), end.y, Vec2(end.x, end.z)) { position, _ -> addVertex(position, Directions.UP) }
addYQuad(Vec2(start.x, start.z), start.y, Vec2(end.x, end.z)) { position, _ -> addVertex(position, Directions.DOWN) }
@ -59,4 +59,8 @@ class CloudMesh(renderWindow: RenderWindow) : Mesh(renderWindow, CloudMeshStruct
) {
companion object : MeshStruct(CloudMeshStruct::class)
}
companion object {
private const val CLOUD_OFFSET = 0.24f // prevents face fighting with pretty much all blocks
}
}