mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-10 16:01:50 -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
|
* 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.
|
* 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,
|
yawRad.sin * pitchCos,
|
||||||
-pitchRad.sin,
|
-pitchRad.sin,
|
||||||
yawRad.cos * pitchCos
|
yawRad.cos * pitchCos
|
||||||
).normalize()
|
).normalizeAssign()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* 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.
|
* 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 NEAR_PLANE = 0.01f
|
||||||
const val FAR_PLANE = World.MAX_RENDER_DISTANCE * ProtocolDefinition.SECTION_LENGTH.toFloat()
|
const val FAR_PLANE = World.MAX_RENDER_DISTANCE * ProtocolDefinition.SECTION_LENGTH.toFloat()
|
||||||
val CAMERA_UP_VEC3 = Vec3(0.0f, 1.0f, 0.0f)
|
val CAMERA_UP_VEC3 = Vec3(0.0f, 1.0f, 0.0f)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -165,8 +165,8 @@ class MatrixHandler(
|
|||||||
|
|
||||||
private fun updateFront(front: Vec3) {
|
private fun updateFront(front: Vec3) {
|
||||||
this.front = front
|
this.front = front
|
||||||
this.right = (front cross CAMERA_UP_VEC3).normalize()
|
this.right = (front cross CAMERA_UP_VEC3).normalizeAssign()
|
||||||
this.up = (this.right cross front).normalize()
|
this.up = (this.right cross front).normalizeAssign()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateShaders(cameraPosition: Vec3) {
|
private fun updateShaders(cameraPosition: Vec3) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user