Skip to content

Conversation

@hornc
Copy link
Contributor

@hornc hornc commented Nov 22, 2025

No description provided.


/// Texture Blend mode.
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum Blend {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how you eventually plan to use this, but my guess is that it would be useful to make this repr(u8) or something and explicitly define the first discriminant like this

#[repr(u8)]
pub enum Blend {
  Mix = 0,
  Add,
  Sub,
  Inc,
}

That way you can do conversions to the repr type more easily like this

let x = Blend::Add;
let y: u8 = x as u8;

/// bits `0` to `3`: texture page X base
/// bit `4`: texture page Y base
/// bits `5` to `6`: semi-transparency (0=B/2+F/2, 1=B+F, 2=B-F, 3=B+F/4)
/// bits `7` to `8`: Bpp
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is bit 8 in the texpage field or _pad? At a glance it looks like a typo to me.

@ayrtonm
Copy link
Owner

ayrtonm commented Nov 30, 2025

I remember when I added TexPage as a PackedVertex alias that it wasn't going to allow easily extending it to the other bitfields, so I'm on board with the approach in this change.

/// bit `4`: texture page Y base
pub type TexPage = PackedVertex<2, 4, 1>;
#[repr(C)]
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Would derive(Default) be useful? (and a valid value?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants