diff --git a/manual_gc.lua b/manual_gc.lua index f392845..706a0fb 100644 --- a/manual_gc.lua +++ b/manual_gc.lua @@ -48,7 +48,9 @@ return function(time_budget, memory_ceiling, disable_otherwise) love.timer.getTime() - start_time < time_budget and steps < max_steps do - collectgarbage("step", 1) + if collectgarbage("step", 1) then + break + end steps = steps + 1 end --safety net diff --git a/state_machine.lua b/state_machine.lua index fcebed1..bd04ed1 100644 --- a/state_machine.lua +++ b/state_machine.lua @@ -65,7 +65,7 @@ end function state_machine:_call_and_transition(name, ...) local r = self:_call(name, ...) 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 end return r diff --git a/vec3.lua b/vec3.lua index ca14260..9b0ee08 100644 --- a/vec3.lua +++ b/vec3.lua @@ -328,6 +328,9 @@ end --rotate around a swizzle --todo: angle-axis version function vec3:rotatei(swizzle, angle) + if angle == 0 then --early out + return self + end local v = vec2:pooled() self:extract_vec2(swizzle, v) v:rotatei(angle) @@ -336,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