Skip to main content

World3D

Struct World3D 

Source
pub struct World3D { /* private fields */ }
Expand description

Complete open-world 3D scene graph with mesh instancing library, chunk streaming, and BVH acceleration.

Implementations§

Source§

impl World3D

Open-world construction, model importing, BVH rebuild, and live vehicle/camera simulation for World3D.

Source

pub fn register_mesh(&mut self, chain: MeshLodChain) -> usize

Registers a MeshLodChain in the instancing library and returns its mesh_id.

§Arguments
  • &Self - Mutable world.
  • MeshLodChain - Multi-level LOD mesh chain.
§Returns
  • usize - Assigned mesh_id.
Source

pub fn spawn_object( &mut self, name: &str, mesh_id: usize, transform: Transform3D, material: PbrMaterial, ray_trace_caster: bool, ) -> usize

Spawns an instanced SceneObject3D referencing mesh_id into its spatial world chunk.

§Arguments
  • &Self - Mutable world.
  • &str - Object name.
  • usize - Registered mesh_id.
  • Transform3D - World transform.
  • PbrMaterial - Surface PBR material.
  • bool - Whether this object participates in BVH ray tracing.
§Returns
  • usize - Index of the spawned SceneObject3D.
Source

pub fn import_model( &mut self, format: ModelFormat, source: &str, transform: Transform3D, fallback_material: PbrMaterial, spin_speed: f32, ) -> Result<ImportedModel3D, String>

Imports an external .obj or .gltf model directly into the live 3D world and returns import telemetry.

§Arguments
  • &Self - Mutable world.
  • ModelFormat - Source model format.
  • &str - Raw .obj or .gltf text content.
  • Transform3D - Placement transform in the 3D scene.
  • PbrMaterial - Fallback PBR material.
  • f32 - Optional continuous Y-spin speed in radians/sec.
§Returns
  • Result<ImportedModel3D, String> - Imported model summary or parse error.
Source

pub fn spawn_with(&mut self, desc: &SpawnObjectDesc) -> usize

Spawns an object from a fluent SpawnObjectDesc.

§Arguments
  • &Self - Mutable world.
  • &SpawnObjectDesc - Spawn descriptor.
§Returns
  • usize - Spawned object index.
Source

pub fn import_with( &mut self, desc: &ImportModelDesc, ) -> Result<ImportedModel3D, String>

Imports an external .obj or .gltf model using a fluent ImportModelDesc.

§Arguments
  • &Self - Mutable world.
  • &ImportModelDesc - Import descriptor.
§Returns
  • Result<ImportedModel3D, String> - Imported model telemetry or parse error.
Source

pub fn active_camera_mode(&self) -> CameraMode3D

Returns the typed CameraMode3D currently active in this world.

§Arguments
  • &Self - World reference.
§Returns
  • CameraMode3D - Active typed camera controller mode.
Source

pub fn set_camera_mode_enum(&mut self, mode: CameraMode3D)

Sets the active 3D camera controller using a typed CameraMode3D.

§Arguments
  • &Self - Mutable world.
  • CameraMode3D - Desired camera controller mode.
Source

pub fn ensure_bvh(&mut self)

Rebuilds the world-space BVH acceleration structure when geometry or transforms are dirty.

§Arguments
  • &Self - Mutable world.
Source

pub fn vehicle_index(&self) -> Option<usize>

Returns the optional player vehicle index.

§Arguments
  • &Self - World reference.
§Returns
  • Option<usize> - Vehicle index in objects.
Source

pub fn create_open_world_city() -> Self

Builds a GTA-inspired open-world neon downtown city with reflective wet asphalt, glass towers, and a drivable sports car.

§Returns
  • Self - Populated open-world 3D city ready for real-time PBR + Ray Tracing.
Source

pub fn cycle_camera_mode(&mut self) -> u8

Cycles the active 3D camera perspective (Chase -> Hood -> Orbit -> Aerial) safely without clipping.

§Arguments
  • &Self - Mutable world.
§Returns
  • u8 - New active camera mode index.
Source

pub fn step_simulation( &mut self, dt: f32, input: &InputState, actions: &ActionMap, )

Advances drivable vehicle/camera controls, AABB collision resolution, and spinning models by dt seconds.

§Arguments
  • &Self - Mutable world.
  • f32 - Delta time in seconds.
  • &InputState - Real-time polled keyboard/pointer input.
  • &ActionMap - Action bindings for WASD/Arrows movement.
Source§

impl World3D

Source

pub fn get_mesh_library(&self) -> &Vec<MeshLodChain>

Source

pub fn get_mut_mesh_library(&mut self) -> &mut Vec<MeshLodChain>

Source

pub fn set_mesh_library(&mut self, val: Vec<MeshLodChain>) -> &mut Self

Source

pub fn get_objects(&self) -> &Vec<SceneObject3D>

Source

pub fn get_mut_objects(&mut self) -> &mut Vec<SceneObject3D>

Source

pub fn set_objects(&mut self, val: Vec<SceneObject3D>) -> &mut Self

Source

pub fn get_camera(&self) -> Camera3D

Source

pub fn get_mut_camera(&mut self) -> &mut Camera3D

Source

pub fn set_camera(&mut self, val: Camera3D) -> &mut Self

Source

pub fn get_sun(&self) -> DirectionalLight3D

Source

pub fn get_mut_sun(&mut self) -> &mut DirectionalLight3D

Source

pub fn set_sun(&mut self, val: DirectionalLight3D) -> &mut Self

Source

pub fn get_bvh(&self) -> &Bvh3D

Source

pub fn get_mut_bvh(&mut self) -> &mut Bvh3D

Source

pub fn set_bvh(&mut self, val: Bvh3D) -> &mut Self

Source

pub fn get_bvh_dirty(&self) -> bool

Source

pub fn get_mut_bvh_dirty(&mut self) -> &mut bool

Source

pub fn set_bvh_dirty(&mut self, val: bool) -> &mut Self

Source

pub fn get_chunk_size(&self) -> f32

Source

pub fn get_mut_chunk_size(&mut self) -> &mut f32

Source

pub fn set_chunk_size(&mut self, val: f32) -> &mut Self

Source

pub fn get_mut_player_vehicle_index(&mut self) -> &mut Option<usize>

Source

pub fn set_player_vehicle_index(&mut self, val: Option<usize>) -> &mut Self

Source

pub fn get_imported_model_count(&self) -> usize

Source

pub fn get_mut_imported_model_count(&mut self) -> &mut usize

Source

pub fn set_imported_model_count(&mut self, val: usize) -> &mut Self

Source

pub fn get_camera_mode(&self) -> u8

Source

pub fn get_mut_camera_mode(&mut self) -> &mut u8

Source

pub fn set_camera_mode(&mut self, val: u8) -> &mut Self

Source

pub fn get_camera_orbit_rad(&self) -> f32

Source

pub fn get_mut_camera_orbit_rad(&mut self) -> &mut f32

Source

pub fn set_camera_orbit_rad(&mut self, val: f32) -> &mut Self

Trait Implementations§

Source§

impl Clone for World3D

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for World3D

Source§

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

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

impl Default for World3D

Default empty 3D open world.

Source§

fn default() -> Self

Creates an empty World3D with 64m chunk streaming enabled.

§Returns
  • Self - Empty World3D.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.