Skip to content

Commit

Permalink
- tweak swirling trash lights
Browse files Browse the repository at this point in the history
  • Loading branch information
polymonster committed Apr 29, 2023
1 parent 85083f3 commit 1e0da37
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions plugins/ecs_examples/src/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1782,21 +1782,44 @@ pub fn setup_gpu_frustum_culling(
let light_buffer = &mut pmfx.get_world_buffers_mut().point_light;
light_buffer.clear();

for _ in 0..num_lights {
let pos = vec3f(rng.gen(), rng.gen(), rng.gen()) * splat3f(range) * 2.0 - vec3f(range, 0.0, range);
let col = rgba8_to_vec4(0xffffffff);
let cols : [Vec4f; 4] = [
rgba8_to_vec4(0x6c698dff),
rgba8_to_vec4(0xd4d2d5ff),
rgba8_to_vec4(0xbfafa6ff),
rgba8_to_vec4(0xe7cee3ff)
];
let col_dist = rand::distributions::Uniform::from(0..cols.len());

for l in 0..num_lights {
let mut pos = vec3f(rng.gen(), rng.gen(), rng.gen()) * splat3f(range) * 2.0 - vec3f(range, 0.0, range);

let mut radius = 64.0;
let mut col = cols[col_dist.sample(&mut rng)];

if l == 0 {
radius = 256.0;
pos = vec3f(0.0, range, 0.0);
col = rgba8_to_vec4(0xffffffff);
}

if l == 1 {
radius = 256.0;
pos = vec3f(0.0, 0.0, 0.0);
col = rgba8_to_vec4(0xffffffff);
}

commands.spawn((
Position(pos),
Colour(col),
LightComponent {
light_type: LightType::Point,
radius: 128.0,
radius: radius,
..Default::default()
}
));
light_buffer.push(&PointLightData{
pos: pos,
radius: 64.0,
radius: radius,
colour: col
});
}
Expand Down

0 comments on commit 1e0da37

Please sign in to comment.