mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-04 11:35:06 +03:00
Framebuffer resize queued to next frame to fix flickering Wren VM init moved to on play event Added new Wren modules Added missing components to the editor Changed how the wren scripts gets initialized
69 lines
1.0 KiB
Plaintext
69 lines
1.0 KiB
Plaintext
class Math {
|
|
foreign static Sqrt_(x, y, z)
|
|
}
|
|
|
|
class Vector3 {
|
|
|
|
x {_x}
|
|
y {_y}
|
|
z {_z}
|
|
x=(value) {
|
|
_x = value
|
|
}
|
|
y=(value) {
|
|
_y = value
|
|
}
|
|
z=(value) {
|
|
_z = value
|
|
}
|
|
|
|
mul(other) {
|
|
if(other is Vector3) {
|
|
return Vector3.new(_x * other.x,
|
|
_y * other.y,
|
|
_z * other.z)
|
|
} else {
|
|
return Vector3.new(_x * other, _y * other, _z * other)
|
|
}
|
|
}
|
|
|
|
*(other) {
|
|
if(other is Vector3) {
|
|
return Vector3.new(_x * other.x,
|
|
_y * other.y,
|
|
_z * other.z)
|
|
} else if(other is Num) {
|
|
return Vector3.new(_x * other, _y * other, _z * other)
|
|
}
|
|
}
|
|
|
|
+(other) {
|
|
if(other is Vector3) {
|
|
return Vector3.new(_x + other.x,
|
|
_y + other.y,
|
|
_z + other.z)
|
|
} else if(other is Num) {
|
|
return Vector3.new(_x + other,
|
|
_y + other,
|
|
_z + other)
|
|
}
|
|
}
|
|
|
|
construct new(x, y, z) {
|
|
_x = x
|
|
_y = y
|
|
_z = z
|
|
}
|
|
|
|
Sqrt() {
|
|
return Math.Sqrt_(_x, _y, _z)
|
|
}
|
|
|
|
Normalize() {
|
|
var length = this.Sqrt()
|
|
var x = _x / length
|
|
var y = _y / length
|
|
var z = _z / length
|
|
return Vector3.new(x, y, z)
|
|
}
|
|
} |