Somewhat fix lod, prevent particles spamming new buffers when disabled

This commit is contained in:
Imbris 2020-12-06 16:22:48 -05:00 committed by Avi Weinstock
parent 513b761909
commit 6c8978a513
6 changed files with 14 additions and 8 deletions

View File

@ -9,7 +9,8 @@ struct Light {
layout (std140, set = 0, binding = 3)
uniform u_lights {
Light lights[31];
// TODO: insert light max count constant here when loading the shaders
Light lights[20];
};
struct Shadow {

View File

@ -136,7 +136,8 @@ float alt_at_real(vec2 pos) {
// #if (FLUID_MODE == FLUID_MODE_CHEAP)
// return alt_at(pos);
// #elif (FLUID_MODE == FLUID_MODE_SHINY)
return (/*round*/(utextureBicubic(t_alt, s_alt, pos_to_tex(pos)).r * (/*1300.0*//*1278.7266845703125*/view_distance.w)) + /*140.0*/view_distance.z - focus_off.z);
const float U16_MAX = 65535.0;
return (/*round*/(utextureBicubic(t_alt, s_alt, pos_to_tex(pos)).r / U16_MAX * (/*1300.0*//*1278.7266845703125*/view_distance.w)) + /*140.0*/view_distance.z - focus_off.z);
// #endif
//+ (texture(t_noise, pos * 0.002).x - 0.5) * 64.0;

View File

@ -11,7 +11,7 @@ struct ShadowLocals {
layout (std140, set = 0, binding = 9)
uniform u_light_shadows {
ShadowLocals shadowMats[/*MAX_LAYER_FACES*/192];
ShadowLocals shadowMats[/*MAX_LAYER_FACES*//*192*/126];
};
// Use with sampler2DShadow

View File

@ -220,6 +220,7 @@ impl Default for Shadow {
// Global scene data spread across several arrays.
pub struct GlobalModel {
// TODO: enforce that these are the lengths in the shaders??
pub globals: Consts<Globals>,
pub lights: Consts<Light>,
pub shadows: Consts<Shadow>,

View File

@ -236,15 +236,18 @@ impl ParticleMgr {
self.maintain_shockwave_particles(scene_data);
self.maintain_aura_particles(scene_data);
self.maintain_buff_particles(scene_data);
self.upload_particles(renderer);
} else {
// remove all particle lifespans
self.particles.clear();
if !self.particles.is_empty() {
self.particles.clear();
self.upload_particles(renderer);
}
// remove all timings
self.scheduler.clear();
}
self.upload_particles(renderer);
}
fn maintain_body_particles(&mut self, scene_data: &SceneData) {

View File

@ -107,8 +107,8 @@ impl Scene {
let data = GlobalModel {
globals: renderer.create_consts(&[Globals::default()]),
lights: renderer.create_consts(&[Light::default(); 32]),
shadows: renderer.create_consts(&[Shadow::default(); 32]),
lights: renderer.create_consts(&[Light::default(); 20]),
shadows: renderer.create_consts(&[Shadow::default(); 24]),
shadow_mats: renderer.create_consts(&[ShadowLocals::default(); 6]),
};
let lod = LodData::dummy(renderer);