Skip to content

Commit 555520b

Browse files
committed
Fix rendering for consolidated multi-PLY loads
1 parent 0aaa525 commit 555520b

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/core/scene.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ namespace lfs::core {
424424
constexpr size_t BYTES_PER_GAUSSIAN = 3 * 4 + 1 * 3 * 4 + 3 * 4 + 4 * 4 + 1 * 4;
425425
const size_t saved_mb = getTotalGaussianCount() * BYTES_PER_GAUSSIAN / (1024 * 1024);
426426
LOG_INFO("Consolidated {} nodes, saved ~{} MB VRAM", consolidated, saved_mb);
427-
notifyMutation(MutationType::MODEL_CHANGED);
427+
notifyMutation(MutationType::VISIBILITY_CHANGED);
428428
}
429429

430430
return consolidated;
@@ -439,7 +439,7 @@ namespace lfs::core {
439439
mask.reserve(consolidated_node_ids_.size());
440440
for (const NodeId id : consolidated_node_ids_) {
441441
if (const auto* node = getNodeById(id)) {
442-
mask.push_back(node->visible.get());
442+
mask.push_back(isNodeEffectivelyVisible(node->id));
443443
} else {
444444
mask.push_back(true);
445445
}
@@ -859,6 +859,15 @@ namespace lfs::core {
859859
return;
860860

861861
cached_transforms_.clear();
862+
if (consolidated_ && !consolidated_node_ids_.empty()) {
863+
cached_transforms_.reserve(consolidated_node_ids_.size());
864+
for (const NodeId id : consolidated_node_ids_) {
865+
cached_transforms_.push_back(getWorldTransform(id));
866+
}
867+
transform_cache_valid_.store(true, std::memory_order_release);
868+
return;
869+
}
870+
862871
for (const auto& node : nodes_) {
863872
if (node->model && isNodeEffectivelyVisible(node->id)) {
864873
cached_transforms_.push_back(getWorldTransform(node->id));
@@ -921,6 +930,7 @@ namespace lfs::core {
921930
int Scene::getVisibleNodeIndex(const NodeId node_id) const {
922931
if (node_id == NULL_NODE)
923932
return -1;
933+
924934
int index = 0;
925935
for (const auto& node : nodes_) {
926936
if (!node->visible || !node->model)

src/visualizer/scene/scene_manager.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2522,10 +2522,15 @@ namespace lfs::vis {
25222522
transform = rendering::dataWorldTransformToVisualizerWorld(transform);
25232523
}
25242524
state.transform_indices = scene_.getTransformIndices();
2525-
state.visible_splat_count = state.model_transforms.size();
25262525

25272526
// Get node visibility mask (for consolidated models)
25282527
state.node_visibility_mask = scene_.getNodeVisibilityMask();
2528+
state.visible_splat_count = state.node_visibility_mask.empty()
2529+
? state.model_transforms.size()
2530+
: static_cast<size_t>(std::count(
2531+
state.node_visibility_mask.begin(),
2532+
state.node_visibility_mask.end(),
2533+
true));
25292534
}
25302535
state.camera_scene_transforms = scene_.getVisibleCameraSceneTransforms();
25312536
for (auto& transform : state.camera_scene_transforms) {

0 commit comments

Comments
 (0)