mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Addressing imbris's initial feedback.
Fixes two minor bugs: explosion particles were no longer spawning randomly, and LOD grids were not perfectly even.
This commit is contained in:
parent
4cbad004f4
commit
a166ae0360
@ -11,6 +11,9 @@ pub type MeshGen<P, T, M> = (
|
||||
<M as Meshable<P, T>>::Result,
|
||||
);
|
||||
|
||||
/// FIXME: Remove this whole trait at some point. This "abstraction" is never
|
||||
/// abstracted over, and is organized completely differently from how we
|
||||
/// actually mesh things nowadays.
|
||||
pub trait Meshable<P: render::Pipeline, T> {
|
||||
type Pipeline: render::Pipeline;
|
||||
type TranslucentPipeline: render::Pipeline;
|
||||
|
@ -69,7 +69,8 @@ pub enum AaMode {
|
||||
None,
|
||||
/// Fast approximate antialiasing.
|
||||
///
|
||||
/// This is a screen-space technique, and therefore
|
||||
/// This is a screen-space technique, and therefore works fine with greedy
|
||||
/// meshing.
|
||||
Fxaa,
|
||||
/// Multisampling AA, up to 4 samples per pixel.
|
||||
///
|
||||
@ -135,7 +136,7 @@ pub enum CloudMode {
|
||||
/// clouds), we currently branch to see if we need to render the clouds in
|
||||
/// *every* fragment shader. For machines that can't optimize the check,
|
||||
/// this is absurdly expensive, so we should look at alternatives in the
|
||||
/// future that player better iwth the GPU.
|
||||
/// future that player better with the GPU.
|
||||
Regular,
|
||||
}
|
||||
|
||||
@ -180,14 +181,14 @@ pub enum LightingMode {
|
||||
/// physically plausible (to some extent) lighting distribution.
|
||||
///
|
||||
/// This mdoel may not work as well with purely directional lighting, and is
|
||||
/// more expensive than the otehr models.
|
||||
/// more expensive than the other models.
|
||||
Ashikhmin,
|
||||
/// Standard Blinn-Phong shading, combing Lambertian diffuse reflections and
|
||||
/// specular highlights.
|
||||
BlinnPhong,
|
||||
/// Standard Lambertian lighting model, with only diffuse reflections. The
|
||||
/// cheapest lighting model by a decent margin, but the performance
|
||||
/// dfifference between it and Blinn-Phong will probably only be
|
||||
/// difference between it and Blinn-Phong will probably only be
|
||||
/// significant on low-end machines that are bottlenecked on fragment
|
||||
/// shading.
|
||||
Lambertian,
|
||||
@ -200,9 +201,9 @@ impl Default for LightingMode {
|
||||
/// Shadow map settings.
|
||||
#[derive(PartialEq, Clone, Copy, Debug, Serialize, Deserialize)]
|
||||
pub struct ShadowMapMode {
|
||||
/// Multiple of default resolution (default is currenttly the closest higher
|
||||
/// power of two above the length of the longest diagonal of the screen
|
||||
/// resolution, but this may change).
|
||||
/// Multiple of default resolution (default, which is 1.0, is currently
|
||||
/// the closest higher power of two above the length of the longest
|
||||
/// diagonal of the screen resolution, but this may change).
|
||||
pub resolution: f32,
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ const DAMAGE_FADE_COEFFICIENT: f64 = 5.0;
|
||||
const MOVING_THRESHOLD: f32 = 0.7;
|
||||
const MOVING_THRESHOLD_SQR: f32 = MOVING_THRESHOLD * MOVING_THRESHOLD;
|
||||
|
||||
/// camera data, fiigure LOD render distance.
|
||||
/// camera data, figure LOD render distance.
|
||||
pub type CameraData<'a> = (&'a Camera, f32);
|
||||
|
||||
/// Enough data to render a figure model.
|
||||
@ -2622,7 +2622,7 @@ impl FigureColLights {
|
||||
}
|
||||
|
||||
/// NOTE: Panics if the opaque model's length does not fit in a u32.
|
||||
/// This is parto f the function contract.
|
||||
/// This is part of the function contract.
|
||||
///
|
||||
/// NOTE: Panics if the vertex range bounds are not in range of the opaque
|
||||
/// model stored in the BoneMeshes parameter. This is part of the
|
||||
@ -2677,7 +2677,7 @@ impl FigureColLights {
|
||||
..guillotiere::AllocatorOptions::default()
|
||||
});
|
||||
// TODO: Consider using a single texture atlas to store all figures, much like
|
||||
// we do for terrain chunks. We previoosly avoided this due to
|
||||
// we do for terrain chunks. We previously avoided this due to
|
||||
// perceived performance degradation for the figure use case, but with a
|
||||
// smaller atlas size this may be less likely.
|
||||
/* let texture = renderer.create_texture_raw(
|
||||
|
@ -42,10 +42,10 @@ impl Lod {
|
||||
|
||||
pub fn set_detail(&mut self, detail: u32) {
|
||||
// Make sure the recorded detail is even.
|
||||
self.data.tgt_detail = detail.max(100).min(2500) - self.data.tgt_detail % 2;
|
||||
self.data.tgt_detail = detail.max(100).min(2500) - detail % 2;
|
||||
}
|
||||
|
||||
pub fn maintain(&mut self, renderer: &mut Renderer, _time_of_day: f64) {
|
||||
pub fn maintain(&mut self, renderer: &mut Renderer) {
|
||||
if self
|
||||
.model
|
||||
.as_ref()
|
||||
|
@ -632,7 +632,7 @@ impl Scene {
|
||||
.expect("Failed to update global constants");
|
||||
|
||||
// Maintain LoD.
|
||||
self.lod.maintain(renderer, time_of_day);
|
||||
self.lod.maintain(renderer);
|
||||
|
||||
// Maintain the terrain.
|
||||
let (_visible_bounds, visible_light_volume, visible_psr_bounds) = self.terrain.maintain(
|
||||
|
@ -70,15 +70,14 @@ impl ParticleMgr {
|
||||
),
|
||||
);
|
||||
|
||||
self.particles.resize(
|
||||
self.particles.len() + 200,
|
||||
self.particles.resize_with(self.particles.len() + 200, || {
|
||||
Particle::new(
|
||||
Duration::from_secs(4),
|
||||
time,
|
||||
ParticleMode::CampfireSmoke,
|
||||
*pos + Vec2::<f32>::zero().map(|_| rng.gen_range(-1.0, 1.0) * power),
|
||||
),
|
||||
);
|
||||
)
|
||||
});
|
||||
},
|
||||
Outcome::ProjectileShot { .. } => {},
|
||||
}
|
||||
|
@ -686,8 +686,11 @@ impl PlayState for SessionState {
|
||||
|
||||
// Generate debug info, if needed (it iterates through enough data that we might
|
||||
// as well avoid it unless we need it).
|
||||
let debug_info = if global_state.settings.gameplay.toggle_debug {
|
||||
Some(DebugInfo {
|
||||
let debug_info = global_state
|
||||
.settings
|
||||
.gameplay
|
||||
.toggle_debug
|
||||
.then(|| DebugInfo {
|
||||
tps: global_state.clock.get_tps(),
|
||||
ping_ms: self.client.borrow().get_ping_ms_rolling_avg(),
|
||||
coordinates: self
|
||||
@ -723,10 +726,7 @@ impl PlayState for SessionState {
|
||||
num_particles: self.scene.particle_mgr().particle_count() as u32,
|
||||
num_particles_visible: self.scene.particle_mgr().particle_count_visible()
|
||||
as u32,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
});
|
||||
|
||||
// Extract HUD events ensuring the client borrow gets dropped.
|
||||
let mut hud_events = self.hud.maintain(
|
||||
@ -1175,7 +1175,7 @@ fn under_cursor(
|
||||
let cam_dist = cam_ray.0;
|
||||
|
||||
// The ray hit something, is it within range?
|
||||
let (build_pos, select_pos) = if matches!(cam_ray.1, Ok(Some(_)) if
|
||||
let (build_pos, select_pos) = if matches!(cam_ray.1, Ok(Some(_)) if
|
||||
player_pos.distance_squared(cam_pos + cam_dir * cam_dist)
|
||||
<= MAX_PICKUP_RANGE_SQR)
|
||||
{
|
||||
|
@ -32,7 +32,9 @@ use vek::*;
|
||||
|
||||
const fn initial_civ_count(map_size_lg: MapSizeLg) -> u32 {
|
||||
// NOTE: since map_size_lg's dimensions must fit in a u16, we can safely add
|
||||
// them here. NOTE: N48 at "default" scale of 10 × 10 bits.
|
||||
// them here.
|
||||
//
|
||||
// NOTE: 48 at "default" scale of 10 × 10 chunk bits (1024 × 1024 chunks).
|
||||
(3 << (map_size_lg.vec().x + map_size_lg.vec().y)) >> 16
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user