mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 18:34:56 -04:00
world border: remove camera offset
This breaks it even harder…
This commit is contained in:
parent
592b22db76
commit
a3deac5df0
@ -15,7 +15,6 @@ package de.bixilon.minosoft.gui.rendering.world.border
|
|||||||
|
|
||||||
import de.bixilon.kotlinglm.func.common.clamp
|
import de.bixilon.kotlinglm.func.common.clamp
|
||||||
import de.bixilon.kotlinglm.vec2.Vec2
|
import de.bixilon.kotlinglm.vec2.Vec2
|
||||||
import de.bixilon.kotlinglm.vec2.Vec2d
|
|
||||||
import de.bixilon.kutil.latch.CountUpAndDownLatch
|
import de.bixilon.kutil.latch.CountUpAndDownLatch
|
||||||
import de.bixilon.kutil.time.TimeUtil.millis
|
import de.bixilon.kutil.time.TimeUtil.millis
|
||||||
import de.bixilon.minosoft.data.registries.identified.Namespaces.minosoft
|
import de.bixilon.minosoft.data.registries.identified.Namespaces.minosoft
|
||||||
@ -75,7 +74,7 @@ class WorldBorderRenderer(
|
|||||||
}
|
}
|
||||||
val textureOffset = (offsetReset - time) / ANIMATION_SPEED.toFloat()
|
val textureOffset = (offsetReset - time) / ANIMATION_SPEED.toFloat()
|
||||||
shader.textureOffset = 1.0f - textureOffset
|
shader.textureOffset = 1.0f - textureOffset
|
||||||
shader.cameraHeight = (context.connection.camera.entity.renderInfo.eyePosition.y - context.camera.offset.offset.y).toFloat()
|
shader.cameraHeight = context.connection.camera.entity.renderInfo.eyePosition.y.toFloat()
|
||||||
|
|
||||||
val distance = border.getDistanceTo(context.connection.player.physics.position).toFloat()
|
val distance = border.getDistanceTo(context.connection.player.physics.position).toFloat()
|
||||||
val strength = 1.0f - (distance.clamp(0.0f, 100.0f) / 100.0f)
|
val strength = 1.0f - (distance.clamp(0.0f, 100.0f) / 100.0f)
|
||||||
@ -87,8 +86,7 @@ class WorldBorderRenderer(
|
|||||||
color = color.with(alpha = (strength * strength))
|
color = color.with(alpha = (strength * strength))
|
||||||
shader.tintColor = color
|
shader.tintColor = color
|
||||||
shader.radius = border.diameter.toFloat() / 2.0f
|
shader.radius = border.diameter.toFloat() / 2.0f
|
||||||
val offset = context.camera.offset.offset
|
shader.center = Vec2(border.center)
|
||||||
shader.center = Vec2(border.center - Vec2d(offset.x, offset.z))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun drawTranslucent() {
|
override fun drawTranslucent() {
|
||||||
|
@ -25,7 +25,6 @@ uniform float uCameraHeight;
|
|||||||
|
|
||||||
flat out uint finTextureIndex;
|
flat out uint finTextureIndex;
|
||||||
out vec3 finTextureCoordinates;
|
out vec3 finTextureCoordinates;
|
||||||
out vec3 finFragmentPosition;
|
|
||||||
|
|
||||||
|
|
||||||
#include "minosoft:uv"
|
#include "minosoft:uv"
|
||||||
@ -43,7 +42,6 @@ void main() {
|
|||||||
position.x += uCenter.x;
|
position.x += uCenter.x;
|
||||||
position.z += uCenter.y;
|
position.z += uCenter.y;
|
||||||
gl_Position = uViewProjectionMatrix * vec4(position, 1.0f);
|
gl_Position = uViewProjectionMatrix * vec4(position, 1.0f);
|
||||||
finFragmentPosition = position;
|
|
||||||
|
|
||||||
finTextureIndex = uIndexLayer >> 28u;
|
finTextureIndex = uIndexLayer >> 28u;
|
||||||
vec2 uv = CONST_UV[floatBitsToUint(uvIndex)];
|
vec2 uv = CONST_UV[floatBitsToUint(uvIndex)];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user