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 bump_world_revision(&mut self)
pub fn bump_world_revision(&mut self)
Increments the 3D world revision counter so 3D render caches invalidate independently of UI HUD updates.
§Arguments
&Self- Mutable world.
Sourcepub fn set_object_dynamic(&mut self, obj_idx: usize, is_dynamic: bool) -> bool
pub fn set_object_dynamic(&mut self, obj_idx: usize, is_dynamic: bool) -> bool
Marks object obj_idx as static or dynamic, routing its triangles between the static BVH and incrementally refitted dynamic BVH.
§Arguments
&Self- Mutable world.usize- Target object index inobjects.bool-truefor dynamic BVH routing,falsefor static BVH routing.
§Returns
bool-truewhenobj_idxexisted and was updated.
Sourcepub fn teleport_object(
&mut self,
obj_idx: usize,
transform: Transform3D,
) -> bool
pub fn teleport_object( &mut self, obj_idx: usize, transform: Transform3D, ) -> bool
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)
Synchronizes the split static and dynamic BVH acceleration structures, refitting moving dynamic casters in O(N) without rebuilding static world geometry.
§Arguments
&Self- Mutable world.
Sourcepub fn sync_dynamic_ray_instances(&mut self)
pub fn sync_dynamic_ray_instances(&mut self)
Lazily constructs local-space BVH4/BVH8 trees for dynamic meshes and updates dynamic_instances from current object transforms with zero BVH rebuilds.
§Arguments
&Self- Mutable world reference.
Sourcepub fn trace_any_shadow_object_space(
&self,
ray: &Ray3D,
t_min: f32,
t_max: f32,
) -> bool
pub fn trace_any_shadow_object_space( &self, ray: &Ray3D, t_min: f32, t_max: f32, ) -> bool
Traces a shadow ray using static BVH plus object-space inverse-interpolated dynamic instances.
§Arguments
&Self- World reference.&Ray3D- World-space shadow ray.f32- Minimum hit distance.f32- Maximum hit distance.
§Returns
bool-truewhen occluded by static or dynamic geometry at its current/interpolated pose.
Sourcepub fn trace_closest_packet4(
&self,
pkt: &RayPacket4,
active_mask: u8,
t_min: f32,
t_max: f32,
) -> [Option<RayHit3D>; 4]
pub fn trace_closest_packet4( &self, pkt: &RayPacket4, active_mask: u8, t_min: f32, t_max: f32, ) -> [Option<RayHit3D>; 4]
Traces a coherent 4-ray closest-hit packet against both the static BVH4 and object-space inverse-interpolated dynamic instances.
§Arguments
&Self- World reference.&RayPacket4- Coherent 4-ray query packet.u8- 4-bit mask of active rays (0..=15).f32- Minimum hit distance.f32- Maximum hit distance.
§Returns
[Option<RayHit3D>; 4]- Closest hit surface with world normal and material per active lane.
Sourcepub fn trace_closest_object_space(
&self,
ray: &Ray3D,
t_min: f32,
t_max: f32,
) -> Option<RayHit3D>
pub fn trace_closest_object_space( &self, ray: &Ray3D, t_min: f32, t_max: f32, ) -> Option<RayHit3D>
Traces a closest-hit ray using static BVH plus object-space inverse-interpolated dynamic instances.
§Arguments
&Self- World reference.&Ray3D- World-space query ray.f32- Minimum hit distance.f32- Maximum hit distance.
§Returns
Option<RayHit3D>- Closest hit surface with world-space normal and material.
Sourcepub fn total_bvh_nodes(&self) -> usize
pub fn total_bvh_nodes(&self) -> usize
Sourcepub fn trace_any_shadow_split(
bvhs: (&Bvh3D, &Bvh3D),
ray: (Vec3, Vec3, Vec3),
bounds: (f32, f32),
caches: (&mut u32, &mut u32),
) -> bool
pub fn trace_any_shadow_split( bvhs: (&Bvh3D, &Bvh3D), ray: (Vec3, Vec3, Vec3), bounds: (f32, f32), caches: (&mut u32, &mut u32), ) -> bool
Traces a shadow/occlusion ray across both static and dynamic BVHs using 1-triangle occluder caches.
§Arguments
(&Bvh3D, &Bvh3D)-(static_bvh, dynamic_bvh)pair.(Vec3, Vec3, Vec3)-(origin, dir, inv_dir)ray triple.(f32, f32)-(t_min, t_max)distance bounds.(&mut u32, &mut u32)-(static_cache, dynamic_cache)occluder triangle hints.
§Returns
bool-trueif occluded by either static or dynamic geometry.
Sourcepub fn trace_closest_split(
bvhs: (&Bvh3D, &Bvh3D),
ray: (Vec3, Vec3, Vec3),
bounds: (f32, f32),
) -> Option<(f32, bool, usize)>
pub fn trace_closest_split( bvhs: (&Bvh3D, &Bvh3D), ray: (Vec3, Vec3, Vec3), bounds: (f32, f32), ) -> Option<(f32, bool, usize)>
Traces a reflection/GI ray across both static and dynamic BVHs and returns (distance, is_dynamic, tri_index).
§Arguments
(&Bvh3D, &Bvh3D)-(static_bvh, dynamic_bvh)pair.(Vec3, Vec3, Vec3)-(origin, dir, inv_dir)ray triple.(f32, f32)-(t_min, t_max)distance bounds.
§Returns
Option<(f32, bool, usize)>- Closest(t, hit_in_dynamic_bvh, triangle_index).
Sourcepub fn vehicle_index(&self) -> Option<usize>
pub fn vehicle_index(&self) -> Option<usize>
Sourcepub fn loop_lateral_offset(world_x: f32, world_z: f32) -> (f32, f32)
pub fn loop_lateral_offset(world_x: f32, world_z: f32) -> (f32, f32)
Evaluates the closed-loop coastal circuit spine distance d_spine and signed lateral offset road_u = d_spine - CITY_LOOP_RADIUS for any horizontal world coordinate (world_x, world_z).
§Arguments
f32- World-space X coordinate in meters.f32- World-space Z coordinate in meters.
§Returns
(f32, f32)-(d_spine, road_u)in meters matching the GPU road/puddle/coastal-bay shader contract.
Sourcepub fn loop_pose_at(arc_s: f32, lateral_u: f32) -> (Vec3, f32)
pub fn loop_pose_at(arc_s: f32, lateral_u: f32) -> (Vec3, f32)
Evaluates the world-space position and clockwise tangent yaw in radians along the 962m closed-loop stadium circuit at continuous arc-length arc_s and signed lateral lane offset lateral_u.
§Arguments
f32- Continuous arc-length along the loop centerline in meters (wrapped moduloCITY_LOOP_TOTAL_LENGTH).f32- Signed lateral offset from centerline in meters (+outward,-inward toward Inner Landmark Island).
§Returns
(Vec3, f32)-(world_position, clockwise_yaw_rad)where car forward is(-sin(yaw), 0, -cos(yaw)).
Sourcepub fn hero_vehicle_material(style: HeroVehicleStyle) -> PbrMaterial
pub fn hero_vehicle_material(style: HeroVehicleStyle) -> PbrMaterial
Sourcepub fn set_hero_vehicle_style(&mut self, style: HeroVehicleStyle) -> bool
pub fn set_hero_vehicle_style(&mut self, style: HeroVehicleStyle) -> bool
Switches the active hero supercar live between HeroVehicleStyle::AventadorV12 and HeroVehicleStyle::ShelbyCobra, seamlessly preserving live position, yaw, headlights, taillights, and solid collision OBB without reallocating or rebuilding static geometry.
§Arguments
&Self- Mutable world reference.HeroVehicleStyle- Target hero vehicle bodywork archetype.
§Returns
bool-truewhen the active hero vehicle mesh was updated.
Sourcepub fn create_open_world_city() -> Self
pub fn create_open_world_city() -> Self
Builds a coastal closed-loop 962m metropolitan open-world circuit featuring six sculpted architectural building archetypes, an inner landmark skyline island, an open sunlit eastern ocean waterfront promenade, dynamic rigid-body boulevard and off-road NPC traffic, and selectable Aventador SVJ / Shelby GT500 Cobra hero supercars.
§Returns
Self- Populated open-world 3D coastal city ready for real-time PBR + Ray Tracing.
Sourcepub fn create_open_world_city_with_gpu_cache() -> (Self, Arc<GpuWorld3dMeshBuffer>, Vec<(u32, u32)>)
pub fn create_open_world_city_with_gpu_cache() -> (Self, Arc<GpuWorld3dMeshBuffer>, Vec<(u32, u32)>)
Clones the cached Vice Boulevard open-world city together with its pre-baked static GPU vertex buffer in O(1) Arc::clone, avoiding main-thread vertex packing stutters on /game3d entry.
§Returns
(Self, Arc<GpuWorld3dMeshBuffer>, Vec<(u32, u32)>)- Ready-to-render 3D city plus shared static GPU mesh buffer and per-mesh vertex ranges.
Sourcepub fn traffic_vehicle_count(&self) -> usize
pub fn traffic_vehicle_count(&self) -> usize
Returns the number of autonomous rigid-body NPC vehicles registered in this world.
§Returns
usize- Active autonomous NPC vehicle count.
Sourcepub fn traffic_vehicle_object_index(&self, slot: usize) -> Option<usize>
pub fn traffic_vehicle_object_index(&self, slot: usize) -> Option<usize>
Sourcepub fn traffic_vehicle_velocity(&self, slot: usize) -> Option<Vec3>
pub fn traffic_vehicle_velocity(&self, slot: usize) -> Option<Vec3>
Sourcepub fn traffic_vehicle_yaw_rate(&self, slot: usize) -> Option<f32>
pub fn traffic_vehicle_yaw_rate(&self, slot: usize) -> Option<f32>
Sourcepub fn traffic_vehicle_is_free_roam(&self, slot: usize) -> Option<bool>
pub fn traffic_vehicle_is_free_roam(&self, slot: usize) -> Option<bool>
Sourcepub fn player_velocity(&self) -> Vec3
pub fn player_velocity(&self) -> Vec3
Returns the player vehicle’s live world-space horizontal velocity vector in meters per second.
§Returns
Vec3- Player vehicle velocity(vx, 0.0, vz)in meters per second.
Sourcepub fn player_forward_speed_mps(&self) -> f32
pub fn player_forward_speed_mps(&self) -> f32
Returns the player vehicle’s signed longitudinal velocity along its facing direction in meters per second (negative while reversing).
§Returns
f32- Signed forward velocity in meters per second.
Sourcepub fn reset_player_vehicle(&mut self) -> bool
pub fn reset_player_vehicle(&mut self) -> bool
Resets the player hero vehicle to the coastal boulevard starting grid with full nitro charge and cleared particle trails.
§Returns
bool-truewhen the player vehicle existed and was reset cleanly.
Sourcepub fn player_speed_mps(&self) -> f32
pub fn player_speed_mps(&self) -> f32
Returns the player vehicle’s live horizontal speed in meters per second.
§Returns
f32- Horizontal speed magnitude in meters per second.
Sourcepub fn player_speed_kmh(&self) -> f32
pub fn player_speed_kmh(&self) -> f32
Returns the player vehicle’s live speed in kilometers per hour.
§Returns
f32- Speed in kilometers per hour.
Sourcepub fn player_yaw_rate(&self) -> f32
pub fn player_yaw_rate(&self) -> f32
Returns the player vehicle’s active yaw angular velocity in radians per second.
§Returns
f32- Active yaw rate in radians per second.
Sourcepub fn player_boost_active(&self) -> bool
pub fn player_boost_active(&self) -> bool
Returns true when Shift nitro boost is currently delivering extra thrust.
§Returns
bool- Whether nitro boost is active.
Sourcepub fn player_boost_charge(&self) -> f32
pub fn player_boost_charge(&self) -> f32
Returns the player vehicle’s normalized remaining nitro boost charge in [0.0, 1.0].
§Returns
f32- Normalized boost charge in[0.0, 1.0].
Sourcepub fn player_drift_active(&self) -> bool
pub fn player_drift_active(&self) -> bool
Returns true when Space handbrake powerslide drift is currently active.
§Returns
bool- Whether handbrake drift is active.
Sourcepub fn player_drift_slip_angle_rad(&self) -> f32
pub fn player_drift_slip_angle_rad(&self) -> f32
Returns the player vehicle’s signed lateral slip angle in radians.
§Returns
f32- Signed lateral slip angleatan2(v_lateral, |v_forward|)in radians.
Sourcepub fn player_body_roll_rad(&self) -> f32
pub fn player_body_roll_rad(&self) -> f32
Returns the player vehicle’s visual lateral chassis body roll angle in radians.
§Returns
f32- Body roll angle in radians.
Sourcepub fn player_body_pitch_rad(&self) -> f32
pub fn player_body_pitch_rad(&self) -> f32
Returns the player vehicle’s visual longitudinal chassis pitch angle in radians.
§Returns
f32- Body pitch angle in radians.
Sourcepub fn player_camera_fov_boost(&self) -> f32
pub fn player_camera_fov_boost(&self) -> f32
Returns the player chase camera’s active dynamic FOV boost offset in degrees.
§Returns
f32- Dynamic FOV boost offset in degrees.
Sourcepub fn player_camera_shake(&self) -> f32
pub fn player_camera_shake(&self) -> f32
Returns the player camera’s active impact shake intensity in [0.0, 1.0].
§Returns
f32- Camera impact shake amplitude.
Sourcepub fn apply_atmosphere_preset(&mut self, preset: u8) -> f32
pub fn apply_atmosphere_preset(&mut self, preset: u8) -> f32
Sourcepub fn add_point_light(&mut self, light: PointLight3D) -> usize
pub fn add_point_light(&mut self, light: PointLight3D) -> usize
Sourcepub fn add_spot_light(&mut self, light: SpotLight3D) -> usize
pub fn add_spot_light(&mut self, light: SpotLight3D) -> usize
Sourcepub fn clear_local_lights(&mut self)
pub fn clear_local_lights(&mut self)
Clears all dynamic local point and spot lights from this world.
Sourcepub fn emit_particles_3d(
&mut self,
config: &NiagaraEmitterConfig3D,
count: usize,
) -> usize
pub fn emit_particles_3d( &mut self, config: &NiagaraEmitterConfig3D, count: usize, ) -> usize
Sourcepub fn create_dense_open_world_city(blocks_radius: i32) -> Self
pub fn create_dense_open_world_city(blocks_radius: i32) -> Self
Builds a dense UE5-scale multi-block cyberpunk metropolis with hundreds of occluding towers, local neon lights, and dynamic vehicles for scalability and occlusion benchmarking.
§Arguments
i32- City block half-radius (1..=5, producing(2r+1)x(2r+1)multi-tower blocks).
§Returns
Self- Populated dense 3D open-world metropolis with built static/dynamic BVHs.
Sourcepub fn cycle_camera_mode(&mut self) -> u8
pub fn cycle_camera_mode(&mut self) -> u8
Sourcepub fn mesh_oriented_box_collision(
&self,
candidate: OrientedBox3D,
ignore_idx: Option<usize>,
) -> Option<MeshCollisionHit3D>
pub fn mesh_oriented_box_collision( &self, candidate: OrientedBox3D, ignore_idx: Option<usize>, ) -> Option<MeshCollisionHit3D>
Tests a world-space OrientedBox3D against every solid (solid_collider || ray_trace_caster) model’s real mesh triangles and closed solid interiors (excluding ignore_idx), returning the deepest penetration hit.
§Arguments
&Self- World reference.OrientedBox3D- Candidate oriented bounding box in world space.Option<usize>- Optional scene object index to exclude (self).
§Returns
Option<MeshCollisionHit3D>- Deepest real-mesh triangle or closed-volume collision contact, orNonewhen clear.
Sourcepub fn raycast_solid_meshes(
&self,
origin: Vec3,
direction: Vec3,
max_dist: f32,
ignore_idx: Option<usize>,
) -> Option<RayHit3D>
pub fn raycast_solid_meshes( &self, origin: Vec3, direction: Vec3, max_dist: f32, ignore_idx: Option<usize>, ) -> Option<RayHit3D>
Casts a world-space ray against every solid (ray_trace_caster == true) model’s real mesh triangles (excluding ignore_idx) up to max_dist.
§Arguments
&Self- World reference.Vec3- Ray origin in world space.Vec3- Unit ray direction in world space.f32- Maximum ray distance.Option<usize>- Optional scene object index to exclude.
§Returns
Option<RayHit3D>- Closest real-mesh triangle intersection within(1e-4, max_dist].
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 chassis dynamics (Shift boost, Space drift, Ackermann reverse), dynamic rigid-body NPC traffic, 2-body OBB SAT collisions, raycast chase camera, Niagara particles, and animations.
§Arguments
f32- Delta time in seconds.&InputState- Real-time polled keyboard/pointer input.&ActionMap- Action bindings for WASD/Arrows, Boost, and Drift controls.
Sourcepub fn environment_ibl(&self) -> Option<&EnvironmentIbl3D>
pub fn environment_ibl(&self) -> Option<&EnvironmentIbl3D>
Returns the optional precomputed IBL environment attached to this world.
§Returns
Option<&EnvironmentIbl3D>- Borrowed IBL environment if configured.
Sourcepub fn set_environment_ibl(&mut self, ibl: Option<EnvironmentIbl3D>)
pub fn set_environment_ibl(&mut self, ibl: Option<EnvironmentIbl3D>)
Replaces the world’s active IBL environment and increments the world revision.
§Arguments
&Self- Mutable world.Option<EnvironmentIbl3D>- New IBL environment orNoneto clear.
Sourcepub fn active_scene_camera_index(&self) -> Option<usize>
pub fn active_scene_camera_index(&self) -> Option<usize>
Returns the currently active multi-camera index inside scene_cameras, if selected.
§Returns
Option<usize>- Active camera index inscene_cameras, orNonewhen usingcamera.
Sourcepub fn set_active_scene_camera(&mut self, camera_index: Option<usize>) -> bool
pub fn set_active_scene_camera(&mut self, camera_index: Option<usize>) -> bool
Sourcepub fn active_view_projection(&self, viewport_aspect: f32) -> Mat4
pub fn active_view_projection(&self, viewport_aspect: f32) -> Mat4
Sourcepub fn deformed_mesh_for_object(&self, obj_idx: usize) -> Option<&Mesh3D>
pub fn deformed_mesh_for_object(&self, obj_idx: usize) -> Option<&Mesh3D>
Sourcepub fn is_object_visible(&self, obj_idx: usize) -> bool
pub fn is_object_visible(&self, obj_idx: usize) -> bool
Sourcepub fn set_skinning_mode(&mut self, skin_idx: usize, mode: SkinningMode) -> bool
pub fn set_skinning_mode(&mut self, skin_idx: usize, mode: SkinningMode) -> bool
Sourcepub fn set_collection_visible(
&mut self,
collection_name: &str,
visible: bool,
) -> bool
pub fn set_collection_visible( &mut self, collection_name: &str, visible: bool, ) -> bool
Sourcepub fn load_imported_scene(&mut self, scene: &ImportedScene3D) -> Vec<usize>
pub fn load_imported_scene(&mut self, scene: &ImportedScene3D) -> Vec<usize>
Loads an ImportedScene3D (from glTF 2.0 / binary GLB / .euv3d) directly into World3D, wiring hierarchy, collections, Principled BSDF materials, mipmapped textures, skins, animations, cameras, and lights.
§Arguments
&Self- Mutable 3D world.&ImportedScene3D- Parsed Blender/glTF 2.0 scene bundle.
§Returns
Vec<usize>- Indices of all spawnedSceneObject3Dentries insideWorld3D::objects.
Sourcepub fn pick_object_ray(
&self,
screen_u: f32,
screen_v: f32,
aspect: f32,
) -> Option<ScenePickHit3D>
pub fn pick_object_ray( &self, screen_u: f32, screen_v: f32, aspect: f32, ) -> Option<ScenePickHit3D>
Casts a picking ray through normalized screen coordinates (screen_u, screen_v) in [0.0, 1.0] using AABB/meshlet broadphase and exact Möller–Trumbore triangle intersection.
§Arguments
f32- Normalized horizontal screen coordinate in[0.0, 1.0](left to right).f32- Normalized vertical screen coordinate in[0.0, 1.0](top to bottom).f32- Viewport aspect ratiowidth / height.
§Returns
Option<ScenePickHit3D>- Nearest visible object triangle hit orNonewhen no object is intersected.
Sourcepub fn tick_animations(&mut self, dt_secs: f32) -> usize
pub fn tick_animations(&mut self, dt_secs: f32) -> usize
Advances active glTF/NLA animations by dt_secs, propagates dirty scene-graph transforms, synchronizes object/camera transforms, and evaluates Shape Keys + Armature Skinning with zero steady-state heap allocations.
§Arguments
&Self- Mutable 3D world.f32- Frame delta time in seconds.
§Returns
usize- Count of updated scene nodes, morph channels, and deformed meshes.
Sourcepub fn update_deformed_meshes(&mut self) -> usize
pub fn update_deformed_meshes(&mut self) -> usize
Evaluates Shape Keys (pre-skinning) and Armature Skinning (LBS or DQS) for all deformable objects into reusable deformed_meshes buffers with zero steady-state allocations.
§Returns
usize- Number of objects whose deformed mesh was updated.
Sourcepub fn apply_live_delta(&mut self, delta: &BlenderLiveDelta3D) -> bool
pub fn apply_live_delta(&mut self, delta: &BlenderLiveDelta3D) -> bool
Sourcepub fn allocate_gpu_mesh_revision() -> u64
pub fn allocate_gpu_mesh_revision() -> u64
Allocates a globally unique non-zero revision tag for GpuWorld3dMeshBuffer VRAM caching across distinct World3D instances.
§Returns
u64- Monotonically increasing non-zero mesh revision tag.
Sourcepub fn build_gpu_mesh_buffer(
&self,
revision: u64,
) -> (Arc<GpuWorld3dMeshBuffer>, Vec<(u32, u32)>)
pub fn build_gpu_mesh_buffer( &self, revision: u64, ) -> (Arc<GpuWorld3dMeshBuffer>, Vec<(u32, u32)>)
Flattens every registered LOD0 prototype mesh in mesh_library plus one shared unit Niagara particle primitive into one resident GPU vertex buffer and per-mesh (vertex_start, vertex_count) table.
§Arguments
&Self- World reference.u64- Monotonic revision tag attached to the built buffer for VRAM upload caching.
§Returns
(Arc<GpuWorld3dMeshBuffer>, Vec<(u32, u32)>)- Shared static GPU vertex buffer and per-mesh range table (with the Niagara particle primitive appended at indexmesh_library.len()).
Sourcepub fn build_gpu_scene_pass_into(
&mut self,
snapshots: &DoubleBufferedSnapshot<World3DSnapshot>,
alpha: f32,
viewport: (u32, u32),
quality: &RenderQualityConfig,
mesh_cache: (&Arc<GpuWorld3dMeshBuffer>, &[(u32, u32)]),
out: &mut GpuWorld3dScenePass,
)
pub fn build_gpu_scene_pass_into( &mut self, snapshots: &DoubleBufferedSnapshot<World3DSnapshot>, alpha: f32, viewport: (u32, u32), quality: &RenderQualityConfig, mesh_cache: (&Arc<GpuWorld3dMeshBuffer>, &[(u32, u32)]), out: &mut GpuWorld3dScenePass, )
Populates a recycled GpuWorld3dScenePass in-place using World3D’s persistent flat scratch arena with zero per-frame heap allocations.
§Arguments
&Self- Mutable world reference.&DoubleBufferedSnapshot<World3DSnapshot>- Double-buffered dynamic object and camera snapshots.f32- Render interpolation alpha in[0.0, 1.0].(u32, u32)- Target physical framebuffer(width, height).&RenderQualityConfig- Active quality settings controlling draw distance, culling, and fog.(&Arc<GpuWorld3dMeshBuffer>, &[(u32, u32)])- Cached static mesh buffer and per-mesh(vertex_start, vertex_count)ranges.&mut GpuWorld3dScenePass- Recycled scene pass destination populated in-place.
Sourcepub fn build_gpu_pbr_scene_pass_into(
&mut self,
viewport: (u32, u32),
quality: &RenderQualityConfig,
belt: &mut GpuUploadBelt,
out: &mut GpuPbrScenePass,
)
pub fn build_gpu_pbr_scene_pass_into( &mut self, viewport: (u32, u32), quality: &RenderQualityConfig, belt: &mut GpuUploadBelt, out: &mut GpuPbrScenePass, )
Populates a recycled GpuPbrScenePass in-place with quantized 24-byte PBR geometry, SIMD frustum and meshlet normal-cone culling, 64-bit instanced sorting, LBS/DQS skinning, morph weights, local lights, SH9 IBL, and budget-capped incremental mip uploads with zero steady-state heap allocations.
§Arguments
(u32, u32)- Target physical framebuffer(width, height).&RenderQualityConfig- Active quality settings controlling draw distance, culling, LOD bias, and fog.&mut GpuUploadBelt- Frame-budgeted GPU staging belt enforcing<= 4 MiBand<= 1.5 msceilings.&mut GpuPbrScenePass- Recycled PBR scene pass destination populated in-place.
Sourcepub fn build_gpu_scene_pass(
&self,
snapshots: &DoubleBufferedSnapshot<World3DSnapshot>,
alpha: f32,
viewport: (u32, u32),
quality: &RenderQualityConfig,
mesh_cache: (&Arc<GpuWorld3dMeshBuffer>, &[(u32, u32)]),
) -> GpuWorld3dScenePass
pub fn build_gpu_scene_pass( &self, snapshots: &DoubleBufferedSnapshot<World3DSnapshot>, alpha: f32, viewport: (u32, u32), quality: &RenderQualityConfig, mesh_cache: (&Arc<GpuWorld3dMeshBuffer>, &[(u32, u32)]), ) -> GpuWorld3dScenePass
Builds a hardware GPU 3D scene pass by frustum-culling visible objects and grouping instanced transforms by mesh_id with zero Vec<Vec<_>> allocations and O(1) dynamic pose lookup.
§Arguments
&Self- World reference.&DoubleBufferedSnapshot<World3DSnapshot>- Double-buffered dynamic object and camera snapshots.f32- Render interpolation alpha in[0.0, 1.0].(u32, u32)- Target physical framebuffer(width, height).&RenderQualityConfig- Active quality settings controlling draw distance, culling, and fog.(&Arc<GpuWorld3dMeshBuffer>, &[(u32, u32)])- Cached static mesh buffer and per-mesh(vertex_start, vertex_count)ranges.
§Returns
GpuWorld3dScenePass- Hardware instanced 3D scene pass descriptor ready for Metal, GLES3, D3D11, or WebGL2.
Source§impl World3D
Implements impl #impl_generics #name #ty_generics #where_clause.
impl World3D
Implements impl #impl_generics #name #ty_generics #where_clause.