fixed and redocumented mat4.mul()
This commit is contained in:
parent
1fd42e98ff
commit
9501462e51
@ -130,7 +130,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -662,7 +662,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -662,7 +662,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -77,7 +77,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -730,7 +730,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -118,7 +118,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -77,7 +77,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -1505,7 +1505,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -77,7 +77,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -703,7 +703,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -1403,7 +1403,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -77,7 +77,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -550,7 +550,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -1117,7 +1117,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -1025,7 +1025,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -80,7 +80,7 @@
|
||||
<p>Various useful bits of game math. 3D line intersections, ray casting, 2d/3d vectors, 4x4 matrices, quaternions, etc.</p>
|
||||
|
||||
<p>This is a fork of CPML (for LÖVE/love3d), it's been ported over the minetest so it can be used in whatever you need it for.
|
||||
Documentation can be found here: <a href="https://minetest-unified-library.github.io/LEEF-Math/">https://minetest-unified-library.github.io/LEEF-Math/</a>.</p>
|
||||
Documentation can be found here: <hhttps://luanti-extended-engine-features.github.io/LEEF-Math/>.</p>
|
||||
|
||||
<p>For possible future contributors: documentation must be generated manually when a commit is made, because I haven't set up workflows (and have no idea how to).</p>
|
||||
|
||||
@ -92,7 +92,7 @@ Documentation can be found here: <a href="https://minetest-unified-library.githu
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2024-12-01 12:04:18 </i>
|
||||
<i style="float:right;">Last updated 2024-12-09 17:59:28 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
@ -524,8 +524,8 @@ end
|
||||
|
||||
--- Multiply N matrices.
|
||||
-- @tparam mat4 out Matrix to store the result
|
||||
-- @tparam mat4 or {mat4, ...} left hand operand(s)
|
||||
-- @tparam mat4 right hand operand if a is not table
|
||||
-- @tparam table a a mat4 or a list of mat4s
|
||||
-- @tparam mat4 b right operand used if param a is a mat4
|
||||
-- @treturn mat4 out multiplied matrix result
|
||||
function mat4.mul(out, a, b)
|
||||
if mat4.is_mat4(a) then
|
||||
@ -533,18 +533,14 @@ function mat4.mul(out, a, b)
|
||||
return out
|
||||
end
|
||||
if #a == 0 then
|
||||
identity(out)
|
||||
elseif #a == 1 then
|
||||
-- only one matrix, just copy
|
||||
for i = 1, 16 do
|
||||
out[i] = a[1][i]
|
||||
end
|
||||
error("incorrect operand, expected two mat4s or list of mat4s but recieved empty table.")
|
||||
else
|
||||
local ma = a[1]
|
||||
local mb = a[2]
|
||||
for i = 2, #a do
|
||||
mul_internal(out, ma, mb)
|
||||
ma = out
|
||||
local new_mat = a[#a]
|
||||
for i = #a-1, 1, -1 do
|
||||
new_mat = a[i]*new_mat
|
||||
end
|
||||
for i=1,16 do
|
||||
out[i] = new_mat[i]
|
||||
end
|
||||
end
|
||||
return out
|
||||
|
Loading…
x
Reference in New Issue
Block a user