Skip to main content

gizmo_renderer/
lib.rs

1//! GPU mesh rendering for the Gizmo engine (wgpu pipelines, materials, instancing).
2//!
3//! ## Frustum culling (CPU-side, before instancing)
4//!
5//! The renderer does not iterate entities; **your render loop** should build the instance list.
6//! Before pushing each [`InstanceRaw`](gpu_types::InstanceRaw), skip meshes outside the camera
7//! frustum using the same `view * projection` matrix you upload in [`SceneUniforms`](gpu_types::SceneUniforms):
8//!
9//! ```ignore
10//! use gizmo_renderer::{Frustum, visible_in_frustum};
11//! let frustum = Frustum::from_matrix(&view_proj);
12//! if !visible_in_frustum(&frustum, &model_matrix, &mesh.bounds) {
13//!     continue;
14//! }
15//! ```
16//!
17//! [`Mesh`](components::Mesh) carries a local-space [`Aabb`](gizmo_math::Aabb) (`bounds`);
18//! `visible_in_frustum` transforms it by the instance model matrix and tests against the six planes.
19//! This pairs with batched `draw(vertex_range, instance_start..instance_end)` so culled instances
20//! are never written to the instance buffer. The `demo`, `gizmo-studio`, and
21//! `gizmo::systems::default_render_pass` pipelines already apply this pattern.
22//!
23//! Implementation: [`frustum_cull`] re-exports [`Frustum`] and helpers from `gizmo-math`.
24
25pub mod animation;
26pub mod animation_state_machine;
27pub mod asset;
28pub mod async_assets;
29pub mod components;
30pub mod csm;
31pub mod debug_renderer;
32pub mod decal;
33pub mod deferred;
34pub mod frustum_cull;
35pub mod fxaa;
36pub mod gi;
37pub mod gpu_cull;
38pub mod gpu_fluid;
39pub mod gpu_particles;
40pub mod gpu_physics;
41pub mod gpu_types;
42pub mod hot_reload;
43pub mod pipeline;
44pub mod post_process;
45pub mod renderer;
46pub mod ssao;
47pub mod ssgi;
48pub mod ssr;
49pub mod taa;
50pub mod volumetric;
51pub mod web_profile;
52pub mod asset_loading;
53
54pub use frustum_cull::{visible_in_frustum, Frustum};
55pub use web_profile::{PostProcessLevel, ShadowQuality, WebProfile};
56
57pub use animation::{AnimationClip, Keyframe, SkeletonHierarchy, SkeletonJoint, Track};
58pub use animation_state_machine::{
59    ActiveBlend, AnimationState, AnimationStateMachine, AnimationTransition,
60};
61pub mod animation_system;
62pub use animation_system::{animation_state_machine_update_system, animation_update_system, decompose_mat4};
63pub use asset::{
64    decode_obj_vertices_for_async, decode_rgba_image_file, AssetManager, GltfNodeData,
65};
66pub use async_assets::{
67    AsyncAssetLoader, CompletedAsyncLoads, GltfImportCompletion, GltfImportError,
68    ObjLoadCompletion, TextureReloadCompletion,
69};
70pub use components::{
71    Camera, Camera2D, DirectionalLight, LodGroup, LodLevel, Material, Mesh, MeshRenderer,
72    PointLight, SpotLight, Sprite,
73};
74pub use csm::{
75    cascade_split_distances, directional_cascade_view_projs, CASCADE_COUNT, SHADOW_MAP_RES,
76};
77pub use debug_renderer::{GizmoRendererSystem, Gizmos};
78pub use decal::DecalState;
79pub use deferred::DeferredState;
80pub use gi::{LightProbe, ProbeGrid, SHCoeffs};
81pub use gpu_cull::{DrawIndirectArgs, GpuCullState, MeshBoundsRaw};
82pub use gpu_types::{
83    InstanceRaw, LightData, PostProcessUniforms, SceneUniforms, ShadowVsUniform, Vertex,
84};
85pub use hot_reload::AssetWatcher;
86pub use pipeline::SceneState;
87pub use post_process::PostProcessState;
88pub use renderer::{RenderContext, Renderer};
89pub use ssao::{SsaoParams, SsaoState};
90pub use ssgi::SsgiState;
91pub use taa::TaaState;
92pub use fxaa::FxaaState;