mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-08 06:50:22 -04:00
entity rotation: use normalizeAssign over normalize
This safes a few bytes of memory allocation each call
This commit is contained in:
parent
41880b0ada
commit
a3f09071d6
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -33,7 +33,7 @@ data class EntityRotation(
|
||||
yawRad.sin * pitchCos,
|
||||
-pitchRad.sin,
|
||||
yawRad.cos * pitchCos
|
||||
).normalize()
|
||||
).normalizeAssign()
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -21,5 +21,4 @@ object CameraDefinition {
|
||||
const val NEAR_PLANE = 0.01f
|
||||
const val FAR_PLANE = World.MAX_RENDER_DISTANCE * ProtocolDefinition.SECTION_LENGTH.toFloat()
|
||||
val CAMERA_UP_VEC3 = Vec3(0.0f, 1.0f, 0.0f)
|
||||
|
||||
}
|
||||
|
@ -165,8 +165,8 @@ class MatrixHandler(
|
||||
|
||||
private fun updateFront(front: Vec3) {
|
||||
this.front = front
|
||||
this.right = (front cross CAMERA_UP_VEC3).normalize()
|
||||
this.up = (this.right cross front).normalize()
|
||||
this.right = (front cross CAMERA_UP_VEC3).normalizeAssign()
|
||||
this.up = (this.right cross front).normalizeAssign()
|
||||
}
|
||||
|
||||
private fun updateShaders(cameraPosition: Vec3) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user