mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 03:44:54 -04:00
use kutils sin function more
Kutil uses a sine table, so its cached.
This commit is contained in:
parent
e525d4c88a
commit
fd2997833b
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
* Copyright (C) 2020-2023 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.
|
||||
*
|
||||
@ -13,8 +13,8 @@
|
||||
|
||||
package de.bixilon.minosoft.data.text.formatting.color
|
||||
|
||||
import de.bixilon.kutil.math.Trigonometry.sin
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.sin
|
||||
|
||||
object ColorInterpolation {
|
||||
|
||||
|
@ -15,6 +15,7 @@ package de.bixilon.minosoft.gui.rendering.camera.frustum
|
||||
|
||||
|
||||
import de.bixilon.kotlinglm.mat3x3.Mat3
|
||||
import de.bixilon.kotlinglm.mat4x4.Mat4
|
||||
import de.bixilon.kotlinglm.vec2.Vec2i
|
||||
import de.bixilon.kotlinglm.vec3.Vec3
|
||||
import de.bixilon.kotlinglm.vec3.Vec3i
|
||||
@ -41,9 +42,7 @@ class Frustum(
|
||||
var revision = 0
|
||||
private set
|
||||
|
||||
|
||||
fun recalculate() {
|
||||
val matrix = matrixHandler.viewProjectionMatrix.transpose()
|
||||
private fun recalculate(matrix: Mat4) {
|
||||
val planes = arrayOf(
|
||||
matrix[3] + matrix[0],
|
||||
matrix[3] - matrix[0],
|
||||
@ -113,6 +112,10 @@ class Frustum(
|
||||
revision++
|
||||
}
|
||||
|
||||
fun recalculate() {
|
||||
recalculate(matrixHandler.viewProjectionMatrix.transpose())
|
||||
}
|
||||
|
||||
|
||||
private fun containsRegion(minX: Float, minY: Float, minZ: Float, maxX: Float, maxY: Float, maxZ: Float): Boolean {
|
||||
if (!RenderConstants.FRUSTUM_CULLING_ENABLED) return true
|
||||
|
@ -14,6 +14,7 @@
|
||||
package de.bixilon.minosoft.gui.rendering.entities.renderer.item
|
||||
|
||||
import de.bixilon.kutil.math.MathConstants.PIf
|
||||
import de.bixilon.kutil.math.Trigonometry.sin
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
||||
import de.bixilon.minosoft.data.entities.entities.item.ItemEntity
|
||||
import de.bixilon.minosoft.data.registries.identified.Identified
|
||||
@ -23,7 +24,6 @@ import de.bixilon.minosoft.gui.rendering.entities.feature.item.ItemFeature
|
||||
import de.bixilon.minosoft.gui.rendering.entities.renderer.EntityRenderer
|
||||
import de.bixilon.minosoft.gui.rendering.models.raw.display.DisplayPositions
|
||||
import de.bixilon.minosoft.gui.rendering.util.mat.mat4.Mat4Util.translateYAssign
|
||||
import kotlin.math.sin
|
||||
|
||||
class ItemEntityRenderer(renderer: EntitiesRenderer, entity: ItemEntity) : EntityRenderer<ItemEntity>(renderer, entity) {
|
||||
val item = ItemFeature(this, null, DisplayPositions.GROUND).register()
|
||||
|
@ -14,8 +14,8 @@
|
||||
package de.bixilon.minosoft.gui.rendering.entities.util
|
||||
|
||||
import de.bixilon.kutil.math.MathConstants
|
||||
import de.bixilon.kutil.math.Trigonometry.sin
|
||||
import de.bixilon.kutil.math.interpolation.FloatInterpolation.interpolateLinear
|
||||
import kotlin.math.sin
|
||||
|
||||
class EntitySpeedAnimator(
|
||||
val speed: EntitySpeed,
|
||||
|
@ -22,13 +22,13 @@ import de.bixilon.kotlinglm.vec3.Vec3i
|
||||
import de.bixilon.kotlinglm.vec3.swizzle.xy
|
||||
import de.bixilon.kotlinglm.vec3.swizzle.xz
|
||||
import de.bixilon.kotlinglm.vec3.swizzle.yz
|
||||
import de.bixilon.kutil.math.Trigonometry.sin
|
||||
import de.bixilon.kutil.math.interpolation.FloatInterpolation.interpolateLinear
|
||||
import de.bixilon.kutil.math.simple.FloatMath.floor
|
||||
import de.bixilon.kutil.primitive.FloatUtil.toFloat
|
||||
import de.bixilon.minosoft.data.Axes
|
||||
import de.bixilon.minosoft.data.text.formatting.color.RGBColor
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.sin
|
||||
|
||||
object Vec3Util {
|
||||
private val EMPTY_INSTANCE = Vec3.EMPTY
|
||||
|
Loading…
x
Reference in New Issue
Block a user