tinting: don't mix rgb and rgba

Fixes rendering of lava in nether
This commit is contained in:
Moritz Zwerger 2023-12-08 20:42:33 +01:00
parent 4d6f0c9a2c
commit d72a34683b
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
6 changed files with 10 additions and 9 deletions

View File

@ -1,6 +1,6 @@
/* /*
* Minosoft * Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger * Copyright (C) 2020-2023 Moritz Zwerger
* *
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
@ -27,5 +27,6 @@ object Colors {
val TRANSPARENT = RGBColor(0, 0, 0, 0) val TRANSPARENT = RGBColor(0, 0, 0, 0)
const val WHITE = 0xFFFFFFFF.toInt() const val WHITE_RGB = 0xFFFFFF
const val WHITE_RGBA = 0xFFFFFFFF.toInt()
} }

View File

@ -108,7 +108,7 @@ class FluidSectionMesher(
position = Vec3i(offsetX + x, offsetY + y, offsetZ + z) position = Vec3i(offsetX + x, offsetY + y, offsetZ + z)
val height = fluid.getHeight(state) val height = fluid.getHeight(state)
tint = tints.getFluidTint(chunk, fluid, height, position.x, position.y, position.z) ?: Colors.WHITE tint = tints.getFluidTint(chunk, fluid, height, position.x, position.y, position.z) ?: Colors.WHITE_RGB
val cornerHeights = floatArrayOf( val cornerHeights = floatArrayOf(
getCornerHeight(chunk, chunkPosition, position, fluid), getCornerHeight(chunk, chunkPosition, position, fluid),

View File

@ -19,13 +19,13 @@ import de.bixilon.minosoft.data.registries.fluid.Fluid
import de.bixilon.minosoft.data.text.formatting.color.Colors import de.bixilon.minosoft.data.text.formatting.color.Colors
interface TintProvider { interface TintProvider {
fun getBlockColor(blockState: BlockState, biome: Biome?, x: Int, y: Int, z: Int, tintIndex: Int): Int = Colors.WHITE fun getBlockColor(blockState: BlockState, biome: Biome?, x: Int, y: Int, z: Int, tintIndex: Int): Int = Colors.WHITE_RGB
fun getParticleColor(blockState: BlockState, biome: Biome?, x: Int, y: Int, z: Int): Int { fun getParticleColor(blockState: BlockState, biome: Biome?, x: Int, y: Int, z: Int): Int {
return getBlockColor(blockState, biome, x, y, z, 0) return getBlockColor(blockState, biome, x, y, z, 0)
} }
fun getItemColor(stack: ItemStack, tintIndex: Int): Int = Colors.WHITE fun getItemColor(stack: ItemStack, tintIndex: Int): Int = Colors.WHITE_RGB
fun getFluidTint(fluid: Fluid, biome: Biome?, height: Float, x: Int, y: Int, z: Int): Int = Colors.WHITE fun getFluidTint(fluid: Fluid, biome: Biome?, height: Float, x: Int, y: Int, z: Int): Int = Colors.WHITE_RGB
} }

View File

@ -52,7 +52,7 @@ class GrassTintCalculator : ColorMapTint(FILE) {
override fun getParticleColor(blockState: BlockState, biome: Biome?, x: Int, y: Int, z: Int): Int { override fun getParticleColor(blockState: BlockState, biome: Biome?, x: Int, y: Int, z: Int): Int {
if (blockState.block is GrassBlock) { // dirt particles if (blockState.block is GrassBlock) { // dirt particles
return Colors.WHITE return Colors.WHITE_RGB
} }
return getBlockColor(biome) return getBlockColor(biome)
} }

View File

@ -27,6 +27,6 @@ class SugarCaneTintCalculator(val grassTintCalculator: GrassTintCalculator) : Ti
} }
override fun getItemColor(stack: ItemStack, tintIndex: Int): Int { override fun getItemColor(stack: ItemStack, tintIndex: Int): Int {
return Colors.WHITE return Colors.WHITE_RGB
} }
} }

View File

@ -28,7 +28,7 @@ open class SimpleTextureMesh(context: RenderContext, primitiveType: PrimitiveTyp
data.add(position.array) data.add(position.array)
data.add(uv.array) data.add(uv.array)
data.add(texture.renderData.shaderTextureId.buffer()) data.add(texture.renderData.shaderTextureId.buffer())
data.add((tintColor?.rgba ?: Colors.WHITE).buffer()) data.add((tintColor?.rgba ?: Colors.WHITE_RGBA).buffer())
} }