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

World

Struct World 

Source
pub struct World<'a> { /* private fields */ }
Expand description

A parsed .psxw grid-world backed by slices into the cooked blob.

This is the binary runtime format; engine code wraps it as psx_engine::RuntimeRoom. It keeps parsing zero-copy and lets engine code pull sectors and walls by value as needed.

Implementations§

Source§

impl<'a> World<'a>

Source

pub fn from_bytes(bytes: &'a [u8]) -> Result<Self, ParseError>

Parse a cooked .psxw blob.

Source

pub fn width(&self) -> u16

Width in grid sectors.

Source

pub fn depth(&self) -> u16

Depth in grid sectors.

Source

pub fn sector_size(&self) -> i32

Engine units per sector.

Source

pub fn material_count(&self) -> u16

Number of material slots referenced by the world.

Source

pub fn wall_count(&self) -> u16

Number of wall records in the world.

Source

pub fn horizontal_override_count(&self) -> u16

Number of horizontal override records in the world.

Source

pub fn surface_light_count(&self) -> u16

Number of appended static surface-light records.

Source

pub fn ambient_color(&self) -> [u8; 3]

Ambient RGB color.

Source

pub fn is_fog_enabled(&self) -> bool

Whether fog/depth cue is enabled for this world.

Source

pub fn has_static_vertex_lighting(&self) -> bool

Whether face records carry baked static vertex lighting.

Source

pub fn sector(&self, x: u16, z: u16) -> Option<WorldSector>

Sector at a coordinate, returning None for empty cells or out of range.

Source

pub fn sector_without_horizontal_overrides( &self, x: u16, z: u16, ) -> Option<WorldSector>

Sector at a coordinate without applying horizontal override side-table records. Collision and wall-only queries use this to avoid scanning render-only per-triangle override data.

Source

pub fn sector_collision_probe( &self, x: u16, z: u16, ) -> Option<WorldSectorCollisionProbe>

Minimal collision-probe sector header at a coordinate. This skips horizontal override decoding and only exposes floor presence plus the wall range.

Source

pub fn sector_floor_collision( &self, x: u16, z: u16, local_x: i32, local_z: i32, sector_size: i32, ) -> Option<WorldSectorFloorCollision>

Decode only the selected floor triangle needed by a collision query.

Unlike Self::sector, this does not materialize render materials, UVs, ceiling data, or the unselected triangle.

Source

pub fn sector_record(&self, index: usize) -> Option<WorldSector>

Sector record by flat [x * depth + z] index, including empty cells.

Source

pub fn wall(&self, index: u16) -> Option<WorldWall>

Wall record by global wall index.

Source

pub fn sector_wall( &self, sector: WorldSector, local_index: u16, ) -> Option<WorldWall>

Wall record by sector-local wall index.

Source

pub fn surface_light(&self, index: u16) -> Option<WorldSurfaceLight>

Static surface-light record by direct table index.

Trait Implementations§

Source§

impl<'a> Clone for World<'a>

Source§

fn clone(&self) -> World<'a>

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<'a> Debug for World<'a>

Source§

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

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

impl<'a> Copy for World<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for World<'a>

§

impl<'a> RefUnwindSafe for World<'a>

§

impl<'a> Send for World<'a>

§

impl<'a> Sync for World<'a>

§

impl<'a> Unpin for World<'a>

§

impl<'a> UnsafeUnpin for World<'a>

§

impl<'a> UnwindSafe for World<'a>

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.