mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 19:05:02 -04:00
fix some transparency issues
This commit is contained in:
parent
37f045db27
commit
aca57fd5f0
@ -153,7 +153,6 @@ class HUDRenderer(
|
||||
|
||||
private fun setup() {
|
||||
renderWindow.renderSystem.reset(blending = true)
|
||||
renderWindow.renderSystem.clear(IntegratedBufferTypes.DEPTH_BUFFER)
|
||||
shader.use()
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class CrosshairHUDElement(hudRenderer: HUDRenderer) : CustomHUDElement(hudRender
|
||||
val mesh = mesh ?: return
|
||||
|
||||
if (crosshairProfile.complementaryColor) {
|
||||
renderWindow.renderSystem.reset(blending = true, sourceAlpha = BlendingFunctions.ONE_MINUS_DESTINATION_COLOR, destinationAlpha = BlendingFunctions.ONE_MINUS_SOURCE_COLOR)
|
||||
renderWindow.renderSystem.reset(blending = true, sourceRGB = BlendingFunctions.ONE_MINUS_DESTINATION_COLOR, destinationRGB = BlendingFunctions.ONE_MINUS_SOURCE_COLOR)
|
||||
} else {
|
||||
renderWindow.renderSystem.reset()
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ import de.bixilon.minosoft.gui.rendering.renderer.Renderer
|
||||
import de.bixilon.minosoft.gui.rendering.renderer.RendererBuilder
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.*
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.buffer.frame.Framebuffer
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.phases.PostDrawable
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.phases.PreDrawable
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.AbstractTexture
|
||||
import de.bixilon.minosoft.gui.rendering.util.mesh.SimpleTextureMesh
|
||||
import de.bixilon.minosoft.modding.event.events.TimeChangeEvent
|
||||
@ -37,7 +37,7 @@ import glm_.vec3.Vec3
|
||||
class SkyRenderer(
|
||||
private val connection: PlayConnection,
|
||||
override val renderWindow: RenderWindow,
|
||||
) : Renderer, PostDrawable {
|
||||
) : Renderer, PreDrawable {
|
||||
override val renderSystem: RenderSystem = renderWindow.renderSystem
|
||||
private val skyboxShader = renderSystem.createShader(ResourceLocation(ProtocolDefinition.MINOSOFT_NAMESPACE, "sky/skybox"))
|
||||
private val skySunShader = renderSystem.createShader(ResourceLocation(ProtocolDefinition.MINOSOFT_NAMESPACE, "sky/sun"))
|
||||
@ -138,7 +138,7 @@ class SkyRenderer(
|
||||
skyboxMesh.draw()
|
||||
}
|
||||
|
||||
override fun drawPost() {
|
||||
override fun drawPre() {
|
||||
renderWindow.renderSystem.reset(depth = DepthFunctions.LESS_OR_EQUAL)
|
||||
drawSkybox()
|
||||
drawSun()
|
||||
|
@ -41,12 +41,14 @@ interface RenderSystem {
|
||||
blending: Boolean = false,
|
||||
faceCulling: Boolean = true,
|
||||
depthMask: Boolean = true,
|
||||
sourceRGB: BlendingFunctions = BlendingFunctions.ONE,
|
||||
destinationRGB: BlendingFunctions = BlendingFunctions.ONE_MINUS_SOURCE_ALPHA,
|
||||
sourceAlpha: BlendingFunctions = BlendingFunctions.ONE,
|
||||
destinationAlpha: BlendingFunctions = BlendingFunctions.ONE_MINUS_SOURCE_ALPHA,
|
||||
destinationAlpha: BlendingFunctions = BlendingFunctions.ZERO,
|
||||
depth: DepthFunctions = DepthFunctions.LESS,
|
||||
clearColor: RGBColor = Colors.TRANSPARENT,
|
||||
) {
|
||||
setBlendFunction(sourceAlpha, destinationAlpha, BlendingFunctions.ONE, BlendingFunctions.ZERO)
|
||||
setBlendFunction(sourceRGB, destinationRGB, sourceAlpha, destinationAlpha)
|
||||
this[RenderingCapabilities.DEPTH_TEST] = depthTest
|
||||
this[RenderingCapabilities.BLENDING] = blending
|
||||
this[RenderingCapabilities.FACE_CULLING] = faceCulling
|
||||
|
@ -8,7 +8,13 @@ interface TranslucentDrawable : Renderer {
|
||||
get() = false
|
||||
|
||||
fun setupTranslucent() {
|
||||
renderSystem.reset(sourceAlpha = BlendingFunctions.SOURCE_ALPHA, destinationAlpha = BlendingFunctions.ONE_MINUS_SOURCE_ALPHA, blending = true)
|
||||
renderSystem.reset(
|
||||
blending = true,
|
||||
sourceRGB = BlendingFunctions.SOURCE_ALPHA,
|
||||
destinationRGB = BlendingFunctions.ONE_MINUS_SOURCE_ALPHA,
|
||||
sourceAlpha = BlendingFunctions.ONE,
|
||||
destinationAlpha = BlendingFunctions.ONE_MINUS_SOURCE_ALPHA,
|
||||
)
|
||||
}
|
||||
|
||||
fun drawTranslucent()
|
||||
|
@ -7,7 +7,7 @@ interface TransparentDrawable : Renderer {
|
||||
get() = false
|
||||
|
||||
fun setupTransparent() {
|
||||
renderSystem.reset()
|
||||
renderSystem.reset(blending = true)
|
||||
}
|
||||
|
||||
fun drawTransparent()
|
||||
|
@ -36,6 +36,8 @@ void main() {
|
||||
#ifdef TRANSPARENT
|
||||
if (foutColor.a < 0.3f){
|
||||
discard;
|
||||
} else {
|
||||
foutColor.a = 1.0f;
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
@ -53,6 +55,8 @@ void main() {
|
||||
#ifdef TRANSPARENT
|
||||
if (foutColor.a < 0.3f){
|
||||
discard;
|
||||
} else {
|
||||
foutColor.a = 1.0f;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -38,6 +38,8 @@ void work() {
|
||||
#ifdef TRANSPARENT
|
||||
if (foutColor.a < 0.3f){
|
||||
discard;
|
||||
} else {
|
||||
foutColor.a = 1.0f;
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
@ -54,6 +56,8 @@ void work() {
|
||||
#ifdef TRANSPARENT
|
||||
if (foutColor.a < 0.3f) {
|
||||
discard;
|
||||
} else {
|
||||
foutColor.a = 1.0f;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user