Skip to main content

Crate gizmo_renderer

Crate gizmo_renderer 

Source
Expand description

GPU mesh rendering for the Gizmo engine (wgpu pipelines, materials, instancing).

§Frustum culling (CPU-side, before instancing)

The renderer does not iterate entities; your render loop should build the instance list. Before pushing each InstanceRaw, skip meshes outside the camera frustum using the same view * projection matrix you upload in SceneUniforms:

use gizmo_renderer::{Frustum, visible_in_frustum};
let frustum = Frustum::from_matrix(&view_proj);
if !visible_in_frustum(&frustum, &model_matrix, &mesh.bounds) {
    continue;
}

Mesh carries a local-space Aabb (bounds); visible_in_frustum transforms it by the instance model matrix and tests against the six planes. This pairs with batched draw(vertex_range, instance_start..instance_end) so culled instances are never written to the instance buffer. The demo, gizmo-studio, and gizmo::systems::default_render_pass pipelines already apply this pattern.

Implementation: frustum_cull re-exports Frustum and helpers from gizmo-math.

Re-exports§

pub use frustum_cull::visible_in_frustum;
pub use web_profile::PostProcessLevel;
pub use web_profile::ShadowQuality;
pub use web_profile::WebProfile;
pub use animation::AnimationClip;
pub use animation::Keyframe;
pub use animation::SkeletonHierarchy;
pub use animation::SkeletonJoint;
pub use animation::Track;
pub use animation_state_machine::ActiveBlend;
pub use animation_state_machine::AnimationState;
pub use animation_state_machine::AnimationStateMachine;
pub use animation_state_machine::AnimationTransition;
pub use animation_system::animation_state_machine_update_system;
pub use animation_system::animation_update_system;
pub use animation_system::decompose_mat4;
pub use asset::decode_obj_vertices_for_async;
pub use asset::decode_rgba_image_file;
pub use asset::AssetManager;
pub use asset::GltfNodeData;
pub use async_assets::AsyncAssetLoader;
pub use async_assets::CompletedAsyncLoads;
pub use async_assets::GltfImportCompletion;
pub use async_assets::GltfImportError;
pub use async_assets::ObjLoadCompletion;
pub use async_assets::TextureReloadCompletion;
pub use components::Camera;
pub use components::Camera2D;
pub use components::DirectionalLight;
pub use components::LodGroup;
pub use components::LodLevel;
pub use components::Material;
pub use components::Mesh;
pub use components::MeshRenderer;
pub use components::PointLight;
pub use components::SpotLight;
pub use components::Sprite;
pub use csm::cascade_split_distances;
pub use csm::directional_cascade_view_projs;
pub use csm::CASCADE_COUNT;
pub use csm::SHADOW_MAP_RES;
pub use debug_renderer::GizmoRendererSystem;
pub use debug_renderer::Gizmos;
pub use decal::DecalState;
pub use deferred::DeferredState;
pub use gi::LightProbe;
pub use gi::ProbeGrid;
pub use gi::SHCoeffs;
pub use gpu_cull::DrawIndirectArgs;
pub use gpu_cull::GpuCullState;
pub use gpu_cull::MeshBoundsRaw;
pub use gpu_types::InstanceRaw;
pub use gpu_types::LightData;
pub use gpu_types::PostProcessUniforms;
pub use gpu_types::SceneUniforms;
pub use gpu_types::ShadowVsUniform;
pub use gpu_types::Vertex;
pub use hot_reload::AssetWatcher;
pub use pipeline::SceneState;
pub use post_process::PostProcessState;
pub use renderer::RenderContext;
pub use renderer::Renderer;
pub use ssao::SsaoParams;
pub use ssao::SsaoState;
pub use ssgi::SsgiState;
pub use taa::TaaState;
pub use fxaa::FxaaState;

Modules§

animation
animation_state_machine
animation_system
asset
asset_loading
async_assets
Background-thread decoding for textures, OBJ, and GLTF import (disk + parse). GPU upload and AssetManager updates must run on the main thread — call AsyncAssetLoader::drain_completed each frame and then upload via AssetManager.
components
csm
Cascaded shadow maps (CSM) for directional lights: split the camera depth range into several cascades, each rendered to a layer of a depth2d_array with its own light orthographic projection (tighter texel density near the camera).
debug_renderer
decal
deferred
frustum_cull
CPU-side frustum culling before filling the instance buffer.
fxaa
FXAA (Fast Approximate Anti-Aliasing) — Post-Processing Pass
gi
Spherical Harmonics (SH) Probe — Global Illumination altyapısı
gpu_cull
gpu_fluid
gpu_particles
gpu_physics
gpu_types
hot_reload
Dosya izleme (AssetWatcher) ile hot-reload.
pipeline
post_process
renderer
ssao
ssgi
ssr
taa
volumetric
web_profile

Structs§

Frustum
Six-plane view frustum extracted from a combined Projection × View matrix.