updated, not sure what changes were added
This commit is contained in:
parent
5afb9bc2d4
commit
71e490eacb
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"Lua.workspace.checkThirdParty": false
|
||||
}
|
@ -7,5 +7,11 @@ Intended to be used with LuaJIT and LÖVE (this is the backbone of LÖVE3D).
|
||||
|
||||
Online documentation can be found [here](http://excessive.github.io/cpml/) or you can generate them yourself using `ldoc -c doc/config.ld -o index .`
|
||||
|
||||
## Additionally adds to the API
|
||||
`mat4:translate_local(out, a, t)`
|
||||
does the same thing as `translate` only its far right column instead of bottom row (as that's what's needed for most local coordinate systems)
|
||||
also: worth noting that "a" in both `translate` and `translate_local` can be an empty table, and it'll generate an identity matrix. Which is really
|
||||
redundant code wise, not a fan of that. Probably will fix that at some point.
|
||||
|
||||
### TODO:
|
||||
* Vec3s and Vec2s are not currently adapted for functionality with MT vectors (seperate classes)
|
||||
|
3
init.lua
3
init.lua
@ -64,19 +64,18 @@ local len = #modules
|
||||
local loaded_modules = {}
|
||||
function require(path)
|
||||
if loaded_modules[path] then return loaded_modules[path] end
|
||||
print(" TEST \n\n\n")
|
||||
local ending = string.gsub(path:sub(len+1), "%.", "/")..".lua"
|
||||
--[[if ending[1] ~= "/" then
|
||||
ending = "/"..ending
|
||||
end]]
|
||||
path = modules..ending
|
||||
print(path)
|
||||
loaded_modules[path] = dofile(path)
|
||||
return loaded_modules[path]
|
||||
end
|
||||
for _, file in ipairs(files) do
|
||||
mtul.math[file] = require(modules .. file)
|
||||
end
|
||||
mtul.loaded_modules.cpml = true
|
||||
|
||||
modules = nil
|
||||
require = old_require
|
||||
|
@ -458,9 +458,9 @@ end
|
||||
-- @treturn mat4 out
|
||||
function mat4.scale(out, a, s)
|
||||
identity(tmp)
|
||||
tmp[1] = s.x
|
||||
tmp[6] = s.y
|
||||
tmp[11] = s.z
|
||||
tmp[1] = s.x or s[1]
|
||||
tmp[6] = s.y or s[2]
|
||||
tmp[11] = s.z or s[3]
|
||||
|
||||
return out:mul(tmp, a)
|
||||
end
|
||||
@ -507,9 +507,9 @@ end
|
||||
-- @treturn mat4 out
|
||||
function mat4.translate(out, a, t)
|
||||
identity(tmp)
|
||||
tmp[13] = t.x
|
||||
tmp[14] = t.y
|
||||
tmp[15] = t.z
|
||||
tmp[13] = t.x or t[1]
|
||||
tmp[14] = t.y or t[2]
|
||||
tmp[15] = t.z or t[3]
|
||||
|
||||
return out:mul(tmp, a)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user