Skip to content

Aspect ratio is not applied to scene in Testbed #481

@julcst

Description

@julcst

Testbed does not apply the current aspect ratio of the framebuffer to the scene camera.

Proposed fix:

// ...existing code...
void Testbed::loadScene(const std::filesystem::path& path, SceneBuilder::Flags buildFlags)
{
    mpScene = SceneBuilder(mpDevice, path, Settings(), buildFlags).getScene();

+   // Ensure scene camera matches current target FBO aspect
+   if (mpScene && mpTargetFBO)
+       mpScene->setCameraAspectRatio(mpTargetFBO->getWidth() / float(mpTargetFBO->getHeight()));

    if (mpRenderGraph)
        mpRenderGraph->setScene(mpScene);
}
// ...existing code...

void Testbed::loadSceneFromString(const std::string& scene, const std::string extension, SceneBuilder::Flags buildFlags)
{
    mpScene = SceneBuilder(mpDevice, scene.data(), scene.length(), extension, Settings(), buildFlags).getScene();

+   // Ensure scene camera matches current target FBO aspect
+   if (mpScene && mpTargetFBO)
+       mpScene->setCameraAspectRatio(mpTargetFBO->getWidth() / float(mpTargetFBO->getHeight()));

    if (mpRenderGraph)
        mpRenderGraph->setScene(mpScene);
}
// ...existing code...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions