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