Skip to content

Commit

Permalink
Additional option to extract all LODs
Browse files Browse the repository at this point in the history
  • Loading branch information
satoshi7190 committed Sep 20, 2024
1 parent d66377d commit d3b2c6b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nusamai/src/transformer/setting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ impl LodSelection {
("最大LOD", "max_lod"),
("最小LOD", "min_lod"),
("テクスチャ付き最大LOD", "textured_max_lod"),
// ("すべてのLOD", "lod_all"), // This option will be used in 3dtiles sink
]
}

Expand Down Expand Up @@ -152,7 +153,7 @@ impl TransformerRegistry {
data_requirements.set_lod_filter(transformer::LodFilterSpec {
mode: transformer::LodFilterMode::Highest,
..Default::default()
})
});
}
"min_lod" => {
data_requirements.set_lod_filter(transformer::LodFilterSpec {
Expand All @@ -167,6 +168,13 @@ impl TransformerRegistry {
});
data_requirements.set_appearance(true);
}
"all_lod" => {
data_requirements.set_lod_filter(transformer::LodFilterSpec {
mode: transformer::LodFilterMode::All,
..Default::default()
});
data_requirements.set_appearance(true);
}

Check warning on line 177 in nusamai/src/transformer/setting.rs

View check run for this annotation

Codecov / codecov/patch

nusamai/src/transformer/setting.rs#L164-L177

Added lines #L164 - L177 were not covered by tests
_ => {}
}
}
Expand Down
5 changes: 5 additions & 0 deletions nusamai/src/transformer/transform/lods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub enum LodFilterMode {
Highest,
Lowest,
TexturedHighest,
All,
}

#[derive()]
Expand All @@ -32,6 +33,7 @@ impl Transform for FilterLodTransform {
fn transform(&mut self, _feedback: &Feedback, mut entity: Entity, out: &mut Vec<Entity>) {
match self.mode {
LodFilterMode::TexturedHighest => {
// TODO: Processing needs to be optimised
let original_lods = find_lods(&entity.root) & self.mask;
let mut current_lods = original_lods;
let mut highest_lod_entity = None;

Check warning on line 39 in nusamai/src/transformer/transform/lods.rs

View check run for this annotation

Codecov / codecov/patch

nusamai/src/transformer/transform/lods.rs#L37-L39

Added lines #L37 - L39 were not covered by tests
Expand Down Expand Up @@ -88,6 +90,9 @@ impl Transform for FilterLodTransform {
out.push(entity);
}

Check warning on line 91 in nusamai/src/transformer/transform/lods.rs

View check run for this annotation

Codecov / codecov/patch

nusamai/src/transformer/transform/lods.rs#L88-L91

Added lines #L88 - L91 were not covered by tests
}
LodFilterMode::All => {
out.push(entity);
}

Check warning on line 95 in nusamai/src/transformer/transform/lods.rs

View check run for this annotation

Codecov / codecov/patch

nusamai/src/transformer/transform/lods.rs#L93-L95

Added lines #L93 - L95 were not covered by tests
}
}

Expand Down

0 comments on commit d3b2c6b

Please sign in to comment.