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.
impl World3D
Open-world construction, model importing, BVH rebuild, and live vehicle/camera simulation for World3D.
Sourcepub fn register_mesh(&mut self, chain: MeshLodChain) -> usize
pub fn register_mesh(&mut self, chain: MeshLodChain) -> usize
Sourcepub fn spawn_object(
&mut self,
name: &str,
mesh_id: usize,
transform: Transform3D,
material: PbrMaterial,
ray_trace_caster: bool,
) -> usize
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- Registeredmesh_id.Transform3D- World transform.PbrMaterial- Surface PBR material.bool- Whether this object participates in BVH ray tracing.
§Returns
usize- Index of the spawnedSceneObject3D.
Sourcepub fn import_model(
&mut self,
format: ModelFormat,
source: &str,
transform: Transform3D,
fallback_material: PbrMaterial,
spin_speed: f32,
) -> Result<ImportedModel3D, String>
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.objor.gltftext 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.
Sourcepub fn spawn_with(&mut self, desc: &SpawnObjectDesc) -> usize
pub fn spawn_with(&mut self, desc: &SpawnObjectDesc) -> usize
Sourcepub fn import_with(
&mut self,
desc: &ImportModelDesc,
) -> Result<ImportedModel3D, String>
pub fn import_with( &mut self, desc: &ImportModelDesc, ) -> Result<ImportedModel3D, String>
Sourcepub fn active_camera_mode(&self) -> CameraMode3D
pub fn active_camera_mode(&self) -> CameraMode3D
Sourcepub fn set_camera_mode_enum(&mut self, mode: CameraMode3D)
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.
Sourcepub fn ensure_bvh(&mut self)
pub fn ensure_bvh(&mut self)
Rebuilds the world-space BVH acceleration structure when geometry or transforms are dirty.
§Arguments
&Self- Mutable world.
Sourcepub fn vehicle_index(&self) -> Option<usize>
pub fn vehicle_index(&self) -> Option<usize>
Sourcepub fn create_open_world_city() -> Self
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.
Sourcepub fn cycle_camera_mode(&mut self) -> u8
pub fn cycle_camera_mode(&mut self) -> u8
Sourcepub fn step_simulation(
&mut self,
dt: f32,
input: &InputState,
actions: &ActionMap,
)
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.