Light Culling still doesn't work properly
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
target_sources(SeeleEngine
|
||||
target_sources(Engine
|
||||
PRIVATE
|
||||
InspectorView.h
|
||||
InspectorView.cpp
|
||||
|
||||
@@ -41,11 +41,9 @@ void InspectorView::prepareRender()
|
||||
|
||||
MainJob InspectorView::render()
|
||||
{
|
||||
co_await uiPass.beginFrame();
|
||||
co_await uiPass.render();
|
||||
co_await uiPass.endFrame();
|
||||
renderFinishedEvent.raise();
|
||||
co_return;
|
||||
return uiPass.beginFrame()
|
||||
.then(uiPass.render())
|
||||
.then(uiPass.endFrame());
|
||||
}
|
||||
|
||||
void InspectorView::keyCallback(KeyCode, InputAction, KeyModifier)
|
||||
|
||||
@@ -34,7 +34,7 @@ Seele::SceneView::SceneView(Gfx::PGraphics graphics, PWindow owner, const Viewpo
|
||||
PPrimitiveComponent ayaka = new PrimitiveComponent(AssetRegistry::findMesh("Ayaka"));
|
||||
ayaka->addWorldTranslation(Vector(0, 0, 0));
|
||||
ayaka->setWorldScale(Vector(10, 10, 10));
|
||||
scene->addPrimitiveComponent(ayaka);
|
||||
//scene->addPrimitiveComponent(ayaka);
|
||||
|
||||
PPrimitiveComponent plane = new PrimitiveComponent(AssetRegistry::findMesh("plane"));
|
||||
plane->setWorldScale(Vector(100, 100, 100));
|
||||
@@ -97,17 +97,19 @@ void SceneView::prepareRender()
|
||||
|
||||
MainJob SceneView::render()
|
||||
{
|
||||
co_await depthPrepass.beginFrame();
|
||||
co_await lightCullingPass.beginFrame();
|
||||
co_await basePass.beginFrame();
|
||||
co_await depthPrepass.render();
|
||||
co_await lightCullingPass.render();
|
||||
co_await basePass.render();
|
||||
co_await depthPrepass.endFrame();
|
||||
co_await lightCullingPass.endFrame();
|
||||
co_await basePass.endFrame();
|
||||
renderFinishedEvent.raise();
|
||||
co_return;
|
||||
return MainJob::all(
|
||||
depthPrepass.beginFrame(),
|
||||
lightCullingPass.beginFrame(),
|
||||
basePass.beginFrame())
|
||||
.then(depthPrepass.render())
|
||||
.then(lightCullingPass.render())
|
||||
.then(basePass.render())
|
||||
.then(
|
||||
MainJob::all(
|
||||
depthPrepass.endFrame(),
|
||||
lightCullingPass.endFrame(),
|
||||
basePass.endFrame())
|
||||
);
|
||||
}
|
||||
|
||||
void SceneView::keyCallback(KeyCode code, InputAction action, KeyModifier)
|
||||
|
||||
@@ -8,7 +8,6 @@ View::View(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &vi
|
||||
: graphics(graphics)
|
||||
, owner(window)
|
||||
, name(name)
|
||||
, renderFinishedEvent(std::format("{}RenderFinished", name))
|
||||
{
|
||||
viewport = graphics->createViewport(owner->getGfxHandle(), viewportInfo);
|
||||
}
|
||||
|
||||
@@ -24,15 +24,12 @@ public:
|
||||
virtual MainJob render() = 0;
|
||||
void applyArea(URect area);
|
||||
void setFocused();
|
||||
Event renderFinished() { return renderFinishedEvent; }
|
||||
void resetRender() { renderFinishedEvent.reset(); }
|
||||
|
||||
protected:
|
||||
Gfx::PGraphics graphics;
|
||||
Gfx::PViewport viewport;
|
||||
PWindow owner;
|
||||
std::string name;
|
||||
Event renderFinishedEvent;
|
||||
|
||||
virtual void keyCallback(KeyCode code, InputAction action, KeyModifier modifier) = 0;
|
||||
virtual void mouseMoveCallback(double xPos, double yPos) = 0;
|
||||
|
||||
@@ -27,21 +27,16 @@ void Window::addView(PView view)
|
||||
MainJob Window::render()
|
||||
{
|
||||
gfxHandle->beginFrame();
|
||||
Array<MainJob> jobs;
|
||||
for(auto& windowView : views)
|
||||
{
|
||||
co_await windowView->updateFinished;
|
||||
windowView->updateFinished.reset();
|
||||
{
|
||||
std::scoped_lock lock(windowView->workerMutex);
|
||||
windowView->view->prepareRender();
|
||||
}
|
||||
windowView->view->render();
|
||||
}
|
||||
for(auto& windowView : views)
|
||||
{
|
||||
co_await windowView->view->renderFinished();
|
||||
windowView->view->resetRender();
|
||||
jobs.add(windowView->view->render());
|
||||
}
|
||||
co_await MainJob::all(jobs);
|
||||
gfxHandle->endFrame();
|
||||
if(owner->isActive())
|
||||
{
|
||||
@@ -82,8 +77,11 @@ Job Window::viewWorker(size_t viewIndex)
|
||||
windowView->view->commitUpdate();
|
||||
}
|
||||
//std::cout << "Update completed" << std::endl;
|
||||
windowView->updateFinished.raise();
|
||||
//windowView->updateFinished.raise();
|
||||
// enqueue next frame update
|
||||
viewWorker(viewIndex);
|
||||
if(owner->isActive())
|
||||
{
|
||||
viewWorker(viewIndex);
|
||||
}
|
||||
co_return;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ void WindowManager::notifyWindowClosed(PWindow window)
|
||||
windows.remove(windows.find(window));
|
||||
if(windows.empty())
|
||||
{
|
||||
std::scoped_lock lock(windowsLock);
|
||||
windowsCV.notify_all();
|
||||
getGlobalThreadPool().cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,16 +22,9 @@ public:
|
||||
{
|
||||
return windows.size();
|
||||
}
|
||||
void waitForCompletion()
|
||||
{
|
||||
std::unique_lock lock(windowsLock);
|
||||
windowsCV.wait(lock);
|
||||
}
|
||||
|
||||
private:
|
||||
Array<PWindow> windows;
|
||||
std::mutex windowsLock;
|
||||
std::condition_variable windowsCV;
|
||||
static Gfx::PGraphics graphics;
|
||||
};
|
||||
DEFINE_REF(WindowManager)
|
||||
|
||||
Reference in New Issue
Block a user