Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Testing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ void ProcessCommandLine(int argc, char** argv, donut::app::DeviceCreationParamet
("render-height", "Internal render target height, overrides window size", value(args.renderHeight))
("save-file", "Save frame to file and exit", value(args.saveFrameFileName))
("save-frame", "Index of the frame to save, default is 0", value(args.saveFrameIndex))
("scene-file", "Name of the scene file in the 'media' folder", value(args.sceneFile))
("tone-mapping", "Tone mapping toggle", value(ui.enableToneMapping))
("transparent", "Transparent materials toggle", value(ui.gbufferSettings.enableTransparentGeometry))
("verbose", "Enable debug log messages", value(args.verbose))
Expand Down
1 change: 1 addition & 0 deletions src/Testing.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct CommandLineArguments
bool disableBackgroundOptimization = false;
int renderWidth = 0;
int renderHeight = 0;
std::string sceneFile = "bistro-rtxdi.scene.json";
};

void ProcessCommandLine(int argc, char** argv, donut::app::DeviceCreationParameters& deviceParams, UIData& ui, CommandLineArguments& args);
Expand Down
25 changes: 21 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class SceneRenderer : public app::ApplicationBase
m_BindlessLayout = GetDevice()->createBindlessLayout(bindlessLayoutDesc);
}

std::filesystem::path scenePath = "/media/bistro-rtxdi.scene.json";
std::filesystem::path scenePath = "/media/" + m_args.sceneFile;

m_DescriptorTableManager = std::make_shared<engine::DescriptorTableManager>(GetDevice(), m_BindlessLayout);

Expand Down Expand Up @@ -314,10 +314,27 @@ class SceneRenderer : public app::ApplicationBase

m_Scene->FinishedLoading(GetFrameIndex());

m_Camera.LookAt(float3(-7.688f, 2.0f, 5.594f), float3(-7.3341f, 2.0f, 6.5366f));
m_Camera.SetMoveSpeed(3.f);

const auto& sceneGraph = m_Scene->GetSceneGraph();
const auto& cameras = sceneGraph->GetCameras();

if (!cameras.empty())
{
const std::shared_ptr<engine::SceneCamera>& glTfCam = cameras[0];

auto camPos = glTfCam->GetViewToWorldMatrix().transformPoint(dm::float3(0.0f));
auto camTarget = glTfCam->GetViewToWorldMatrix().transformPoint(dm::float3(0.0f, 0.0f, 1.0f));
m_Camera.LookAt(camPos, camTarget);

if (auto glTFPerspectiveCam = std::static_pointer_cast<engine::PerspectiveCamera>(glTfCam); glTFPerspectiveCam)
{
m_ui.verticalFov = dm::degrees(glTFPerspectiveCam->verticalFov);
}
}
else
{
m_Camera.LookAt(float3(-7.688f, 2.0f, 5.594f), float3(-7.3341f, 2.0f, 6.5366f));
}
m_Camera.SetMoveSpeed(3.f);

for (const auto& pLight : sceneGraph->GetLights())
{
Expand Down