Slight improvement to lovr.mirror;

This commit is contained in:
bjorn 2022-07-17 20:07:31 -07:00
parent 922942a0bf
commit a0173252b9
2 changed files with 17 additions and 6 deletions

View File

@ -129,7 +129,9 @@ function lovr.run()
if not skip then lovr.graphics.submit(pass) end
end
if lovr.system.isWindowOpen() then
lovr.mirror(pass)
local pass = lovr.graphics.getPass('render', 'window')
local skip = lovr.mirror(pass)
if not skip then lovr.graphics.submit(pass) end
end
end
if lovr.headset then lovr.headset.submit() end
@ -139,11 +141,20 @@ end
function lovr.mirror(pass)
if lovr.headset then
--
local texture = lovr.headset.getTexture()
if texture then
pass:fill(texture)
else
local near, far = lovr.headset.getClipDistance()
for i = 1, lovr.headset.getViewCount() do
pass:setViewPose(i, lovr.headset.getViewPose(i))
local left, right, up, down = lovr.headset.getViewAngles(i)
pass:setProjection(i, left, right, up, down, near, far)
end
return lovr.draw and lovr.draw(pass)
end
else
local pass = lovr.graphics.getPass('render', 'window')
local skip = lovr.draw and lovr.draw(pass)
if not skip then lovr.graphics.submit(pass) end
return lovr.draw and lovr.draw(pass)
end
end

View File

@ -189,7 +189,7 @@ static bool desktop_animate(Device device, struct Model* model) {
}
static Texture* desktop_getTexture(void) {
return lovrGraphicsGetWindowTexture();
return NULL;
}
static void desktop_submit(void) {