Skip to content

Commit

Permalink
Merge pull request #21 from rodolphito/exposure2
Browse files Browse the repository at this point in the history
more fixing ...
  • Loading branch information
JMS55 committed Jan 16, 2024
2 parents cc11b23 + 55444b4 commit a7b22be
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions examples/3d/lightmaps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn main() {
.add_plugins(DefaultPlugins)
.insert_resource(AmbientLight {
color: Color::WHITE,
brightness: 0.2,
brightness: 0.0,
})
.add_systems(Startup, setup)
.add_systems(Update, add_lightmaps_to_meshes)
Expand Down Expand Up @@ -36,9 +36,15 @@ fn add_lightmaps_to_meshes(
(With<Handle<Mesh>>, Without<Lightmap>),
>,
) {
let exposure = 250.0;
for (entity, name, material) in meshes.iter() {
if &**name == "Light" {
materials.get_mut(material).unwrap().emissive = Color::WHITE * exposure;
continue;
}

if &**name == "large_box" {
materials.get_mut(material).unwrap().lightmap_exposure = 120.0;
materials.get_mut(material).unwrap().lightmap_exposure = exposure;
commands.entity(entity).insert(Lightmap {
image: asset_server.load("lightmaps/CornellBox-Large.zstd.ktx2"),
..default()
Expand All @@ -47,7 +53,7 @@ fn add_lightmaps_to_meshes(
}

if &**name == "small_box" {
materials.get_mut(material).unwrap().lightmap_exposure = 120.0;
materials.get_mut(material).unwrap().lightmap_exposure = exposure;
commands.entity(entity).insert(Lightmap {
image: asset_server.load("lightmaps/CornellBox-Small.zstd.ktx2"),
..default()
Expand All @@ -56,7 +62,7 @@ fn add_lightmaps_to_meshes(
}

if name.starts_with("cornell_box") {
materials.get_mut(material).unwrap().lightmap_exposure = 120.0;
materials.get_mut(material).unwrap().lightmap_exposure = exposure;
commands.entity(entity).insert(Lightmap {
image: asset_server.load("lightmaps/CornellBox-Box.zstd.ktx2"),
..default()
Expand Down

0 comments on commit a7b22be

Please sign in to comment.