framebuffers: fix some transparency/translucency issues

This commit is contained in:
Bixilon 2021-12-17 00:19:13 +01:00
parent fbabebcecd
commit f8d1382364
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 4 additions and 11 deletions

View File

@ -32,20 +32,12 @@ object RenderConstants {
val TEXT_BACKGROUND_COLOR = RGBColor(0, 0, 0, 80)
const val TEXT_LINE_PADDING = 2
val WORD_SEPARATORS = arrayOf(' ', '.', ',', '!', '-', '?')
const val FRUSTUM_CULLING_ENABLED = true
const val SHOW_FPS_IN_WINDOW_TITLE = true
const val MAXIMUM_QUEUE_TIME_PER_FRAME = 20L
const val DISABLE_LIGHTING = false
const val RENDER_BLOCKS = true
const val RENDER_FLUIDS = true
const val RENDER_HUD = true
val DEBUG_TEXTURE_RESOURCE_LOCATION = ResourceLocation("minosoft:textures/debug.png")
const val DEBUG_TEXTURE_ID = 0 // always add the debug texture to the texture array first to ensure the id is 0

View File

@ -41,7 +41,7 @@ interface RenderSystem {
blending: Boolean = false,
faceCulling: Boolean = true,
depthMask: Boolean = true,
sourceAlpha: BlendingFunctions = BlendingFunctions.SOURCE_ALPHA,
sourceAlpha: BlendingFunctions = BlendingFunctions.ONE,
destinationAlpha: BlendingFunctions = BlendingFunctions.ONE_MINUS_SOURCE_ALPHA,
depth: DepthFunctions = DepthFunctions.LESS,
clearColor: RGBColor = Colors.TRANSPARENT,
@ -63,7 +63,7 @@ interface RenderSystem {
operator fun set(source: BlendingFunctions, destination: BlendingFunctions)
fun setBlendFunction(sourceRGB: BlendingFunctions = BlendingFunctions.SOURCE_ALPHA, destinationRGB: BlendingFunctions = BlendingFunctions.ONE_MINUS_SOURCE_ALPHA, sourceAlpha: BlendingFunctions = BlendingFunctions.ONE, destinationAlpha: BlendingFunctions = BlendingFunctions.ZERO)
fun setBlendFunction(sourceRGB: BlendingFunctions = BlendingFunctions.ONE, destinationRGB: BlendingFunctions = BlendingFunctions.ONE_MINUS_SOURCE_ALPHA, sourceAlpha: BlendingFunctions = BlendingFunctions.ONE, destinationAlpha: BlendingFunctions = BlendingFunctions.ZERO)
var depth: DepthFunctions
var depthMask: Boolean

View File

@ -1,13 +1,14 @@
package de.bixilon.minosoft.gui.rendering.system.base.phases
import de.bixilon.minosoft.gui.rendering.Renderer
import de.bixilon.minosoft.gui.rendering.system.base.BlendingFunctions
interface TranslucentDrawable : Renderer {
val skipTranslucent: Boolean
get() = false
fun setupTranslucent() {
renderSystem.reset(blending = true)
renderSystem.reset(sourceAlpha = BlendingFunctions.SOURCE_ALPHA, destinationAlpha = BlendingFunctions.ONE_MINUS_SOURCE_ALPHA, blending = true)
}
fun drawTranslucent()