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

QuadTexturedGouraud

Struct QuadTexturedGouraud 

Source
#[repr(C, align(4))]
pub struct QuadTexturedGouraud {
Show 14 fields 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, pub color3: u32, pub v3: u32, pub uv3: u32,
}
Expand description

Textured Gouraud quad with inline texture-window state. Mirrors TriTexturedGouraud extended to four vertices: GP0(E2) texture-window state immediately followed by the GP0(3Ch) Gouraud-textured-quad command. Per-vertex RGB modulates the sampled texel exactly like the triangle. 14 words (tag + 13 data).

The PS1 GPU rasterizes this quad as the two triangles (v0,v1,v2) and (v1,v2,v3) – the 1-2 diagonal. A caller whose engine splits quads on the 0-2 diagonal as tri(a,b,c)+tri(a,c,d) must reorder its perimeter [a,b,c,d] to [b,a,c,d] before building the packet so the hardware split lands on the same edge; that yields pixel-identical output (proved by textured_gouraud_quad_matches_two_triangle_split_bitexact in the emulator GPU tests).

Fields§

§tag: u32

OT linkage.

§tex_window: u32

GP0(E2) texture-window command.

§color0_cmd: u32

0x3C000000 | color0 header – v0’s RGB shares the opcode word.

§v0: u32

Vertex 0 position.

§uv0_clut: u32

(u0, v0, clut) packed.

§color1: u32

Vertex 1 colour.

§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.

§color3: u32

Vertex 3 colour.

§v3: u32

Vertex 3 position.

§uv3: u32

(u3, v3, 0) packed.

Implementations§

Source§

impl QuadTexturedGouraud

Source

pub const WORDS: u8 = 13

Data-word count (tag excluded).

Source

pub const EMPTY: Self

Zeroed packet for static prebuilt-pool initialisation. Real content is written by the first draw of each surface before the packet ever links into an ordering table (per-surface validity bytes guarantee it).

Source

pub const fn with_material( verts: [(i16, i16); 4], uvs: [(u8, u8); 4], colors: [(u8, u8, u8); 4], material: TextureMaterial, ) -> Self

Build a textured Gouraud quad from per-vertex UVs and a TextureMaterial. Vertex order is TL, TR, BL, BR; each colour tints its vertex ((128, 128, 128) leaves texels unmodulated).

Source

pub const fn with_packet_material_packed_uv_words( verts: [(i16, i16); 4], uv_words: [u16; 4], colors: [(u8, u8, u8); 4], material: TexturedGouraudPacketMaterial, ) -> Self

Build a textured Gouraud quad from UV words and a packet material precomputed for a hot material, mirroring TriTexturedGouraud::with_packet_material_packed_uv_words.

Source

pub const fn with_staged_slot_prepacked_colors( verts: [(i16, i16); 4], uv_words: [u16; 4], colors: [u32; 4], 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.

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); 4], uv_words: [u16; 4], colors: [u32; 4], 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); 4])

Rewrite the four vertex words of a prebuilt packet, leaving every material/UV/colour word untouched. This is the per-frame patch for precompiled static world geometry.

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); 4])

Rewrite the four colour words of a prebuilt packet, preserving the opcode byte that shares v0’s colour word.

Trait Implementations§

Source§

impl Clone for QuadTexturedGouraud

Source§

fn clone(&self) -> QuadTexturedGouraud

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 QuadTexturedGouraud

Source§

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

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

impl GpuPacket for QuadTexturedGouraud

Source§

const WORDS: u8 = QuadTexturedGouraud::WORDS

Payload words after the tag.
Source§

impl Hash for QuadTexturedGouraud

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 QuadTexturedGouraud

Source§

fn eq(&self, other: &QuadTexturedGouraud) -> 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 QuadTexturedGouraud

Source§

impl Eq for QuadTexturedGouraud

Source§

impl StructuralPartialEq for QuadTexturedGouraud

Auto Trait Implementations§

§

impl Freeze for QuadTexturedGouraud

§

impl RefUnwindSafe for QuadTexturedGouraud

§

impl Send for QuadTexturedGouraud

§

impl Sync for QuadTexturedGouraud

§

impl Unpin for QuadTexturedGouraud

§

impl UnsafeUnpin for QuadTexturedGouraud

§

impl UnwindSafe for QuadTexturedGouraud

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.