mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-20 11:09:20 +01:00
if is an expression; use that
This commit is contained in:
parent
c06b048393
commit
d1d2deddff
@ -11,11 +11,9 @@ trait PositionalSoundSourcesNode extends Node {
|
|||||||
override def update(): Unit = {
|
override def update(): Unit = {
|
||||||
super.update()
|
super.update()
|
||||||
|
|
||||||
var soundPosition: Vector3D = null
|
|
||||||
|
|
||||||
// Calculating position of sound source relative to center of workspace
|
// Calculating position of sound source relative to center of workspace
|
||||||
// but only if corresponding setting is enabled
|
// but only if corresponding setting is enabled
|
||||||
if (Settings.get.soundPositional) {
|
val soundPosition = if (Settings.get.soundPositional) {
|
||||||
val rootWidthHalf = OcelotDesktop.root.width / 2
|
val rootWidthHalf = OcelotDesktop.root.width / 2
|
||||||
val rootHeightHalf = OcelotDesktop.root.height / 2
|
val rootHeightHalf = OcelotDesktop.root.height / 2
|
||||||
|
|
||||||
@ -26,13 +24,13 @@ trait PositionalSoundSourcesNode extends Node {
|
|||||||
// large monitors the sound may become too "non-audiophile"
|
// large monitors the sound may become too "non-audiophile"
|
||||||
val limit = 0.05f
|
val limit = 0.05f
|
||||||
|
|
||||||
soundPosition = Vector3D(
|
Vector3D(
|
||||||
(nodeCenterX - rootWidthHalf) / rootWidthHalf * limit,
|
(nodeCenterX - rootWidthHalf) / rootWidthHalf * limit,
|
||||||
(nodeCenterY - rootHeightHalf) / rootHeightHalf * limit,
|
(nodeCenterY - rootHeightHalf) / rootHeightHalf * limit,
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
soundPosition = Vector3D.Zero
|
Vector3D.Zero
|
||||||
}
|
}
|
||||||
|
|
||||||
for (soundSource <- soundSources)
|
for (soundSource <- soundSources)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user