Skip to content

Commit

Permalink
mesh: Remove Texel type alias.
Browse files Browse the repository at this point in the history
This specific data type is no longer part of the API; implementors of
`texture::Tile` get to pick their own format.
  • Loading branch information
kpreid committed Nov 4, 2023
1 parent ecc26d4 commit ef36617
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
it is up to the texture implementation to convert and shuffle data as needed.
- Renamed `TextureAllocator` to `texture::Allocator`.
- Renamed `TextureTile` to `texture::Tile`.
- Renamed `Texel` to `texture::Texel`.
- Renamed `NoTexture` to `texture::NoTexture`.
- Renamed `NoTextures` to `texture::NoTextures`.

Expand All @@ -83,6 +82,7 @@
- `all-is-cubes-mesh` library:
- `TextureCoordinate` type alias no longer exists.
Its only use was when implementing `TextureTile`; simply use `f32` instead.
- `Texel` type alias no longer exists; callers are free to choose their own texel data type.

## 0.6.0 (2023-07-29)

Expand Down
4 changes: 2 additions & 2 deletions all-is-cubes-gpu/src/in_wgpu/block_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ struct TileBacking {
///
/// Property: `self.handle.unwrap().allocation.volume() == self.data.len()`.
handle: Option<AlloctreeHandle>,
/// Texture data (that might not be sent to the GPU yet).
data: Option<Box<[texture::Texel]>>,
/// sRGB texture data (that might not be sent to the GPU yet).
data: Option<Box<[[u8; 4]]>>,
/// Whether the data has changed so that we need to send it to the GPU on next
/// [`AtlasAllocator::flush`].
dirty: bool,
Expand Down
6 changes: 1 addition & 5 deletions all-is-cubes-mesh/src/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ use all_is_cubes::math::GridArray;
/// dependents’ texture coordinates are not required to be f32.
pub(crate) type TextureCoordinate = f32;

/// Color data accepted by [`Allocator`].
/// The components are sRGB `[R, G, B, A]`.
pub type Texel = [u8; 4];

/// Unit-of-measure identifier used with [`euclid`](all_is_cubes::euclid) for “whole texels”.
/// TODO(euclid migration): Better name, and a type alias for the point
#[allow(clippy::exhaustive_enums)]
Expand Down Expand Up @@ -179,7 +175,7 @@ pub(super) fn copy_voxels_to_texture<A: Allocator>(
/// Helper function to implement the typical case of copying voxels into an X-major, sRGB, RGBA
/// texture.
#[doc(hidden)]
pub fn copy_voxels_into_xmaj_texture(voxels: Vol<&[Evoxel]>, texture: &mut [Texel]) {
pub fn copy_voxels_into_xmaj_texture(voxels: Vol<&[Evoxel]>, texture: &mut [[u8; 4]]) {
let bounds = voxels.bounds();
assert_eq!(bounds.volume(), texture.len());

Expand Down
2 changes: 1 addition & 1 deletion all-is-cubes-port/src/gltf/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ mod internal {
use std::sync::{Arc, Mutex, OnceLock};

/// Texels are written here through tiles and read through planes.
pub(super) type TexelsCell = Arc<OnceLock<Vec<texture::Texel>>>;
pub(super) type TexelsCell = Arc<OnceLock<Vec<[u8; 4]>>>;

/// Interior-mutable accumulator of textures to put in the atlas.
#[derive(Clone, Debug, Default)]
Expand Down

0 comments on commit ef36617

Please sign in to comment.