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>
impl<'a> World<'a>
Sourcepub fn from_bytes(bytes: &'a [u8]) -> Result<Self, ParseError>
pub fn from_bytes(bytes: &'a [u8]) -> Result<Self, ParseError>
Parse a cooked .psxw blob.
Sourcepub fn sector_size(&self) -> i32
pub fn sector_size(&self) -> i32
Engine units per sector.
Sourcepub fn material_count(&self) -> u16
pub fn material_count(&self) -> u16
Number of material slots referenced by the world.
Sourcepub fn wall_count(&self) -> u16
pub fn wall_count(&self) -> u16
Number of wall records in the world.
Sourcepub fn horizontal_override_count(&self) -> u16
pub fn horizontal_override_count(&self) -> u16
Number of horizontal override records in the world.
Sourcepub fn surface_light_count(&self) -> u16
pub fn surface_light_count(&self) -> u16
Number of appended static surface-light records.
Sourcepub fn ambient_color(&self) -> [u8; 3]
pub fn ambient_color(&self) -> [u8; 3]
Ambient RGB color.
Sourcepub fn is_fog_enabled(&self) -> bool
pub fn is_fog_enabled(&self) -> bool
Whether fog/depth cue is enabled for this world.
Sourcepub fn has_static_vertex_lighting(&self) -> bool
pub fn has_static_vertex_lighting(&self) -> bool
Whether face records carry baked static vertex lighting.
Sourcepub fn sector(&self, x: u16, z: u16) -> Option<WorldSector>
pub fn sector(&self, x: u16, z: u16) -> Option<WorldSector>
Sector at a coordinate, returning None for empty cells or out of range.
Sourcepub fn sector_without_horizontal_overrides(
&self,
x: u16,
z: u16,
) -> Option<WorldSector>
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.
Sourcepub fn sector_collision_probe(
&self,
x: u16,
z: u16,
) -> Option<WorldSectorCollisionProbe>
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.
Sourcepub fn sector_floor_collision(
&self,
x: u16,
z: u16,
local_x: i32,
local_z: i32,
sector_size: i32,
) -> Option<WorldSectorFloorCollision>
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.
Sourcepub fn sector_record(&self, index: usize) -> Option<WorldSector>
pub fn sector_record(&self, index: usize) -> Option<WorldSector>
Sector record by flat [x * depth + z] index, including empty cells.
Sourcepub fn sector_wall(
&self,
sector: WorldSector,
local_index: u16,
) -> Option<WorldWall>
pub fn sector_wall( &self, sector: WorldSector, local_index: u16, ) -> Option<WorldWall>
Wall record by sector-local wall index.
Sourcepub fn surface_light(&self, index: u16) -> Option<WorldSurfaceLight>
pub fn surface_light(&self, index: u16) -> Option<WorldSurfaceLight>
Static surface-light record by direct table index.
Trait Implementations§
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 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)