Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

TriTexturedGouraud

Struct TriTexturedGouraud 

Source
#[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: u32

OT linkage.

§tex_window: u32

GP0(E2) texture-window command.

§color0_cmd: u32

0x34000000 | color0 header – v0’s RGB is packed into the same word as the polygon opcode.

§v0: u32

Vertex 0 position.

§uv0_clut: u32

(u0, v0, clut) packed.

§color1: u32

Vertex 1 colour (RGB in low 24 bits; top byte ignored).

§v1: u32

Vertex 1 position.

§uv1_tpage: u32

(u1, v1, tpage) packed.

§color2: u32

Vertex 2 colour.

§v2: u32

Vertex 2 position.

§uv2: u32

(u2, v2, 0) packed.

Implementations§

Source§

impl TriTexturedGouraud

Source

pub const WORDS: u8 = 10

Data-word count.

Source

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.

Source

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.

Source

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.

Source

pub 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

The same packet as Self::with_material, which it forwards to.

Source

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.

Source

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.

Source

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.

Source

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

👎Deprecated:

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> TriTexturedGouraud

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TriTexturedGouraud

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl GpuPacket for TriTexturedGouraud

Source§

const WORDS: u8 = TriTexturedGouraud::WORDS

Payload words after the tag.
Source§

impl Hash for TriTexturedGouraud

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given [Hasher]. Read more
1.3.0§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given [Hasher]. Read more
Source§

impl PartialEq for TriTexturedGouraud

Source§

fn eq(&self, other: &TriTexturedGouraud) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for TriTexturedGouraud

Source§

impl Eq for TriTexturedGouraud

Source§

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 T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.