summaryrefslogtreecommitdiff
path: root/Data/BuiltIn/Libraries/GameLab/Engine/Math/init.lua
blob: 71523d587a96340fbc1dde018f4c44ee01ec9704 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
local math = GameLab.Package("GameLab.Engine.Math")

local import = GameLab.Import(...)

import "Math"
import "Vector2"
import "Vector3"
import "Vector4"
import "Matrix44"
import "Matrix33"
import "Quaternion"
import "Rect"

GameLab.Debug.Log("GameLab.Engine.Math loaded")

math.Max = function(a, b)
    return a >= b and a or b
end 

math.Min = function(a, b)
    return a <= b and a or b
end 

math.Clamp = function(v, min, max)
    return math.Min(math.Max(v, min), max)
end 

math.Sign = function(num) 
    local retval = 0
    if(num > 0) then 
        retval = 1
    end 
    if(num < 0) then 
        retval = -1
    end 
    return retval 
end 

return math