mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-21 21:54:35 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4a5b2aaa90
@ -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
|
||||
|
@ -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
|
||||
|
18
vec3.lua
18
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user