Skip to main content

sgl_3d/
lib.rs

1//! Caller-driven 3D rendering for SGL, native and in the browser (WASM +
2//! WebGPU). Games own composition, simulation and content.
3#![deny(unsafe_code)]
4mod content;
5pub(crate) mod counters;
6#[cfg(any(test, feature = "diagnostics"))]
7pub mod diagnostics;
8mod frame_input;
9pub mod graphics_device;
10mod readback;
11mod renderer;
12mod scene;
13pub mod settings;
14mod shading;
15mod stages;
16#[cfg(all(test, not(target_arch = "wasm32")))]
17mod test_support;
18pub mod timing;
19mod view;
20
21pub use content::baked_specular_probe::{
22    BakedSpecularProbe, ProbeError, SpecularProbeBox, SpecularProbeRadiance, SpecularProbeTexels,
23};
24pub use content::decal::Decal;
25pub use content::dynamic_gi::DynamicGiVolume;
26pub use content::identity::{
27    DecalId, DecalImageId, EnvironmentId, InstanceId, LightId, MaterialId, ModelId, ShaderId,
28};
29pub use content::instance::{InstanceState, Mobility};
30pub use content::irradiance_volume::{IrradianceCell, IrradianceVolume};
31pub use content::light::{Light, LightShape};
32pub use content::lighting::{
33    Backdrop, DirectionalLight, DirectionalShadow, EnvironmentLight, HemisphereLight, Mist,
34};
35pub use content::material::{AlphaMode, NormalLayer, SurfaceMaterial};
36pub use content::model::{AssetIds, ModelMesh};
37pub use content::shader::{MaterialShader, ShaderSource};
38pub use content::transient::FogVolume;
39pub use content::{
40    asset, baked_specular_probe, deformation, environment, geometry, static_lighting,
41};
42pub use frame_input::{
43    AgxLook, AutoExposure, BloomParameters, Camera, ColorGrading, ColorGradingGlobal,
44    ColorGradingSection, CompensationCurve, CompensationCurveError, Exposure, Fog, FrameInput,
45    MeteringMask, MotionBlurParameters, perspective,
46};
47pub use glam;
48#[cfg(all(test, not(target_arch = "wasm32")))]
49pub(crate) use renderer::test_frame::TestRenderer;
50pub use renderer::{Renderer, View, ViewError, ViewFrame};
51pub use scene::irradiance_volume::PreparedIrradianceRegion;
52pub use scene::rays::acceleration::RayTracingStats;
53pub use scene::{PreparedModel, PreparedModelOptions, RayData, Scene, SceneError, SceneOptions};
54pub use settings::ToneMapping;
55pub use stages::shadows::local::LocalShadowStats;
56pub use view::draw_list::GeometryStats;
57
58/// Caller-authored spatial mesh alternatives, bounded in primary-camera
59/// pixels (`Scene::set_mesh_lods`).
60pub mod lod {
61    pub use crate::content::lod::MeshLod;
62    pub use crate::shading::culling::MAX_MESH_LODS;
63}
64/// Caller-authored additive geometry.
65pub mod effects {
66    pub use crate::content::transient::{Glow, GlowKind, GlowProfile};
67}
68/// A game's material shaders (`Scene::add_shader`): their source, what a
69/// material names, the parameter block's layout, why a module is refused,
70/// and the contract's limits.
71pub mod shader {
72    pub use crate::content::shader::{
73        ForbiddenItem, MaterialShader, SHADER_LOOP_BUDGET, SHADER_PARAMS_MAX_BYTES, ShaderError,
74        ShaderParamField, ShaderParamsLayout, ShaderSource,
75    };
76}
77/// Caller-authored heat shimmer geometry.
78pub mod heat_distortion {
79    pub use crate::content::transient::{HeatDistortion, MAX_DISPLACEMENT_PIXELS, MAX_VERTICES};
80}