summaryrefslogtreecommitdiff
path: root/application
diff options
context:
space:
mode:
authorDan Goodliffe <dan.goodliffe@octal.co.uk>2026-02-23 17:35:48 +0000
committerDan Goodliffe <dan.goodliffe@octal.co.uk>2026-02-23 17:35:48 +0000
commit89b8ffa013c10db57be14fbdd59757c08c243e18 (patch)
treee753cc920e37e72bec6a7ae391edcf25940f2db3 /application
parentSimplified Frustum (diff)
downloadilt-89b8ffa013c10db57be14fbdd59757c08c243e18.tar.bz2
ilt-89b8ffa013c10db57be14fbdd59757c08c243e18.tar.xz
ilt-89b8ffa013c10db57be14fbdd59757c08c243e18.zip
Tidy the preFrame logic into a single function in SceneRenderer
Clients now just call that one helper and SceneProvider passes in all the renderables.
Diffstat (limited to 'application')
-rw-r--r--application/resviewer.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/application/resviewer.cpp b/application/resviewer.cpp
index 0e34c05..68c2316 100644
--- a/application/resviewer.cpp
+++ b/application/resviewer.cpp
@@ -44,9 +44,9 @@ private:
void
render() override
{
- const auto & [camFrust, lightFrust] = preFrame(gameState->environment->getSunPos());
+ SceneRenderer::preFrame(*this, gameState->environment->getSunPos());
SceneRenderer::render(*this);
- controls(camFrust, lightFrust);
+ controls();
}
void
@@ -90,12 +90,12 @@ private:
}
void
- controls(const Frustum & camFrust, const Frustum & lightFrust)
+ controls()
{
if (ImGui::Begin("Resource view")) {
ImGui::SetWindowSize({});
fileSelection();
- assetSelection(camFrust, lightFrust);
+ assetSelection();
}
ImGui::End();
@@ -131,7 +131,7 @@ private:
}
void
- assetSelection(const Frustum & camFrust, const Frustum & lightFrust)
+ assetSelection()
{
if (!gameState->assets.empty()) {
ImGui::BeginListBox("Asset");
@@ -142,7 +142,6 @@ private:
selectedAssetId = asset.first;
selectedAsset = renderable;
location = asset.second->createAt(position);
- renderable->preFrame(camFrust, lightFrust);
}
}
}
@@ -151,6 +150,14 @@ private:
}
void
+ forEachRenderable(const RenderableProcessor & func) const override
+ {
+ if (selectedAsset) {
+ func(selectedAsset);
+ }
+ }
+
+ void
content(const SceneShader & sceneShader, const Frustum & frustum) const override
{
gameState->terrain->render(sceneShader, frustum);
@@ -186,7 +193,7 @@ private:
std::filesystem::file_time_type fileTime;
const std::filesystem::path * selectedFile {};
std::string selectedAssetId;
- const Renderable * selectedAsset {};
+ Renderable * selectedAsset {};
Location position {.pos = {0, 0, TERRAIN_HEIGHT}, .rot = {}};
std::any location;
Angle cameraAngle {0.F};