mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix most of the cargo check warnings
This commit is contained in:
parent
972a6f3605
commit
93ad05d237
@ -55,7 +55,7 @@ use crate::{
|
||||
ecs::{comp as vcomp, comp::HpFloaterList},
|
||||
hud::{img_ids::ImgsRot, prompt_dialog::DialogOutcomeEvent},
|
||||
i18n::Localization,
|
||||
render::{Consts, Globals, UiDrawer},
|
||||
render::UiDrawer,
|
||||
scene::camera::{self, Camera},
|
||||
session::{
|
||||
settings_change::{Chat as ChatChange, Interface as InterfaceChange, SettingsChange},
|
||||
|
@ -44,7 +44,7 @@ impl<T: Copy + Pod> DynamicBuffer<T> {
|
||||
Self(buffer)
|
||||
}
|
||||
|
||||
pub fn update(&self, device: &wgpu::Device, queue: &wgpu::Queue, vals: &[T], offset: usize) {
|
||||
pub fn update(&self, queue: &wgpu::Queue, vals: &[T], offset: usize) {
|
||||
if !vals.is_empty() {
|
||||
queue.write_buffer(
|
||||
&self.buf,
|
||||
|
@ -18,14 +18,8 @@ impl<T: Copy + Pod> Consts<T> {
|
||||
}
|
||||
|
||||
/// Update the GPU-side value represented by this constant handle.
|
||||
pub fn update(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
queue: &wgpu::Queue,
|
||||
vals: &[T],
|
||||
offset: usize,
|
||||
) {
|
||||
self.buf.update(device, queue, vals, offset)
|
||||
pub fn update(&mut self, queue: &wgpu::Queue, vals: &[T], offset: usize) {
|
||||
self.buf.update(queue, vals, offset)
|
||||
}
|
||||
|
||||
pub fn buf(&self) -> &wgpu::Buffer { &self.buf.buf }
|
||||
|
@ -18,14 +18,8 @@ impl<T: Copy + Pod> Instances<T> {
|
||||
// TODO: count vs len naming scheme??
|
||||
pub fn count(&self) -> usize { self.buf.len() }
|
||||
|
||||
pub fn update(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
queue: &wgpu::Queue,
|
||||
vals: &[T],
|
||||
offset: usize,
|
||||
) {
|
||||
self.buf.update(device, queue, vals, offset)
|
||||
pub fn update(&mut self, queue: &wgpu::Queue, vals: &[T], offset: usize) {
|
||||
self.buf.update(queue, vals, offset)
|
||||
}
|
||||
|
||||
pub fn buf(&self) -> &wgpu::Buffer { &self.buf.buf }
|
||||
|
@ -61,14 +61,8 @@ impl<V: Vertex> DynamicModel<V> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update(
|
||||
&self,
|
||||
device: &wgpu::Device,
|
||||
queue: &wgpu::Queue,
|
||||
mesh: &Mesh<V>,
|
||||
offset: usize,
|
||||
) {
|
||||
self.vbuf.update(device, queue, mesh.vertices(), offset)
|
||||
pub fn update(&self, queue: &wgpu::Queue, mesh: &Mesh<V>, offset: usize) {
|
||||
self.vbuf.update(queue, mesh.vertices(), offset)
|
||||
}
|
||||
|
||||
/// Create a model with a slice of a portion of this model to send to the
|
||||
|
@ -1,10 +1,3 @@
|
||||
use super::{
|
||||
super::{AaMode, Consts},
|
||||
GlobalsLayouts,
|
||||
};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use vek::*;
|
||||
|
||||
pub struct BindGroup {
|
||||
pub(in super::super) bind_group: wgpu::BindGroup,
|
||||
}
|
||||
|
@ -41,11 +41,10 @@ pub struct LodData {
|
||||
impl LodData {
|
||||
pub fn dummy(renderer: &mut Renderer) -> Self {
|
||||
let map_size = Vec2::new(1, 1);
|
||||
let map_border = [0.0, 0.0, 0.0, 0.0];
|
||||
//let map_border = [0.0, 0.0, 0.0, 0.0];
|
||||
let map_image = [0];
|
||||
let alt_image = [0];
|
||||
let horizon_image = [0x_00_01_00_01];
|
||||
//let map_border = [0.0, 0.0, 0.0, 0.0];
|
||||
|
||||
Self::new(
|
||||
renderer,
|
||||
|
@ -1,4 +1,4 @@
|
||||
use super::super::{AaMode, Consts, GlobalsLayouts};
|
||||
use super::super::{Consts, GlobalsLayouts};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use vek::*;
|
||||
|
||||
|
@ -79,7 +79,7 @@ pub fn create_col_lights(
|
||||
renderer: &mut Renderer,
|
||||
(col_lights, col_lights_size): &ColLightInfo,
|
||||
) -> Texture {
|
||||
let mut texture_info = wgpu::TextureDescriptor {
|
||||
let texture_info = wgpu::TextureDescriptor {
|
||||
label: None,
|
||||
size: wgpu::Extent3d {
|
||||
width: col_lights_size.x,
|
||||
|
@ -1,12 +1,11 @@
|
||||
use super::{
|
||||
super::{
|
||||
buffer::Buffer, AaMode, Bound, Consts, GlobalsLayouts, Mesh, Renderer, TerrainLayout,
|
||||
Texture, Vertex as VertexTrait,
|
||||
buffer::Buffer, AaMode, GlobalsLayouts, Mesh, Renderer, TerrainLayout, Texture,
|
||||
Vertex as VertexTrait,
|
||||
},
|
||||
lod_terrain, GlobalModel,
|
||||
};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use core::fmt;
|
||||
use std::mem;
|
||||
use vek::*;
|
||||
|
||||
@ -88,9 +87,9 @@ impl VertexTrait for Vertex {
|
||||
const STRIDE: wgpu::BufferAddress = mem::size_of::<Self>() as wgpu::BufferAddress;
|
||||
}
|
||||
|
||||
pub fn create_verts_buffer(renderer: &mut Renderer, mut mesh: Mesh<Vertex>) -> Buffer<Vertex> {
|
||||
pub fn create_verts_buffer(renderer: &mut Renderer, mesh: Mesh<Vertex>) -> Buffer<Vertex> {
|
||||
renderer.ensure_sufficient_index_length::<Vertex>(VERT_PAGE_SIZE as usize);
|
||||
// TODO: type buffer by Usage
|
||||
// TODO: type Buffer by Usage
|
||||
Buffer::new(
|
||||
&renderer.device,
|
||||
wgpu::BufferUsage::STORAGE,
|
||||
|
@ -1,6 +1,4 @@
|
||||
use super::super::{
|
||||
AaMode, Bound, Consts, GlobalsLayouts, Quad, Texture, Tri, Vertex as VertexTrait,
|
||||
};
|
||||
use super::super::{Bound, Consts, GlobalsLayouts, Quad, Texture, Tri, Vertex as VertexTrait};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use std::mem;
|
||||
use vek::*;
|
||||
|
@ -21,12 +21,11 @@ use super::{
|
||||
mesh::Mesh,
|
||||
model::{DynamicModel, Model},
|
||||
pipelines::{
|
||||
blit, clouds, figure, fluid, lod_terrain, particle, postprocess, shadow, skybox, sprite,
|
||||
terrain, ui, GlobalsBindGroup, GlobalsLayouts, ShadowTexturesBindGroup,
|
||||
blit, clouds, figure, fluid, postprocess, shadow, sprite, terrain, ui, GlobalsBindGroup,
|
||||
GlobalsLayouts, ShadowTexturesBindGroup,
|
||||
},
|
||||
texture::Texture,
|
||||
AaMode, AddressMode, CloudMode, FilterMode, FluidMode, LightingMode, RenderError, RenderMode,
|
||||
ShadowMapMode, ShadowMode, Vertex,
|
||||
AaMode, AddressMode, FilterMode, RenderError, RenderMode, ShadowMapMode, ShadowMode, Vertex,
|
||||
};
|
||||
use common::assets::{self, AssetExt, AssetHandle};
|
||||
use common_base::span;
|
||||
@ -61,8 +60,8 @@ struct Layouts {
|
||||
|
||||
/// Render target views
|
||||
struct Views {
|
||||
// NOTE: unused for now
|
||||
win_depth: wgpu::TextureView,
|
||||
// NOTE: unused for now, maybe... we will want it for something
|
||||
_win_depth: wgpu::TextureView,
|
||||
|
||||
tgt_color: wgpu::TextureView,
|
||||
tgt_depth: wgpu::TextureView,
|
||||
@ -503,7 +502,6 @@ impl Renderer {
|
||||
&self.depth_sampler,
|
||||
);
|
||||
|
||||
let mode = &self.mode;
|
||||
// Get mutable reference to shadow views out of the current state
|
||||
let shadow_views = match &mut self.state {
|
||||
State::Interface { shadow_views, .. } => {
|
||||
@ -644,7 +642,7 @@ impl Renderer {
|
||||
usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
|
||||
});
|
||||
// TODO: Consider no depth buffer for the final draw to the window?
|
||||
let win_depth_view = tgt_depth_tex.create_view(&wgpu::TextureViewDescriptor {
|
||||
let win_depth_view = win_depth_tex.create_view(&wgpu::TextureViewDescriptor {
|
||||
label: None,
|
||||
format: Some(wgpu::TextureFormat::Depth32Float),
|
||||
dimension: Some(wgpu::TextureViewDimension::D2),
|
||||
@ -659,7 +657,7 @@ impl Renderer {
|
||||
tgt_color: tgt_color_view,
|
||||
tgt_depth: tgt_depth_view,
|
||||
tgt_color_pp: tgt_color_pp_view,
|
||||
win_depth: win_depth_view,
|
||||
_win_depth: win_depth_view,
|
||||
})
|
||||
}
|
||||
|
||||
@ -701,6 +699,7 @@ impl Renderer {
|
||||
// 1.0); }
|
||||
// }
|
||||
|
||||
// TODO: @Sharp what should this look like with wgpu?
|
||||
/// NOTE: Supported by Vulkan (by default), DirectX 10+ (it seems--it's hard
|
||||
/// to find proof of this, but Direct3D 10 apparently does it by
|
||||
/// default, and 11 definitely does, so I assume it's natively supported
|
||||
@ -708,8 +707,8 @@ impl Renderer {
|
||||
/// there may be some GPUs that don't quite support it correctly, the
|
||||
/// impact is relatively small, so there is no reason not to enable it where
|
||||
/// available.
|
||||
fn enable_seamless_cube_maps() {
|
||||
todo!()
|
||||
//fn enable_seamless_cube_maps() {
|
||||
//todo!()
|
||||
// unsafe {
|
||||
// // NOTE: Currently just fail silently rather than complain if the
|
||||
// computer is on // a version lower than 3.2, where
|
||||
@ -725,7 +724,7 @@ impl Renderer {
|
||||
// gl.Enable(gfx_gl::TEXTURE_CUBE_MAP_SEAMLESS);
|
||||
// });
|
||||
// }
|
||||
}
|
||||
//}
|
||||
|
||||
/// Start recording the frame
|
||||
/// When the returned `Drawer` is dropped the recorded draw calls will be
|
||||
@ -930,25 +929,21 @@ impl Renderer {
|
||||
vals: &[T],
|
||||
) -> Consts<T> {
|
||||
let mut consts = Consts::new(device, vals.len());
|
||||
consts.update(device, queue, vals, 0);
|
||||
consts.update(queue, vals, 0);
|
||||
consts
|
||||
}
|
||||
|
||||
/// Update a set of constants with the provided values.
|
||||
pub fn update_consts<T: Copy + bytemuck::Pod>(&self, consts: &mut Consts<T>, vals: &[T]) {
|
||||
consts.update(&self.device, &self.queue, vals, 0)
|
||||
consts.update(&self.queue, vals, 0)
|
||||
}
|
||||
|
||||
pub fn update_clouds_locals(&mut self, new_val: clouds::Locals) {
|
||||
self.locals
|
||||
.clouds
|
||||
.update(&self.device, &self.queue, &[new_val], 0)
|
||||
self.locals.clouds.update(&self.queue, &[new_val], 0)
|
||||
}
|
||||
|
||||
pub fn update_postprocess_locals(&mut self, new_val: postprocess::Locals) {
|
||||
self.locals
|
||||
.postprocess
|
||||
.update(&self.device, &self.queue, &[new_val], 0)
|
||||
self.locals.postprocess.update(&self.queue, &[new_val], 0)
|
||||
}
|
||||
|
||||
/// Create a new set of instances with the provided values.
|
||||
@ -957,7 +952,7 @@ impl Renderer {
|
||||
vals: &[T],
|
||||
) -> Result<Instances<T>, RenderError> {
|
||||
let mut instances = Instances::new(&self.device, vals.len());
|
||||
instances.update(&self.device, &self.queue, vals, 0);
|
||||
instances.update(&self.queue, vals, 0);
|
||||
Ok(instances)
|
||||
}
|
||||
|
||||
@ -1015,7 +1010,7 @@ impl Renderer {
|
||||
|
||||
/// Update a dynamic model with a mesh and a offset.
|
||||
pub fn update_model<V: Vertex>(&self, model: &DynamicModel<V>, mesh: &Mesh<V>, offset: usize) {
|
||||
model.update(&self.device, &self.queue, mesh, offset)
|
||||
model.update(&self.queue, mesh, offset)
|
||||
}
|
||||
|
||||
/// Return the maximum supported texture size.
|
||||
@ -1055,7 +1050,6 @@ impl Renderer {
|
||||
);
|
||||
|
||||
tex.update(
|
||||
&self.device,
|
||||
&self.queue,
|
||||
[0; 2],
|
||||
[texture_info.size.width, texture_info.size.height],
|
||||
@ -1073,7 +1067,7 @@ impl Renderer {
|
||||
sampler_info: &wgpu::SamplerDescriptor,
|
||||
) -> Texture {
|
||||
let texture = Texture::new_raw(&self.device, texture_info, view_info, sampler_info);
|
||||
texture.clear(&self.device, &self.queue); // Needs to be fully initialized for partial writes to work on Dx12 AMD
|
||||
texture.clear(&self.queue); // Needs to be fully initialized for partial writes to work on Dx12 AMD
|
||||
texture
|
||||
}
|
||||
|
||||
@ -1114,13 +1108,7 @@ impl Renderer {
|
||||
// TODO: generic over pixel type
|
||||
data: &[[u8; 4]],
|
||||
) {
|
||||
texture.update(
|
||||
&self.device,
|
||||
&self.queue,
|
||||
offset,
|
||||
size,
|
||||
bytemuck::cast_slice(data),
|
||||
)
|
||||
texture.update(&self.queue, offset, size, bytemuck::cast_slice(data))
|
||||
}
|
||||
|
||||
/// Queue to obtain a screenshot on the next frame render
|
||||
@ -1144,7 +1132,7 @@ impl Renderer {
|
||||
std::path::Path::new(&file_name),
|
||||
&self.profile_times,
|
||||
) {
|
||||
error!("Failed to save GPU timing snapshot");
|
||||
error!(?err, "Failed to save GPU timing snapshot");
|
||||
} else {
|
||||
info!("Saved GPU timing snapshot as: {}", file_name);
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
use super::{
|
||||
super::{
|
||||
buffer::Buffer,
|
||||
consts::Consts,
|
||||
instances::Instances,
|
||||
model::{DynamicModel, Model, SubModel},
|
||||
pipelines::{
|
||||
blit, clouds, figure, fluid, lod_terrain, particle, postprocess, shadow, skybox,
|
||||
sprite, terrain, ui, ColLights, GlobalsBindGroup, Light, Shadow,
|
||||
blit, clouds, figure, fluid, lod_terrain, particle, shadow, skybox, sprite, terrain,
|
||||
ui, ColLights, GlobalsBindGroup,
|
||||
},
|
||||
},
|
||||
Renderer, ShadowMap, ShadowMapRenderer,
|
||||
@ -111,7 +110,7 @@ impl<'frame> Drawer<'frame> {
|
||||
quad_index_buffer_u32: &renderer.quad_index_buffer_u32,
|
||||
};
|
||||
|
||||
let mut encoder =
|
||||
let encoder =
|
||||
ManualOwningScope::start("frame", &mut renderer.profiler, encoder, borrow.device);
|
||||
|
||||
Self {
|
||||
@ -632,18 +631,15 @@ impl<'pass_ref, 'pass: 'pass_ref> TerrainDrawer<'pass_ref, 'pass> {
|
||||
col_lights: &'data Arc<ColLights<terrain::Locals>>,
|
||||
locals: &'data terrain::BoundLocals,
|
||||
) {
|
||||
let col_lights = if let Some(col_lights) = self
|
||||
.col_lights
|
||||
if self.col_lights
|
||||
// Check if we are still using the same atlas texture as the previous drawn
|
||||
// chunk
|
||||
.filter(|current_col_lights| Arc::ptr_eq(current_col_lights, col_lights))
|
||||
.is_none()
|
||||
{
|
||||
col_lights
|
||||
} else {
|
||||
self.render_pass
|
||||
.set_bind_group(3, &col_lights.bind_group, &[]); // TODO: put this in slot 2
|
||||
self.col_lights = Some(col_lights);
|
||||
col_lights
|
||||
};
|
||||
|
||||
self.render_pass.set_bind_group(2, &locals.bind_group, &[]); // TODO: put this in slot 3
|
||||
|
@ -204,7 +204,12 @@ impl ShaderModules {
|
||||
"lod.glsl" => lod.0.to_owned(),
|
||||
"anti-aliasing.glsl" => anti_alias.0.to_owned(),
|
||||
"cloud.glsl" => cloud.0.to_owned(),
|
||||
other => return Err(format!("Include {} is not defined", other)),
|
||||
other => {
|
||||
return Err(format!(
|
||||
"Include {} in {} is not defined",
|
||||
other, shader_name
|
||||
));
|
||||
},
|
||||
},
|
||||
})
|
||||
});
|
||||
@ -787,9 +792,10 @@ struct Task<'a> {
|
||||
}
|
||||
|
||||
/// Represents in-progress task, drop when complete
|
||||
// NOTE: fields are unused because they are only used for their Drop impls
|
||||
struct StartedTask<'a> {
|
||||
_span: common_base::ProfSpan,
|
||||
task: Task<'a>,
|
||||
_task: Task<'a>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
@ -817,13 +823,14 @@ impl Progress {
|
||||
impl<'a> Task<'a> {
|
||||
/// Start a task.
|
||||
/// The name is used for profiling.
|
||||
fn start(self, name: &str) -> StartedTask<'a> {
|
||||
fn start(self, _name: &str) -> StartedTask<'a> {
|
||||
// _name only used when tracy feature is activated
|
||||
StartedTask {
|
||||
_span: {
|
||||
prof_span!(guard, name);
|
||||
prof_span!(guard, _name);
|
||||
guard
|
||||
},
|
||||
task: self,
|
||||
_task: self,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,9 +59,6 @@ impl Texture {
|
||||
usage: wgpu::TextureUsage::SAMPLED | wgpu::TextureUsage::COPY_DST,
|
||||
});
|
||||
|
||||
let command_encoder =
|
||||
device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
|
||||
|
||||
queue.write_texture(
|
||||
wgpu::ImageCopyTexture {
|
||||
texture: &tex,
|
||||
@ -158,7 +155,7 @@ impl Texture {
|
||||
};
|
||||
|
||||
let texture = Self::new_raw(device, &tex_info, &view_info, &sampler_info);
|
||||
texture.clear(device, queue); // Needs to be fully initialized for partial writes to work on Dx12 AMD
|
||||
texture.clear(queue); // Needs to be fully initialized for partial writes to work on Dx12 AMD
|
||||
texture
|
||||
}
|
||||
|
||||
@ -183,7 +180,7 @@ impl Texture {
|
||||
}
|
||||
|
||||
/// Clears the texture data to 0
|
||||
pub fn clear(&self, device: &wgpu::Device, queue: &wgpu::Queue) {
|
||||
pub fn clear(&self, queue: &wgpu::Queue) {
|
||||
let size = self.size;
|
||||
let byte_len = size.width as usize
|
||||
* size.height as usize
|
||||
@ -191,19 +188,12 @@ impl Texture {
|
||||
* self.format.describe().block_size as usize;
|
||||
let zeros = vec![0; byte_len];
|
||||
|
||||
self.update(device, queue, [0, 0], [size.width, size.height], &zeros);
|
||||
self.update(queue, [0, 0], [size.width, size.height], &zeros);
|
||||
}
|
||||
|
||||
/// Update a texture with the given data (used for updating the glyph cache
|
||||
/// texture).
|
||||
pub fn update(
|
||||
&self,
|
||||
device: &wgpu::Device,
|
||||
queue: &wgpu::Queue,
|
||||
offset: [u32; 2],
|
||||
size: [u32; 2],
|
||||
data: &[u8],
|
||||
) {
|
||||
pub fn update(&self, queue: &wgpu::Queue, offset: [u32; 2], size: [u32; 2], data: &[u8]) {
|
||||
let bytes_per_pixel = self.format.describe().block_size as u32;
|
||||
|
||||
debug_assert_eq!(
|
||||
|
@ -9,8 +9,7 @@ use crate::{
|
||||
render::{
|
||||
pipelines::{self, ColLights},
|
||||
ColLightInfo, FigureBoneData, FigureDrawer, FigureLocals, FigureModel, FigureShadowDrawer,
|
||||
FirstPassDrawer, GlobalModel, LodData, Mesh, RenderError, Renderer, SubModel,
|
||||
TerrainVertex,
|
||||
Mesh, RenderError, Renderer, SubModel, TerrainVertex,
|
||||
},
|
||||
scene::{
|
||||
camera::{Camera, CameraMode, Dependents},
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
render::{
|
||||
pipelines::lod_terrain::{LodData, Vertex},
|
||||
FirstPassDrawer, GlobalModel, LodTerrainVertex, Mesh, Model, Quad, Renderer,
|
||||
FirstPassDrawer, LodTerrainVertex, Mesh, Model, Quad, Renderer,
|
||||
},
|
||||
settings::Settings,
|
||||
};
|
||||
|
@ -16,9 +16,9 @@ pub use self::{
|
||||
use crate::{
|
||||
audio::{ambient::AmbientMgr, music::MusicMgr, sfx::SfxMgr, AudioFrontend},
|
||||
render::{
|
||||
create_skybox_mesh, CloudsLocals, Consts, Drawer, FirstPassDrawer, GlobalModel, Globals,
|
||||
GlobalsBindGroup, Light, Model, PointLightMatrix, PostProcessLocals, Renderer, Shadow,
|
||||
ShadowLocals, SkyboxVertex,
|
||||
create_skybox_mesh, CloudsLocals, Consts, Drawer, GlobalModel, Globals, GlobalsBindGroup,
|
||||
Light, Model, PointLightMatrix, PostProcessLocals, Renderer, Shadow, ShadowLocals,
|
||||
SkyboxVertex,
|
||||
},
|
||||
settings::Settings,
|
||||
window::{AnalogGameInput, Event},
|
||||
@ -1000,7 +1000,7 @@ impl Scene {
|
||||
shadow_mats.extend(lights.iter().flat_map(|light| {
|
||||
// Now, construct the full projection matrix by making the light look at each
|
||||
// cube face.
|
||||
let mut eye = Vec3::new(light.pos[0], light.pos[1], light.pos[2]) - focus_off;
|
||||
let eye = Vec3::new(light.pos[0], light.pos[1], light.pos[2]) - focus_off;
|
||||
orientations.iter().map(move |&(forward, up)| {
|
||||
// NOTE: We don't currently try to linearize point lights or need a separate
|
||||
// transform for them.
|
||||
|
@ -2,8 +2,8 @@ use super::{terrain::BlocksOfInterest, SceneData, Terrain};
|
||||
use crate::{
|
||||
mesh::{greedy::GreedyMesh, segment::generate_mesh_base_vol_particle},
|
||||
render::{
|
||||
pipelines::particle::ParticleMode, GlobalModel, Instances, Light, LodData, Model,
|
||||
ParticleDrawer, ParticleInstance, ParticleVertex, Renderer,
|
||||
pipelines::particle::ParticleMode, Instances, Light, Model, ParticleDrawer,
|
||||
ParticleInstance, ParticleVertex, Renderer,
|
||||
},
|
||||
};
|
||||
use common::{
|
||||
|
@ -11,10 +11,9 @@ use crate::{
|
||||
render::{
|
||||
create_sprite_verts_buffer,
|
||||
pipelines::{self, ColLights},
|
||||
Buffer, ColLightInfo, Consts, Drawer, FirstPassDrawer, FluidVertex, FluidWaves,
|
||||
GlobalModel, Instances, LodData, Mesh, Model, RenderError, Renderer,
|
||||
SpriteGlobalsBindGroup, SpriteInstance, SpriteVertex, TerrainLocals, TerrainShadowDrawer,
|
||||
TerrainVertex, Texture, SPRITE_VERT_PAGE_SIZE,
|
||||
Buffer, ColLightInfo, FirstPassDrawer, FluidVertex, FluidWaves, GlobalModel, Instances,
|
||||
LodData, Mesh, Model, RenderError, Renderer, SpriteGlobalsBindGroup, SpriteInstance,
|
||||
SpriteVertex, TerrainLocals, TerrainShadowDrawer, TerrainVertex, SPRITE_VERT_PAGE_SIZE,
|
||||
},
|
||||
};
|
||||
|
||||
@ -261,7 +260,7 @@ fn mesh_worker<V: BaseVol<Vox = Block> + RectRasterableVol + ReadVol + Debug + '
|
||||
.scaled_3d(SPRITE_SCALE)
|
||||
.rotated_z(f32::consts::PI * 0.25 * ori as f32)
|
||||
.translated_3d(
|
||||
(rel_pos.map(|e| e as f32) + Vec3::new(0.5, 0.5, 0.0))
|
||||
rel_pos.map(|e| e as f32) + Vec3::new(0.5, 0.5, 0.0)
|
||||
);
|
||||
// Add an instance for each page in the sprite model
|
||||
for page in sprite_data.vert_pages.clone() {
|
||||
@ -296,12 +295,6 @@ fn mesh_worker<V: BaseVol<Vox = Block> + RectRasterableVol + ReadVol + Debug + '
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: may be unecessary
|
||||
struct ChunkSpriteData {
|
||||
// Instances
|
||||
model: Instances<SpriteInstance>,
|
||||
}
|
||||
|
||||
struct SpriteData {
|
||||
// Sprite vert page ranges that need to be drawn
|
||||
vert_pages: core::ops::Range<u32>,
|
||||
@ -413,7 +406,7 @@ impl SpriteRenderContext {
|
||||
let sprite_data: HashMap<(SpriteKind, usize), _> = SpriteKind::into_enum_iter()
|
||||
.filter_map(|kind| Some((kind, kind.elim_case_pure(&sprite_config_.0).as_ref()?)))
|
||||
.flat_map(|(kind, sprite_config)| {
|
||||
let wind_sway = sprite_config.wind_sway;
|
||||
// let wind_sway = sprite_config.wind_sway;
|
||||
sprite_config.variations.iter().enumerate().map(
|
||||
move |(
|
||||
variation,
|
||||
@ -512,7 +505,7 @@ impl SpriteRenderContext {
|
||||
},
|
||||
)
|
||||
})
|
||||
.map(|mut f| f(&mut greedy, &mut sprite_mesh))
|
||||
.map(|f| f(&mut greedy, &mut sprite_mesh))
|
||||
.collect();
|
||||
|
||||
let sprite_col_lights = greedy.finalize();
|
||||
|
@ -494,7 +494,7 @@ fn upload_image(renderer: &mut Renderer, aabr: Aabr<u16>, tex: &Texture, image:
|
||||
fn create_image(
|
||||
renderer: &mut Renderer,
|
||||
image: RgbaImage,
|
||||
border_color: Rgba<f32>,
|
||||
_border_color: Rgba<f32>, // See TODO below
|
||||
) -> (Texture, UiTextureBindGroup) {
|
||||
let tex = renderer
|
||||
.create_texture(
|
||||
|
@ -15,8 +15,8 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
render::{
|
||||
create_ui_quad, create_ui_quad_vert_gradient, Consts, DynamicModel, Mesh, Renderer,
|
||||
UiBoundLocals, UiDrawer, UiLocals, UiMode, UiVertex,
|
||||
create_ui_quad, create_ui_quad_vert_gradient, DynamicModel, Mesh, Renderer, UiBoundLocals,
|
||||
UiDrawer, UiLocals, UiMode, UiVertex,
|
||||
},
|
||||
Error,
|
||||
};
|
||||
|
@ -27,8 +27,8 @@ pub use widgets::{
|
||||
|
||||
use crate::{
|
||||
render::{
|
||||
create_ui_quad, create_ui_tri, Consts, DynamicModel, Globals, Mesh, RenderError, Renderer,
|
||||
UiBoundLocals, UiDrawer, UiLocals, UiMode, UiVertex,
|
||||
create_ui_quad, create_ui_tri, DynamicModel, Mesh, RenderError, Renderer, UiBoundLocals,
|
||||
UiDrawer, UiLocals, UiMode, UiVertex,
|
||||
},
|
||||
window::Window,
|
||||
Error,
|
||||
|
Loading…
Reference in New Issue
Block a user