diff options
author | Linnea Gräf <nea@nea.moe> | 2024-12-25 16:15:20 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-12-25 16:15:20 +0100 |
commit | ddebaf47900dfab41590c97c202984142ae5b9f6 (patch) | |
tree | 498859e320b19d3bc7559f5585174afb78e132b4 /src/main/kotlin/gui/entity/EntityRenderer.kt | |
parent | e16c60169bf192b79991176b5f9cee66b5b16e7d (diff) | |
download | Firmament-ddebaf47900dfab41590c97c202984142ae5b9f6.tar.gz Firmament-ddebaf47900dfab41590c97c202984142ae5b9f6.tar.bz2 Firmament-ddebaf47900dfab41590c97c202984142ae5b9f6.zip |
WIP: Reforge Recipes
Diffstat (limited to 'src/main/kotlin/gui/entity/EntityRenderer.kt')
-rw-r--r-- | src/main/kotlin/gui/entity/EntityRenderer.kt | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/kotlin/gui/entity/EntityRenderer.kt b/src/main/kotlin/gui/entity/EntityRenderer.kt index 022b9a3..9a09fc6 100644 --- a/src/main/kotlin/gui/entity/EntityRenderer.kt +++ b/src/main/kotlin/gui/entity/EntityRenderer.kt @@ -111,8 +111,9 @@ object EntityRenderer { renderContext: DrawContext, posX: Int, posY: Int, - mouseX: Float, - mouseY: Float + // TODO: Add width, height properties here + mouseX: Double, + mouseY: Double ) { var bottomOffset = 0.0F var currentEntity = entity @@ -148,15 +149,15 @@ object EntityRenderer { y2: Int, size: Float, bottomOffset: Float, - mouseX: Float, - mouseY: Float, + mouseX: Double, + mouseY: Double, entity: LivingEntity ) { context.enableScissorWithTranslation(x1.toFloat(), y1.toFloat(), x2.toFloat(), y2.toFloat()) val centerX = (x1 + x2) / 2f val centerY = (y1 + y2) / 2f - val targetYaw = atan(((centerX - mouseX) / 40.0f).toDouble()).toFloat() - val targetPitch = atan(((centerY - mouseY) / 40.0f).toDouble()).toFloat() + val targetYaw = atan(((centerX - mouseX) / 40.0f)).toFloat() + val targetPitch = atan(((centerY - mouseY) / 40.0f)).toFloat() val rotateToFaceTheFront = Quaternionf().rotateZ(Math.PI.toFloat()) val rotateToFaceTheCamera = Quaternionf().rotateX(targetPitch * 20.0f * (Math.PI.toFloat() / 180)) rotateToFaceTheFront.mul(rotateToFaceTheCamera) |