Merge remote-tracking branch 'origin/master'

This commit is contained in:
Max Cahill 2024-11-01 11:27:35 +11:00
commit 4a5b2aaa90
3 changed files with 10 additions and 14 deletions

View File

@ -48,7 +48,9 @@ return function(time_budget, memory_ceiling, disable_otherwise)
love.timer.getTime() - start_time < time_budget and love.timer.getTime() - start_time < time_budget and
steps < max_steps steps < max_steps
do do
collectgarbage("step", 1) if collectgarbage("step", 1) then
break
end
steps = steps + 1 steps = steps + 1
end end
--safety net --safety net

View File

@ -65,7 +65,7 @@ end
function state_machine:_call_and_transition(name, ...) function state_machine:_call_and_transition(name, ...)
local r = self:_call(name, ...) local r = self:_call(name, ...)
if type(r) == "string" and self:has_state(r) then if type(r) == "string" and self:has_state(r) then
self:set_state(r, r == self.current_state_name) self:set_state(r, true)
return nil return nil
end end
return r return r

View File

@ -328,6 +328,9 @@ end
--rotate around a swizzle --rotate around a swizzle
--todo: angle-axis version --todo: angle-axis version
function vec3:rotatei(swizzle, angle) function vec3:rotatei(swizzle, angle)
if angle == 0 then --early out
return self
end
local v = vec2:pooled() local v = vec2:pooled()
self:extract_vec2(swizzle, v) self:extract_vec2(swizzle, v)
v:rotatei(angle) v:rotatei(angle)
@ -336,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