mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed light cap
This commit is contained in:
parent
b34d22565e
commit
16c8ecec66
@ -172,6 +172,7 @@ impl Server {
|
||||
.with(comp::Vel(Vec3::zero()))
|
||||
.with(comp::Ori(Vec3::unit_y()))
|
||||
.with(comp::Body::Object(object))
|
||||
//.with(comp::Stats::new("Objecty McObjectface".to_string()))
|
||||
.with(comp::ActionState::default())
|
||||
.with(comp::ForceUpdate)
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ use vek::*;
|
||||
// TODO: Don't hard-code this.
|
||||
const CURSOR_PAN_SCALE: f32 = 0.005;
|
||||
|
||||
const MAX_LIGHT_COUNT: usize = 32;
|
||||
const LIGHT_DIST_RADIUS: f32 = 64.0; // The distance beyond which lights may not be visible
|
||||
|
||||
struct Skybox {
|
||||
@ -145,11 +146,11 @@ impl Scene {
|
||||
})
|
||||
.map(|(pos,)| pos.0)
|
||||
.map(|pos| Light::new(pos + Vec3::unit_z(), Rgb::broadcast(1.0), 100.0)) // TODO: Don't add 1 to z!
|
||||
.take(32)
|
||||
.collect::<Vec<_>>();
|
||||
lights.sort_by_key(|light| {
|
||||
Vec3::from(Vec4::from(light.pos)).distance_squared(player_pos) as i32
|
||||
});
|
||||
lights.truncate(MAX_LIGHT_COUNT);
|
||||
renderer
|
||||
.update_consts(&mut self.lights, &lights)
|
||||
.expect("Failed to update light constants");
|
||||
|
Loading…
Reference in New Issue
Block a user