Skip to content

Commit

Permalink
Zephyr: Next: display multiple models at once
Browse files Browse the repository at this point in the history
  • Loading branch information
fleroviux committed May 3, 2024
1 parent baf667f commit fe33a1d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/next/src/gltf_loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ namespace zephyr {
const nlohmann::json gltf_json = nlohmann::json::parse(gltf_file);

m_base_path = std::filesystem::path{path}.remove_filename();
m_buffers.clear();
m_buffer_views.clear();
m_accessors.clear();
m_meshes.clear();

LoadBuffers(gltf_json);
LoadBufferViews(gltf_json);
Expand Down
15 changes: 11 additions & 4 deletions app/next/src/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,17 @@ namespace zephyr {
m_scene_root = std::make_unique<SceneNode>();

GLTFLoader gltf_loader{};
std::unique_ptr<SceneNode> gltf_scene = gltf_loader.Parse("models/DamagedHelmet/DamagedHelmet.gltf");
gltf_scene->GetTransform().GetPosition() = Vector3{0.0f, 0.0f, -5.0f};
gltf_scene->GetTransform().GetRotation().SetFromEuler(1.5f, 0.0f, 0.0f);
m_scene_root->Add(std::move(gltf_scene));

std::unique_ptr<SceneNode> gltf_scene_1 = gltf_loader.Parse("models/DamagedHelmet/DamagedHelmet.gltf");
gltf_scene_1->GetTransform().GetPosition() = {1.0f, 0.0f, -5.0f};
gltf_scene_1->GetTransform().GetRotation().SetFromEuler(1.5f, 0.0f, 0.0f);
m_scene_root->Add(std::move(gltf_scene_1));

std::unique_ptr<SceneNode> gltf_scene_2 = gltf_loader.Parse("models/Behemoth/scene.gltf");
gltf_scene_2->GetTransform().GetPosition() = Vector3{-1.0f, 0.0f, -5.0f};
gltf_scene_2->GetTransform().GetRotation().SetFromEuler(-M_PI * 0.5, M_PI, 0.0f);
gltf_scene_2->GetTransform().GetScale() = {0.5f, 0.5f, 0.5f};
m_scene_root->Add(std::move(gltf_scene_2));
}

void MainWindow::CleanupVulkan() {
Expand Down

0 comments on commit fe33a1d

Please sign in to comment.