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
|
### Added
|
||||||
- Waypoints saved between sessions and shared with group members.
|
- Waypoints saved between sessions and shared with group members.
|
||||||
- New rocks
|
- New rocks
|
||||||
- Weapont rails
|
- Weapon trails
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ void main() {
|
|||||||
float light_variable = 0.075;
|
float light_variable = 0.075;
|
||||||
|
|
||||||
// Make less faint at day (relative to night) by adding light to alpha. Probably hacky but looks fine.
|
// 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;
|
trail_alpha += get_sun_brightness() * light_variable;
|
||||||
|
|
||||||
tgt_color = vec4(trail_color, trail_alpha);
|
tgt_color = vec4(trail_color, trail_alpha);
|
||||||
|
@ -214,6 +214,7 @@ impl<'frame> Drawer<'frame> {
|
|||||||
|
|
||||||
/// Returns None if the clouds pipeline is not available
|
/// Returns None if the clouds pipeline is not available
|
||||||
pub fn second_pass(&mut self) -> Option<SecondPassDrawer> {
|
pub fn second_pass(&mut self) -> Option<SecondPassDrawer> {
|
||||||
|
let pipelines = &self.borrow.pipelines.all()?;
|
||||||
let encoder = self.encoder.as_mut().unwrap();
|
let encoder = self.encoder.as_mut().unwrap();
|
||||||
let device = self.borrow.device;
|
let device = self.borrow.device;
|
||||||
let mut render_pass =
|
let mut render_pass =
|
||||||
@ -239,8 +240,8 @@ impl<'frame> Drawer<'frame> {
|
|||||||
Some(SecondPassDrawer {
|
Some(SecondPassDrawer {
|
||||||
render_pass,
|
render_pass,
|
||||||
borrow: &self.borrow,
|
borrow: &self.borrow,
|
||||||
clouds_pipeline: &self.borrow.pipelines.all()?.clouds,
|
clouds_pipeline: &pipelines.clouds,
|
||||||
trail_pipeline: &self.borrow.pipelines.all()?.trail,
|
trail_pipeline: &pipelines.trail,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -945,12 +946,14 @@ impl<'pass> SecondPassDrawer<'pass> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw_trails(&mut self) -> Option<TrailDrawer<'_, '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);
|
let mut render_pass = self.render_pass.scope("trails", self.borrow.device);
|
||||||
|
|
||||||
render_pass.set_pipeline(&self.trail_pipeline.pipeline);
|
render_pass.set_pipeline(&self.trail_pipeline.pipeline);
|
||||||
set_quad_index_buffer::<trail::Vertex>(&mut render_pass, self.borrow);
|
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 })
|
Some(TrailDrawer { render_pass })
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ impl Scene {
|
|||||||
select_pos: None,
|
select_pos: None,
|
||||||
light_data: Vec::new(),
|
light_data: Vec::new(),
|
||||||
particle_mgr: ParticleMgr::new(renderer),
|
particle_mgr: ParticleMgr::new(renderer),
|
||||||
trail_mgr: TrailMgr::new(renderer),
|
trail_mgr: TrailMgr::default(),
|
||||||
figure_mgr: FigureMgr::new(renderer),
|
figure_mgr: FigureMgr::new(renderer),
|
||||||
sfx_mgr: SfxMgr::default(),
|
sfx_mgr: SfxMgr::default(),
|
||||||
music_mgr: MusicMgr::default(),
|
music_mgr: MusicMgr::default(),
|
||||||
|
@ -12,6 +12,7 @@ struct MeshKey {
|
|||||||
is_main_weapon: bool,
|
is_main_weapon: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct TrailMgr {
|
pub struct TrailMgr {
|
||||||
/// Meshes for each entity, usize is the last offset tick it was updated
|
/// Meshes for each entity, usize is the last offset tick it was updated
|
||||||
entity_meshes: HashMap<MeshKey, (Mesh<TrailVertex>, usize)>,
|
entity_meshes: HashMap<MeshKey, (Mesh<TrailVertex>, usize)>,
|
||||||
@ -33,16 +34,6 @@ const TRAIL_DYNAMIC_MODEL_SIZE: usize = 15;
|
|||||||
const TRAIL_SHRINKAGE: f32 = 0.8;
|
const TRAIL_SHRINKAGE: f32 = 0.8;
|
||||||
|
|
||||||
impl TrailMgr {
|
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) {
|
pub fn maintain(&mut self, renderer: &mut Renderer, scene_data: &SceneData) {
|
||||||
span!(_guard, "maintain", "TrailMgr::maintain");
|
span!(_guard, "maintain", "TrailMgr::maintain");
|
||||||
|
|
||||||
|
@ -1551,7 +1551,6 @@ impl PlayState for SessionState {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Render world
|
// Render world
|
||||||
{
|
|
||||||
self.scene.render(
|
self.scene.render(
|
||||||
drawer,
|
drawer,
|
||||||
client.state(),
|
client.state(),
|
||||||
@ -1559,7 +1558,6 @@ impl PlayState for SessionState {
|
|||||||
client.get_tick(),
|
client.get_tick(),
|
||||||
&scene_data,
|
&scene_data,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(mut second_pass) = drawer.second_pass() {
|
if let Some(mut second_pass) = drawer.second_pass() {
|
||||||
// Clouds
|
// Clouds
|
||||||
|
Loading…
Reference in New Issue
Block a user