Physics with rapier3d #1
1 changed files with 71 additions and 70 deletions
|
|
@ -29,7 +29,7 @@ where
|
|||
// ---------- MATERIAL ----------
|
||||
let mut mat = Material::default();
|
||||
|
||||
let mat_idx = primitive.material().index().context("primitive has no material")?;
|
||||
if let Some(mat_idx) = primitive.material().index() {
|
||||
let material = doc.materials().nth(mat_idx).unwrap();
|
||||
let pbr = material.pbr_metallic_roughness();
|
||||
|
||||
|
|
@ -85,21 +85,21 @@ where
|
|||
}
|
||||
|
||||
// Normal map (linear)
|
||||
if let Some(info) = primitive.material().normal_texture() {
|
||||
if let Some(info) = material.normal_texture() {
|
||||
update_sampler(&mut mat, &info.texture());
|
||||
let view = info.texture().source().index();
|
||||
mat.normal = Some(glium_linear_texture(facade, &images[view])?);
|
||||
}
|
||||
|
||||
// Occlusion (linear)
|
||||
if let Some(info) = primitive.material().occlusion_texture() {
|
||||
if let Some(info) = material.occlusion_texture() {
|
||||
update_sampler(&mut mat, &info.texture());
|
||||
let view = info.texture().source().index();
|
||||
mat.occlusion = Some(glium_linear_texture(facade, &images[view])?);
|
||||
}
|
||||
|
||||
// Emissive (sRGB)
|
||||
if let Some(info) = primitive.material().emissive_texture() {
|
||||
if let Some(info) = material.emissive_texture() {
|
||||
update_sampler(&mut mat, &info.texture());
|
||||
let view = info.texture().source().index();
|
||||
mat.emissive = Some(glium_srgb_texture(facade, &images[view])?);
|
||||
|
|
@ -112,6 +112,7 @@ where
|
|||
mat.uv_scale = Vec2::new(xform.scale()[0], xform.scale()[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Vertex/index data ----
|
||||
let reader = primitive.reader(|buf| Some(&buffers[buf.index()].0));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue