mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-24 22:54:35 +00:00
inlined euler rotation for speed
This commit is contained in:
parent
137ef43787
commit
aa5273fcc7
15
vec3.lua
15
vec3.lua
@ -339,19 +339,10 @@ function vec3:rotatei(swizzle, angle)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
local _euler_macro = {
|
|
||||||
"yz",
|
|
||||||
"xz",
|
|
||||||
"xy",
|
|
||||||
}
|
|
||||||
function vec3:rotate_euleri(angle_x_axis, angle_y_axis, angle_z_axis)
|
function vec3:rotate_euleri(angle_x_axis, angle_y_axis, angle_z_axis)
|
||||||
for i, swizzle in ipairs(_euler_macro) do
|
self:rotatei("yz", angle_x_axis)
|
||||||
local angle =
|
self:rotatei("xz", angle_y_axis)
|
||||||
i == 1 and angle_x_axis
|
self:rotatei("xy", angle_z_axis)
|
||||||
or i == 2 and angle_y_axis
|
|
||||||
or i == 3 and angle_z_axis
|
|
||||||
self:rotatei(swizzle, angle)
|
|
||||||
end
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user