Update changelog

This commit is contained in:
scott-c 2020-07-25 23:56:50 +08:00
parent 5acfe44cbb
commit 5ba4d26821
5 changed files with 50 additions and 42 deletions

View File

@ -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

View File

@ -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},

View File

@ -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::{

View File

@ -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::<String>("voxygen.shaders.particle-vert", shader_reload_indicator)
.unwrap(),
&assets::load_watched::<String>("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::<String>("voxygen.shaders.particle-vert", shader_reload_indicator)
.unwrap(),
&assets::load_watched::<String>("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(

View File

@ -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::<DotVoxData>(MODEL_KEY);
let mesh = &Meshable::<ParticlePipeline, ParticlePipeline>::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<ParticleInstance> {
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<ParticlePipeline>> {
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::<DotVoxData>(MODEL_KEY);
let mesh = &Meshable::<ParticlePipeline, ParticlePipeline>::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
}