#[repr(C, align(4))]pub struct TriTexturedGouraud {
pub tag: u32,
pub tex_window: u32,
pub color0_cmd: u32,
pub v0: u32,
pub uv0_clut: u32,
pub color1: u32,
pub v1: u32,
pub uv1_tpage: u32,
pub color2: u32,
pub v2: u32,
pub uv2: u32,
}Expand description
Textured Gouraud-shaded triangle. 11 words (tag + 10 data).
Per-vertex tint: the GPU multiplies each texel by the
interpolated vertex colour, so GTE-lit-and-fogged per-vertex
colours drive the final shade smoothly across the triangle.
The first data word is GP0(E2) texture-window state, matching
TriTextured so windowed/tiled world materials do not leak
state across ordering-table interleaving. CLUT rides in v0’s
UV high word, tpage in v1’s UV high word (PSX-SPX convention
for GP0 0x34).
Fields§
§tag: u32OT linkage.
tex_window: u32GP0(E2) texture-window command.
color0_cmd: u320x34000000 | color0 header – v0’s RGB is packed into the
same word as the polygon opcode.
v0: u32Vertex 0 position.
uv0_clut: u32(u0, v0, clut) packed.
color1: u32Vertex 1 colour (RGB in low 24 bits; top byte ignored).
v1: u32Vertex 1 position.
uv1_tpage: u32(u1, v1, tpage) packed.
color2: u32Vertex 2 colour.
v2: u32Vertex 2 position.
uv2: u32(u2, v2, 0) packed.
Implementations§
Source§impl TriTexturedGouraud
impl TriTexturedGouraud
Sourcepub const EMPTY: Self
pub const EMPTY: Self
Zeroed packet for static prebuilt-pool initialisation. Real content is written before the packet is ever linked into an ordering table.
Sourcepub const fn new(
verts: [(i16, i16); 3],
uvs: [(u8, u8); 3],
colors: [(u8, u8, u8); 3],
clut: u16,
tpage: u16,
) -> Self
pub const fn new( verts: [(i16, i16); 3], uvs: [(u8, u8); 3], colors: [(u8, u8, u8); 3], clut: u16, tpage: u16, ) -> Self
Build a textured Gouraud triangle. Each vertex carries its own RGB (the NCDT-lit-and-fogged colour in the typical commercial-game path) which modulates the sampled texel.
Sourcepub const fn with_material(
verts: [(i16, i16); 3],
uvs: [(u8, u8); 3],
colors: [(u8, u8, u8); 3],
material: TextureMaterial,
) -> Self
pub const fn with_material( verts: [(i16, i16); 3], uvs: [(u8, u8); 3], colors: [(u8, u8, u8); 3], material: TextureMaterial, ) -> Self
Build a textured Gouraud triangle using a TextureMaterial.
Sourcepub const fn with_material_packet_texcoords(
verts: [(i16, i16); 3],
uvs: [(u8, u8); 3],
colors: [(u8, u8, u8); 3],
material: TextureMaterial,
) -> Self
👎Deprecated: identical to with_material
pub const fn with_material_packet_texcoords( verts: [(i16, i16); 3], uvs: [(u8, u8); 3], colors: [(u8, u8, u8); 3], material: TextureMaterial, ) -> Self
identical to with_material
The same packet as Self::with_material, which it forwards to.
Sourcepub const fn with_material_packed_uv_words(
verts: [(i16, i16); 3],
uv_words: [u16; 3],
colors: [(u8, u8, u8); 3],
material: TextureMaterial,
) -> Self
pub const fn with_material_packed_uv_words( verts: [(i16, i16); 3], uv_words: [u16; 3], colors: [(u8, u8, u8); 3], material: TextureMaterial, ) -> Self
Build a textured Gouraud triangle from UV words that already
contain the low (u, v) packet bytes.
Sourcepub const fn with_packet_material_packed_uv_words(
verts: [(i16, i16); 3],
uv_words: [u16; 3],
colors: [(u8, u8, u8); 3],
material: TexturedGouraudPacketMaterial,
) -> Self
pub const fn with_packet_material_packed_uv_words( verts: [(i16, i16); 3], uv_words: [u16; 3], colors: [(u8, u8, u8); 3], material: TexturedGouraudPacketMaterial, ) -> Self
Build a textured Gouraud triangle from UV words and material packet words that were precomputed once for a hot material.
Sourcepub const fn with_staged_slot_prepacked_colors(
verts: [(i16, i16); 3],
uv_words: [u16; 3],
colors: [u32; 3],
clut_high_word: u32,
tpage_high_word: u32,
texture_window_word: u32,
ot_slot: u16,
) -> Self
pub const fn with_staged_slot_prepacked_colors( verts: [(i16, i16); 3], uv_words: [u16; 3], colors: [u32; 3], clut_high_word: u32, tpage_high_word: u32, texture_window_word: u32, ot_slot: u16, ) -> Self
Build a self-contained texture-window packet whose tag temporarily
carries ot_slot for a later tagged-stream OT linking pass.
This is the windowed counterpart to
ClassicTriTexturedGouraud::with_staged_slot_prepacked_colors.
It is intended for classic affine renderers whose tiled materials can
interleave in the ordering table, so every polygon restores its own
GP0(E2) state instead of relying on a global draw-mode side effect.
Every color word must have its high byte clear, and clut_high_word
and tpage_high_word must hold only their high halfwords; debug builds
assert both. A word that breaks this changes what the GPU draws, not
memory, so the constructor is safe.
Sourcepub const unsafe fn with_staged_slot_prepacked_unchecked(
verts: [(i16, i16); 3],
uv_words: [u16; 3],
colors: [u32; 3],
clut_high_word: u32,
tpage_high_word: u32,
texture_window_word: u32,
ot_slot: u16,
) -> Self
👎Deprecated: renamed to with_staged_slot_prepacked_colors, which is safe
pub const unsafe fn with_staged_slot_prepacked_unchecked( verts: [(i16, i16); 3], uv_words: [u16; 3], colors: [u32; 3], clut_high_word: u32, tpage_high_word: u32, texture_window_word: u32, ot_slot: u16, ) -> Self
renamed to with_staged_slot_prepacked_colors, which is safe
Renamed to Self::with_staged_slot_prepacked_colors, which is safe.
§Safety
Nothing beyond that function’s preconditions; it stays unsafe so
existing unsafe blocks keep compiling without a warning.
Sourcepub fn set_positions(&mut self, verts: [(i16, i16); 3])
pub fn set_positions(&mut self, verts: [(i16, i16); 3])
Rewrite the three vertex words of a prebuilt packet, leaving material, UV, and colour words untouched.
Sourcepub fn copy_payload_from(&mut self, source: &Self)
pub fn copy_payload_from(&mut self, source: &Self)
Copy every packet word except the OT tag from a prebuilt skeleton. The destination can then patch positions and link into an ordering table without inheriting a stale DMA link.
Sourcepub fn set_colors(&mut self, colors: [(u8, u8, u8); 3])
pub fn set_colors(&mut self, colors: [(u8, u8, u8); 3])
Rewrite the three colour words of a prebuilt packet, preserving the opcode byte that shares v0’s colour word.
Trait Implementations§
Source§impl Clone for TriTexturedGouraud
impl Clone for TriTexturedGouraud
Source§fn clone(&self) -> TriTexturedGouraud
fn clone(&self) -> TriTexturedGouraud
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TriTexturedGouraud
impl Debug for TriTexturedGouraud
Source§impl GpuPacket for TriTexturedGouraud
impl GpuPacket for TriTexturedGouraud
Source§impl Hash for TriTexturedGouraud
impl Hash for TriTexturedGouraud
Source§impl PartialEq for TriTexturedGouraud
impl PartialEq for TriTexturedGouraud
impl Copy for TriTexturedGouraud
impl Eq for TriTexturedGouraud
impl StructuralPartialEq for TriTexturedGouraud
Auto Trait Implementations§
impl Freeze for TriTexturedGouraud
impl RefUnwindSafe for TriTexturedGouraud
impl Send for TriTexturedGouraud
impl Sync for TriTexturedGouraud
impl Unpin for TriTexturedGouraud
impl UnsafeUnpin for TriTexturedGouraud
impl UnwindSafe for TriTexturedGouraud
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)