diff --git a/assets/voxygen/shaders/sprite-vert.glsl b/assets/voxygen/shaders/sprite-vert.glsl index e0fdbd4ca7..5c250d0ad9 100644 --- a/assets/voxygen/shaders/sprite-vert.glsl +++ b/assets/voxygen/shaders/sprite-vert.glsl @@ -76,7 +76,7 @@ void main() { uint v_atlas_pos = pos_atlas_pos_norm_ao.y; // Expand the model vertex position bits into float values - vec3 v_pos = vec3(ivec3((uvec3(v_pos_norm) >> uvec3(0, 8, 16)) & uvec3(0xFu, 0xFu, 0x0FFFu)) - ivec3(0, 0, VERT_EXTRA_NEG_Z)); + vec3 v_pos = vec3(ivec3((uvec3(v_pos_norm) >> uvec3(0, 8, 16)) & uvec3(0xFFu, 0xFFu, 0x0FFFu)) - ivec3(0, 0, VERT_EXTRA_NEG_Z)); // Transform into chunk space and scale f_pos = (inst_mat * vec4(v_pos, 1.0)).xyz; diff --git a/voxygen/src/render/pipelines/sprite.rs b/voxygen/src/render/pipelines/sprite.rs index 2b95159a5f..15682e3cae 100644 --- a/voxygen/src/render/pipelines/sprite.rs +++ b/voxygen/src/render/pipelines/sprite.rs @@ -269,7 +269,7 @@ impl SpriteLayout { visibility: wgpu::ShaderStage::VERTEX, ty: wgpu::BindingType::Texture { sample_type: wgpu::TextureSampleType::Uint, - view_dimension: wgpu::TextureViewDimension::D1, + view_dimension: wgpu::TextureViewDimension::D2, multisampled: false, }, count: None, diff --git a/voxygen/src/scene/terrain.rs b/voxygen/src/scene/terrain.rs index b9636ccfad..10adc6cae5 100644 --- a/voxygen/src/scene/terrain.rs +++ b/voxygen/src/scene/terrain.rs @@ -247,23 +247,21 @@ fn mesh_worker + RectRasterableVol + ReadVol + Debug + ' let key = (sprite, variation); // NOTE: Safe because we called sprite_config_for already. // NOTE: Safe because 0 ≤ ori < 8 - let sprite_data_lod_0 = &sprite_data[&key][0]; - let mat = Mat4::identity() - // NOTE: offset doesn't change with lod level - // TODO: pull out of per lod level info or remove lod levels - // for sprites entirely - .translated_3d(sprite_data_lod_0.offset) - // Lod scaling etc is baked during meshing - .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)) - ); let light = light_map(wpos); let glow = glow_map(wpos); for lod_level in 0..SPRITE_LOD_LEVELS { let sprite_data = &sprite_data[&key][lod_level]; + let mat = Mat4::identity() + // Scaling for different LOD resolutions + .scaled_3d(sprite_data.scale) + // Offset + .translated_3d(sprite_data.offset) + .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)) + ); // Add an instance for each page in the sprite model for page in sprite_data.vert_pages.clone() { // TODO: could be more efficient to create once and clone while