pub struct TextureMaterial { /* private fields */ }Expand description
Textured primitive material.
clut_word is the packed CLUT handle used by indexed textures.
tpage_word is the packed tpage word normally produced by
TexturePage::uv_word(0). The material rewrites the tpage blend
bits from BlendMode so one base tpage can be reused across
opaque and translucent variants.
Implementations§
Source§impl TextureMaterial
impl TextureMaterial
Sourcepub const fn new(clut_word: u16, tpage_word: u16) -> Self
pub const fn new(clut_word: u16, tpage_word: u16) -> Self
Build an opaque, unmodulated texture material.
Sourcepub const fn opaque(clut_word: u16, tpage_word: u16, tint: (u8, u8, u8)) -> Self
pub const fn opaque(clut_word: u16, tpage_word: u16, tint: (u8, u8, u8)) -> Self
Build an opaque texture material with a flat tint.
Sourcepub const fn blended(
clut_word: u16,
tpage_word: u16,
tint: (u8, u8, u8),
blend_mode: BlendMode,
) -> Self
pub const fn blended( clut_word: u16, tpage_word: u16, tint: (u8, u8, u8), blend_mode: BlendMode, ) -> Self
Build a translucent texture material with a flat tint.
Textured primitives still follow PS1 texel rules: the primitive command enables transparency, and sampled texels with bit 15 set actually blend through the selected mode.
Sourcepub const fn with_blend_mode(self, blend_mode: BlendMode) -> Self
pub const fn with_blend_mode(self, blend_mode: BlendMode) -> Self
Return a copy using blend_mode.
For a textured primitive this only selects the blending equation.
Which texels actually blend is decided per texel by bit 15 of the
palette entry (psx_vram::Color555::with_stp); a CLUT without that bit
draws fully opaque whatever is set here, and nothing reports it. For an
untextured primitive the mode applies to the whole polygon.
Sourcepub const fn with_clut_bank(self, bank: u8) -> Self
pub const fn with_clut_bank(self, bank: u8) -> Self
Return a copy selecting a consecutive 16-entry 4bpp CLUT bank.
Sourcepub const fn with_texture_window(self, texture_window: TextureWindow) -> Self
pub const fn with_texture_window(self, texture_window: TextureWindow) -> Self
Return a copy using texture_window.
Sourcepub const fn with_raw_texture(self, raw_texture: bool) -> Self
pub const fn with_raw_texture(self, raw_texture: bool) -> Self
Return a copy with raw texture modulation enabled or disabled.
Raw-texture mode bypasses RGB tint modulation. It is useful for palettes or direct textures that already carry final colors.
Sourcepub const fn with_dither(self, dither: bool) -> Self
pub const fn with_dither(self, dither: bool) -> Self
Return a copy with draw-mode dithering enabled or disabled.
Sourcepub const fn texture_page_word(self) -> u16
pub const fn texture_page_word(self) -> u16
Packed tpage word for textured polygon UV words.
The material owns the tpage blend and dither bits; all other tpage address/depth bits are preserved from the original word.
Sourcepub const fn texture_window_word(self) -> u32
pub const fn texture_window_word(self) -> u32
GP0(E2) texture-window word for this material.
Sourcepub const fn blend_mode(self) -> BlendMode
pub const fn blend_mode(self) -> BlendMode
Active blend mode.
Sourcepub const fn is_translucent(self) -> bool
pub const fn is_translucent(self) -> bool
True when the primitive command should set its semi-transparent bit.
Sourcepub const fn is_raw_texture(self) -> bool
pub const fn is_raw_texture(self) -> bool
True when the primitive command should set its raw-texture bit.
Sourcepub const fn is_dithered(self) -> bool
pub const fn is_dithered(self) -> bool
True when the material asks GP0(E1) / primitive tpage state for dithering.
Sourcepub const fn textured_polygon_command(self, gouraud: bool, quad: bool) -> u32
pub const fn textured_polygon_command(self, gouraud: bool, quad: bool) -> u32
Textured polygon command bits without the low RGB payload.
Sourcepub const fn textured_gouraud_packet_material(
self,
) -> TexturedGouraudPacketMaterial
pub const fn textured_gouraud_packet_material( self, ) -> TexturedGouraudPacketMaterial
Prepacked words for textured Gouraud triangle packet emission.
Sourcepub const fn textured_packet_material(self) -> TexturedPacketMaterial
pub const fn textured_packet_material(self) -> TexturedPacketMaterial
Prepacked words for flat textured triangle packet emission.
Sourcepub const fn flat_textured_polygon_header(self, quad: bool) -> u32
pub const fn flat_textured_polygon_header(self, quad: bool) -> u32
Textured polygon header with the material’s flat tint.
Sourcepub const fn textured_rect_header(self) -> u32
pub const fn textured_rect_header(self) -> u32
Textured rectangle command with the material’s flat tint.
Sourcepub const fn draw_mode_word(self) -> u32
pub const fn draw_mode_word(self) -> u32
GP0(E1) draw-mode word implied by this material.
Textured rectangles read their tpage from this state. Textured polygons embed the tpage word directly, but applying the same material state before drawing keeps subsequent sprite draws in sync.
Sourcepub fn apply_draw_mode(self)
👎Deprecated: use Gpu::set_draw_mode
pub fn apply_draw_mode(self)
use Gpu::set_draw_mode
Apply this material’s tpage, blend, depth, dither, and texture-window state.
Trait Implementations§
Source§impl Clone for TextureMaterial
impl Clone for TextureMaterial
Source§fn clone(&self) -> TextureMaterial
fn clone(&self) -> TextureMaterial
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TextureMaterial
impl Debug for TextureMaterial
Source§impl PartialEq for TextureMaterial
impl PartialEq for TextureMaterial
impl Copy for TextureMaterial
impl Eq for TextureMaterial
impl StructuralPartialEq for TextureMaterial
Auto Trait Implementations§
impl Freeze for TextureMaterial
impl RefUnwindSafe for TextureMaterial
impl Send for TextureMaterial
impl Sync for TextureMaterial
impl Unpin for TextureMaterial
impl UnsafeUnpin for TextureMaterial
impl UnwindSafe for TextureMaterial
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)