mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Addressed review comments
This commit is contained in:
parent
7ac6be27f0
commit
89bf529a5e
@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Added
|
||||
- Waypoints saved between sessions and shared with group members.
|
||||
- New rocks
|
||||
- Weapont rails
|
||||
- Weapon trails
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -37,6 +37,7 @@ void main() {
|
||||
float light_variable = 0.075;
|
||||
|
||||
// Make less faint at day (relative to night) by adding light to alpha. Probably hacky but looks fine.
|
||||
// TODO: Trails should also eventually account for shadows, nearby lights, attenuation of sunlight in water, and block based lighting. Note: many of these will require alternative methods that don't require a normal.
|
||||
trail_alpha += get_sun_brightness() * light_variable;
|
||||
|
||||
tgt_color = vec4(trail_color, trail_alpha);
|
||||
|
@ -214,6 +214,7 @@ impl<'frame> Drawer<'frame> {
|
||||
|
||||
/// Returns None if the clouds pipeline is not available
|
||||
pub fn second_pass(&mut self) -> Option<SecondPassDrawer> {
|
||||
let pipelines = &self.borrow.pipelines.all()?;
|
||||
let encoder = self.encoder.as_mut().unwrap();
|
||||
let device = self.borrow.device;
|
||||
let mut render_pass =
|
||||
@ -239,8 +240,8 @@ impl<'frame> Drawer<'frame> {
|
||||
Some(SecondPassDrawer {
|
||||
render_pass,
|
||||
borrow: &self.borrow,
|
||||
clouds_pipeline: &self.borrow.pipelines.all()?.clouds,
|
||||
trail_pipeline: &self.borrow.pipelines.all()?.trail,
|
||||
clouds_pipeline: &pipelines.clouds,
|
||||
trail_pipeline: &pipelines.trail,
|
||||
})
|
||||
}
|
||||
|
||||
@ -945,12 +946,14 @@ impl<'pass> SecondPassDrawer<'pass> {
|
||||
}
|
||||
|
||||
pub fn draw_trails(&mut self) -> Option<TrailDrawer<'_, 'pass>> {
|
||||
let shadow = &self.borrow.shadow?;
|
||||
|
||||
let mut render_pass = self.render_pass.scope("trails", self.borrow.device);
|
||||
|
||||
render_pass.set_pipeline(&self.trail_pipeline.pipeline);
|
||||
set_quad_index_buffer::<trail::Vertex>(&mut render_pass, self.borrow);
|
||||
|
||||
render_pass.set_bind_group(1, &self.borrow.shadow?.bind.bind_group, &[]);
|
||||
render_pass.set_bind_group(1, &shadow.bind.bind_group, &[]);
|
||||
|
||||
Some(TrailDrawer { render_pass })
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ impl Scene {
|
||||
select_pos: None,
|
||||
light_data: Vec::new(),
|
||||
particle_mgr: ParticleMgr::new(renderer),
|
||||
trail_mgr: TrailMgr::new(renderer),
|
||||
trail_mgr: TrailMgr::default(),
|
||||
figure_mgr: FigureMgr::new(renderer),
|
||||
sfx_mgr: SfxMgr::default(),
|
||||
music_mgr: MusicMgr::default(),
|
||||
|
@ -12,6 +12,7 @@ struct MeshKey {
|
||||
is_main_weapon: bool,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct TrailMgr {
|
||||
/// Meshes for each entity, usize is the last offset tick it was updated
|
||||
entity_meshes: HashMap<MeshKey, (Mesh<TrailVertex>, usize)>,
|
||||
@ -33,16 +34,6 @@ const TRAIL_DYNAMIC_MODEL_SIZE: usize = 15;
|
||||
const TRAIL_SHRINKAGE: f32 = 0.8;
|
||||
|
||||
impl TrailMgr {
|
||||
pub fn new(_renderer: &mut Renderer) -> Self {
|
||||
Self {
|
||||
entity_meshes: HashMap::new(),
|
||||
pos_cache: HashMap::new(),
|
||||
offset: 0,
|
||||
dynamic_model: None,
|
||||
model_len: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn maintain(&mut self, renderer: &mut Renderer, scene_data: &SceneData) {
|
||||
span!(_guard, "maintain", "TrailMgr::maintain");
|
||||
|
||||
|
@ -1551,15 +1551,13 @@ impl PlayState for SessionState {
|
||||
};
|
||||
|
||||
// Render world
|
||||
{
|
||||
self.scene.render(
|
||||
drawer,
|
||||
client.state(),
|
||||
client.entity(),
|
||||
client.get_tick(),
|
||||
&scene_data,
|
||||
);
|
||||
}
|
||||
self.scene.render(
|
||||
drawer,
|
||||
client.state(),
|
||||
client.entity(),
|
||||
client.get_tick(),
|
||||
&scene_data,
|
||||
);
|
||||
|
||||
if let Some(mut second_pass) = drawer.second_pass() {
|
||||
// Clouds
|
||||
|
Loading…
Reference in New Issue
Block a user