diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c03261b87..078d5790e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Power stat to weapons which affects weapon damage - Add detection of entities under the cursor - Functional group-system with exp-sharing and disabled damage to group members +- Some Campfire, fireball & bomb; particle, light & sound effects. ### Changed diff --git a/server/src/sys/sentinel.rs b/server/src/sys/sentinel.rs index 6121dbb4a9..8bda2339e8 100644 --- a/server/src/sys/sentinel.rs +++ b/server/src/sys/sentinel.rs @@ -2,8 +2,7 @@ use super::SysTimer; use common::{ comp::{ Alignment, Body, CanBuild, CharacterState, Collider, Energy, Gravity, Item, LightEmitter, - Loadout, Mass, MountState, Mounting, Ori, Player, Pos, - Scale, Stats, Sticky, Vel, + Loadout, Mass, MountState, Mounting, Ori, Player, Pos, Scale, Stats, Sticky, Vel, }, msg::EcsCompPacket, sync::{CompSyncPackage, EntityPackage, EntitySyncPackage, Uid, UpdateTracker, WorldSyncExt}, diff --git a/voxygen/src/render/mod.rs b/voxygen/src/render/mod.rs index 408251d9ad..317ba97db6 100644 --- a/voxygen/src/render/mod.rs +++ b/voxygen/src/render/mod.rs @@ -18,11 +18,11 @@ pub use self::{ pipelines::{ figure::{BoneData as FigureBoneData, FigurePipeline, Locals as FigureLocals}, fluid::FluidPipeline, + particle::{Instance as ParticleInstance, ParticlePipeline}, postprocess::{ create_mesh as create_pp_mesh, Locals as PostProcessLocals, PostProcessPipeline, }, skybox::{create_mesh as create_skybox_mesh, Locals as SkyboxLocals, SkyboxPipeline}, - particle::{Instance as ParticleInstance, ParticlePipeline}, sprite::{Instance as SpriteInstance, SpritePipeline}, terrain::{Locals as TerrainLocals, TerrainPipeline}, ui::{ diff --git a/voxygen/src/render/renderer.rs b/voxygen/src/render/renderer.rs index 80bdb65ba5..1fa5cc6f2c 100644 --- a/voxygen/src/render/renderer.rs +++ b/voxygen/src/render/renderer.rs @@ -4,7 +4,9 @@ use super::{ instances::Instances, mesh::Mesh, model::{DynamicModel, Model}, - pipelines::{figure, fluid, postprocess, skybox, sprite, particle, terrain, ui, Globals, Light, Shadow}, + pipelines::{ + figure, fluid, particle, postprocess, skybox, sprite, terrain, ui, Globals, Light, Shadow, + }, texture::Texture, AaMode, CloudMode, FluidMode, Pipeline, RenderError, }; @@ -951,17 +953,17 @@ fn create_pipelines( gfx::state::CullFace::Back, )?; - // Construct a pipeline for rendering particles - let particle_pipeline = create_pipeline( - factory, - particle::pipe::new(), - &assets::load_watched::("voxygen.shaders.particle-vert", shader_reload_indicator) - .unwrap(), - &assets::load_watched::("voxygen.shaders.particle-frag", shader_reload_indicator) - .unwrap(), - &include_ctx, - gfx::state::CullFace::Back, - )?; + // Construct a pipeline for rendering particles + let particle_pipeline = create_pipeline( + factory, + particle::pipe::new(), + &assets::load_watched::("voxygen.shaders.particle-vert", shader_reload_indicator) + .unwrap(), + &assets::load_watched::("voxygen.shaders.particle-frag", shader_reload_indicator) + .unwrap(), + &include_ctx, + gfx::state::CullFace::Back, + )?; // Construct a pipeline for rendering UI elements let ui_pipeline = create_pipeline( diff --git a/voxygen/src/scene/particle.rs b/voxygen/src/scene/particle.rs index 3a72f92b94..abc3b0eb88 100644 --- a/voxygen/src/scene/particle.rs +++ b/voxygen/src/scene/particle.rs @@ -34,35 +34,10 @@ const MODEL_KEY: &str = "voxygen.voxel.particle"; impl ParticleMgr { pub fn new(renderer: &mut Renderer) -> Self { - let mut model_cache = HashMap::new(); - - model_cache.entry(MODEL_KEY).or_insert_with(|| { - let offset = Vec3::zero(); - let lod_scale = Vec3::one(); - - let vox = assets::load_expect::(MODEL_KEY); - - let mesh = &Meshable::::generate_mesh( - &Segment::from(vox.as_ref()), - (offset * lod_scale, Vec3::one() / lod_scale), - ) - .0; - - renderer - .create_model(mesh) - .expect("Failed to create particle model"); - }); - - let insts = Vec::new(); - - let instances = renderer - .create_instances(&insts) - .expect("Failed to upload particle instances to the GPU!"); - Self { particles: Vec::new(), - instances, - model_cache, + instances: default_instances(renderer), + model_cache: default_cache(renderer), } } @@ -270,3 +245,34 @@ impl ParticleMgr { } } } + +fn default_instances(renderer: &mut Renderer) -> Instances { + let empty_vec = Vec::new(); + + renderer + .create_instances(&empty_vec) + .expect("Failed to upload particle instances to the GPU!") +} + +fn default_cache(renderer: &mut Renderer) -> HashMap<&'static str, Model> { + let mut model_cache = HashMap::new(); + + model_cache.entry(MODEL_KEY).or_insert_with(|| { + let offset = Vec3::zero(); + let lod_scale = Vec3::one(); + + let vox = assets::load_expect::(MODEL_KEY); + + let mesh = &Meshable::::generate_mesh( + &Segment::from(vox.as_ref()), + (offset * lod_scale, Vec3::one() / lod_scale), + ) + .0; + + renderer + .create_model(mesh) + .expect("Failed to create particle model") + }); + + model_cache +}