mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
more constants, improve code a bit
This commit is contained in:
parent
8f7c8efd88
commit
7b0148c50f
@ -90,7 +90,7 @@ class MatrixHandler(
|
||||
}
|
||||
|
||||
private fun calculateProjectionMatrix(screenDimensions: Vec2 = renderWindow.window.sizef) {
|
||||
projectionMatrix = glm.perspective(fov.rad.toFloat(), screenDimensions.x / screenDimensions.y, 0.01f, minOf(fogEnd + 2.0f, 10000.0f))
|
||||
projectionMatrix = glm.perspective(fov.rad.toFloat(), screenDimensions.x / screenDimensions.y, NEAR_PLANE, minOf(fogEnd + 2.0f, FAR_PLANE))
|
||||
}
|
||||
|
||||
fun init() {
|
||||
@ -166,6 +166,8 @@ class MatrixHandler(
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val NEAR_PLANE = 0.01f
|
||||
const val FAR_PLANE = 10000.0f
|
||||
val CAMERA_UP_VEC3 = Vec3(0.0, 1.0, 0.0)
|
||||
}
|
||||
}
|
||||
|
@ -28,33 +28,39 @@ import kotlin.reflect.KProperty0
|
||||
|
||||
object JavaFXDelegate {
|
||||
|
||||
private fun checkErosState() {
|
||||
if (RunConfiguration.DISABLE_EROS) {
|
||||
throw IllegalStateException("Eros is disabled!")
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
fun <V> KProperty0<V>.observeFX(owner: Any, observer: (V) -> Unit) {
|
||||
check(!RunConfiguration.DISABLE_EROS)
|
||||
checkErosState()
|
||||
this.observe(owner) { JavaFXUtil.runLater { observer(it) } }
|
||||
}
|
||||
|
||||
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
fun <V> KProperty0<Set<V>>.observeSetFX(owner: Any, observer: (SetChange<V>) -> Unit) {
|
||||
check(!RunConfiguration.DISABLE_EROS)
|
||||
checkErosState()
|
||||
this.observeSet(owner) { JavaFXUtil.runLater { observer(it) } }
|
||||
}
|
||||
|
||||
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
fun <V> KProperty0<List<V>>.observeListFX(owner: Any, observer: (ListChange<V>) -> Unit) {
|
||||
check(!RunConfiguration.DISABLE_EROS)
|
||||
checkErosState()
|
||||
this.observeList(owner) { JavaFXUtil.runLater { observer(it) } }
|
||||
}
|
||||
|
||||
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
fun <K, V> KProperty0<Map<K, V>>.observeMapFX(owner: Any, observer: (MapChange<K, V>) -> Unit) {
|
||||
check(!RunConfiguration.DISABLE_EROS)
|
||||
checkErosState()
|
||||
this.observeMap(owner) { JavaFXUtil.runLater { observer(it) } }
|
||||
}
|
||||
|
||||
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
fun <K, V> KProperty0<AbstractBiMap<K, V>>.observeBiMapFX(owner: Any, observer: (MapChange<K, V>) -> Unit) {
|
||||
check(!RunConfiguration.DISABLE_EROS)
|
||||
checkErosState()
|
||||
this.observeBiMap(owner) { JavaFXUtil.runLater { observer(it) } }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user