parent
0ab683e827
commit
aa3c00a784
1 changed files with 10 additions and 19 deletions
|
|
@ -731,19 +731,14 @@ public:
|
||||||
updateUniformBuffers();
|
updateUniformBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateUniformBuffers(bool viewchanged = true)
|
void updateUniformBuffers()
|
||||||
{
|
{
|
||||||
if (viewchanged)
|
uboVS.projection = camera.matrices.perspective;
|
||||||
{
|
uboVS.modelView = camera.matrices.view;
|
||||||
uboVS.projection = camera.matrices.perspective;
|
uboVS.viewPos = camera.viewPos;
|
||||||
uboVS.modelView = camera.matrices.view;
|
uboVS.depth += frameTimer * 0.15f;
|
||||||
uboVS.viewPos = camera.viewPos;
|
if (uboVS.depth > 1.0f) {
|
||||||
}
|
uboVS.depth = uboVS.depth - 1.0f;
|
||||||
else
|
|
||||||
{
|
|
||||||
uboVS.depth += frameTimer * 0.15f;
|
|
||||||
if (uboVS.depth > 1.0f)
|
|
||||||
uboVS.depth = uboVS.depth - 1.0f;
|
|
||||||
}
|
}
|
||||||
memcpy(uniformBufferVS.mapped, &uboVS, sizeof(uboVS));
|
memcpy(uniformBufferVS.mapped, &uboVS, sizeof(uboVS));
|
||||||
}
|
}
|
||||||
|
|
@ -768,13 +763,9 @@ public:
|
||||||
if (!prepared)
|
if (!prepared)
|
||||||
return;
|
return;
|
||||||
draw();
|
draw();
|
||||||
if (!paused || camera.updated)
|
if (!paused) {
|
||||||
updateUniformBuffers(camera.updated);
|
updateUniformBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void viewChanged()
|
|
||||||
{
|
|
||||||
updateUniformBuffers(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue