Skip to content

Commit

Permalink
Add albedo_factor to Asset3D loaded from obj file
Browse files Browse the repository at this point in the history
  • Loading branch information
EtaLoop committed Sep 20, 2024
1 parent 279820b commit f86f304
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/viewer/re_renderer/src/importer/obj.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::sync::Arc;

use re_types::components::AlbedoFactor;
use smallvec::smallvec;

use crate::{
Expand Down Expand Up @@ -27,6 +28,7 @@ pub fn load_obj_from_buffer(
buffer: &[u8],
lifetime: ResourceLifeTime,
ctx: &RenderContext,
albedo_factor: Option<AlbedoFactor>,
) -> Result<Vec<MeshInstance>, ObjImportError> {
re_tracing::profile_function!();

Expand Down Expand Up @@ -102,7 +104,7 @@ pub fn load_obj_from_buffer(
label: "default material".into(),
index_range: 0..mesh.indices.len() as u32,
albedo: texture.clone(),
albedo_factor: crate::Rgba::WHITE,
albedo_factor: albedo_factor.map_or(crate::Rgba::WHITE, |c| c.0.into()),
}],
};

Expand Down
1 change: 1 addition & 0 deletions crates/viewer/re_renderer_examples/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ pub fn load_rerun_mesh(re_ctx: &RenderContext) -> Vec<re_renderer::renderer::Mes
&obj_data,
re_renderer::resource_managers::ResourceLifeTime::LongLived,
re_ctx,
None,
)
.unwrap()
}
Expand Down
1 change: 1 addition & 0 deletions crates/viewer/re_space_view_spatial/src/mesh_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl LoadedMesh {
bytes,
ResourceLifeTime::LongLived,
render_ctx,
asset3d.albedo_factor,
)?,
MediaType::STL => {
re_renderer::importer::stl::load_stl_from_buffer(asset3d, render_ctx, texture_key)?
Expand Down

0 comments on commit f86f304

Please sign in to comment.