mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 09:26:11 -04:00
tinting: don't mix rgb and rgba
Fixes rendering of lava in nether
This commit is contained in:
parent
4d6f0c9a2c
commit
d72a34683b
@ -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()
|
||||||
}
|
}
|
||||||
|
@ -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),
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user