mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-12 19:31:47 +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
|
||||
end
|
||||
|
||||
local _euler_macro = {
|
||||
"yz",
|
||||
"xz",
|
||||
"xy",
|
||||
}
|
||||
function vec3:rotate_euleri(angle_x_axis, angle_y_axis, angle_z_axis)
|
||||
for i, swizzle in ipairs(_euler_macro) do
|
||||
local angle =
|
||||
i == 1 and angle_x_axis
|
||||
or i == 2 and angle_y_axis
|
||||
or i == 3 and angle_z_axis
|
||||
self:rotatei(swizzle, angle)
|
||||
end
|
||||
self:rotatei("yz", angle_x_axis)
|
||||
self:rotatei("xz", angle_y_axis)
|
||||
self:rotatei("xy", angle_z_axis)
|
||||
return self
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user