Skip to main content

Crate threers

Crate threers 

Source
Expand description

threers — a drop-in three.js replacement for Rust and WebAssembly.

Implements the three.js architecture and API surface: a scene graph of Object3Ds, BufferGeometry with named attributes, Materials, cameras, and a Renderer that walks the graph and draws. Backed by wgpu on native and WebGPU in the browser.

§Crates and targets

  • rlib: native desktop / tooling (cargo run --example cube)
  • cdylib: wasm32 WebAssembly (wasm-pack build)

§Web usage

Import web/threejs-shim.js for a drop-in THREE.* API over the wasm bindings. Existing three.js r165-style apps can swap in with minimal changes.

§Feature flags

The core — math, the scene graph, geometry, materials, lights, cameras, controls, loaders and exporters — is unconditional, and depends on log, slotmap and web-time and nothing else: no GPU stack, and none of the other threers crates. Everything below is a self-contained subsystem behind a feature, the renderer included: turning one off removes its module and its re-exports and touches nothing else.

# The core alone: scene graph, geometry and loaders, no GPU
threers = { version = "0.0.12", default-features = false }
# The renderer and nothing else
threers = { version = "0.0.12", default-features = false, features = ["render"] }

§Leaf features

FeatureDefaultRoleExtra deps
renderonThe wgpu renderer and everything that draws: Renderer, headless and windowed rendering, post-processing, marks, volumes, GPU textureswgpu, bytemuck, pollster
captionsonSubtitles — SRT + WebVTT, on-screen and burned inthreers-captions
sketchonsketch() and the winit-window WindowRenderer (implies render); off, winit is not builtwinit
mesh-bvhAccelerated raycast / shapecast—
raytracePath tracer: global illumination, area lights, refraction, DoF; CPU + wgpu-compute backends (implies render)—
bvh-csgConstructive solid geometry (implies mesh-bvh)—
openscad.scad front end + Solid DSL + exact-CSG kernel (implies bvh-csg)—
manifoldOptional Manifold kernel behind OpenSCAD booleans (implies openscad)manifold-rust
planetPlanets, moons, starfields, map generation—
fluidInteractive 2D and 3D fluids on the GPU, as render passes (runs on WebGL2; implies render)—
softbodySoft bodies that tear and regrow, with a WebGPU compute solver (implies render)threers-softbody
usdUniversal Scene Description — .usda, .usdc, .usdz, read and written—
native-codecPure-Rust video encoders, audio decoders and containers (wasm-safe)threers-codec
native-decodePure-Rust H.264, HEVC, VP9 and AV1 decoders (implies native-codec). Decodes on every core, and in hardware where there is some (VideoToolbox, NVDEC, VAAPI, loaded at run time); video on meshes and video export are the threers-video cratethreers-codec
metalA second renderer on Metal directly, via the Objective-C runtime (macOS/iOS; implies render)—
visionosCompositorServices frame loop + ARKit world tracking, stereo and reverse-Z (implies metal)—
videotoolboxIn-process VideoToolbox encode and decode (macOS)—
nvidiaNVENC encode and NVDEC decode on NVIDIA GPUs (Linux/Windows, driver loaded at run time)—
vaapiVAAPI HEVC encode and H.264/HEVC/VP9/AV1 decode on Linux (AMD, Intel; libva loaded at run time)—
parallelrayon-backed CSG/BVH work and frame-parallel encoding (native; a no-op on wasm32)rayon
asynctokio runtime for callers driving loaders concurrently (native)tokio
rlxTensors ↔ geometry and pixels, graph runner, convolution, mesh smoothing, fitted colour grades, palettesrlx
rlx-geoExact Delaunay + adaptive refinement + Voronoi cell texturesrlx-geo
nurbsNURBS curves/surfaces: derivatives, knots, tessellation—
brepAnalytic surface provenance on geometry (implies nurbs)—
brep-csgClosed-form SSI fast paths in the CSG kernel (implies brep + openscad)—
brep-kernelTrue B-rep topology, boolean, fillets (implies brep-csg)—
stepSTEP AP203/214 import + export (implies brep-kernel)—
assembly-checkAssembly motion checks (body correspondence, axis recovery, swept volume)—
learned-denoiseTrained U-Net denoiser beside À-Trous (implies raytrace)—
learned-denoise-metal, learned-denoise-gpuThe same network on Metal or wgpu (imply learned-denoise)—
webglWebGL2 in the browser through wgpu’s GL backend, where WebGPU is missing (implies render)—

§Meta bundles

BundleEnables
cadopenscad + nurbs + brep + brep-csg + parallel
medianative-decode + native-codec + gif + captions
giraytrace + learned-denoise
applemetal + videotoolbox
fullcad + media + gi + planet + fluid + usd + rlx + rlx-geo + assembly-check + async + step + brep-kernel
wasm-fullBrowser kitchen sink: captions + openscad + native-codec + nurbs + planet + raytrace + fluid + usd + softbody
# CAD stack in one flag
threers = { version = "0.0.10", features = ["cad"] }
# everything
threers = { version = "0.0.10", features = ["full"] }
# browser wasm kitchen sink
threers = { version = "0.0.10", features = ["wasm-full"] }
# nothing but the renderer
threers = { version = "0.0.10", default-features = false }

Rigid-body physics lives in the companion crate threers-physics. Language bindings: see docs/bindings.md (wasm ESM, napi-rs Node native, PyO3).

§Modules

ModuleRole
preludeOne glob import for the types nearly every scene uses; nested modules for controls / animation / …
coreScene graph, geometry, raycaster
mathVectors, matrices, colours, bounds, Delaunay, geographic coordinates — the threers-math crate
audioAudio sources, listeners and positional audio as scene nodes — the threers-audio crate (audio)
origamiRigid origami: crease patterns, degree-4 kinematics, folded meshes
rendererwgpu draw + post-processing; headless offscreen (native)
raytracePath-traced rendering — global illumination, on CPU or GPU (raytrace)
postprocessingthree.js EffectComposer and passes (native and browser)
loadersglTF, OBJ, HDR, …
extrasPMREM, noise, marching cubes, …
geometries::lattice35 lattice generators, and what they are worth: stiffness, conductivity, strength, porosity, pore size
materialsPBR materials and ShaderMaterial
captionssubtitles — SRT + WebVTT, on-screen and burned in (captions)
planetPlanets, moons, starfields (planet feature)
mesh_bvhOpt-in BVH (mesh-bvh feature)
csgOpt-in CSG (bvh-csg feature)
nurbs / brep / stepCAD surface stack (feature-gated)
codecOpt-in media codecs (native-codec feature)
rlxOpt-in RLX bridge (rlx, rlx-geo features)

Re-exports§

pub use fur::FurGroom;
pub use fur::FurMaterial;
pub use animation::AnimationAction;
pub use animation::AnimationClip;
pub use animation::AnimationMixer;
pub use animation::Interpolation;
pub use animation::KeyframeTrack;
pub use animation::TrackTarget;
pub use brep::retessellate;brep
pub use brep::retessellate;brep
pub use brep::Surface;brep
pub use brep::SurfaceTable;brep
pub use cameras::Camera;
pub use cameras::OrthographicCamera;
pub use cameras::PerspectiveCamera;
pub use cameras::ScreenProjector;
pub use cameras::ViewOffset;
pub use captions::CaptionFont;captions
pub use captions::CaptionOverlay;captions
pub use captions::CaptionPainter;captions
pub use controls::ArcballControls;
pub use controls::DragControls;
pub use controls::FirstPersonControls;
pub use controls::GlobeControls;
pub use controls::MapControls;
pub use controls::OrbitControls;
pub use controls::PointerEvent;
pub use controls::PointerLockControls;
pub use controls::TrackballControls;
pub use core::Bone;
pub use core::BufferAttribute;
pub use core::BufferGeometry;
pub use core::Clock;
pub use core::InstancedMesh;
pub use core::Intersection;
pub use core::Layers;
pub use core::LineSegments;
pub use core::Mesh;
pub use core::MorphAttributes;
pub use core::MorphTarget;
pub use core::Object3D;
pub use core::ObjectArena;
pub use core::ObjectId;
pub use core::ObjectKind;
pub use core::Points;
pub use core::Raycaster;
pub use core::Skeleton;
pub use core::SkinnedMesh;
pub use core::Sprite;
pub use core::DEFAULT_INFER_QUADS_ANGLE;
pub use curves::parse_svg_subpaths;
pub use curves::segments_to_path_data;
pub use curves::CatmullRomCurve3;
pub use curves::CubicBezierCurve;
pub use curves::CubicBezierCurve3;
pub use curves::Curve2;
pub use curves::Curve3;
pub use curves::CurvePath;
pub use curves::EllipseCurve;
pub use curves::LineCurve;
pub use curves::LineCurve3;
pub use curves::NURBSCurve;
pub use curves::NURBSSurface;
pub use curves::Path;
pub use curves::PathSegment;
pub use curves::QuadraticBezierCurve;
pub use curves::QuadraticBezierCurve3;
pub use curves::Shape;
pub use curves::SplineCurve;
pub use curves::SvgPathError;
pub use extras::CcdIkSolver;
pub use extras::IkBone;
pub use extras::MarchingCubes;
pub use extras::Octree;
pub use extras::PmremGenerator;
pub use extras::SimplexNoise;
pub use extras::PMREM_MIP_LEVELS;
pub use geometries::NurbsGeometry;nurbs
pub use geometries::BoxGeometry;
pub use geometries::BoxLineGeometry;
pub use geometries::CapsuleGeometry;
pub use geometries::ChiralRule;
pub use geometries::CircleGeometry;
pub use geometries::Conductivity;
pub use geometries::ConeGeometry;
pub use geometries::Conform;
pub use geometries::ConvexGeometry;
pub use geometries::Cuboct;
pub use geometries::CuboctAssembly;
pub use geometries::CuboctAssemblyPlan;
pub use geometries::CuboctAssemblyStep;
pub use geometries::CuboctFrame;
pub use geometries::CuboctJoint;
pub use geometries::CuboctJointKind;
pub use geometries::CylinderGeometry;
pub use geometries::DecalGeometry;
pub use geometries::DodecahedronGeometry;
pub use geometries::EdgesGeometry;
pub use geometries::ExtrudeGeometry;
pub use geometries::Field;
pub use geometries::FrameMaterial;
pub use geometries::FrameResponse;
pub use geometries::Glyph;
pub use geometries::Hand;
pub use geometries::IcosahedronGeometry;
pub use geometries::Infill;
pub use geometries::KirigamiAssembly;
pub use geometries::KirigamiCell;
pub use geometries::KirigamiCoreLattice;
pub use geometries::KirigamiCrease;
pub use geometries::KirigamiCreaseKind;
pub use geometries::KirigamiExpandedMiura;
pub use geometries::KirigamiFace;
pub use geometries::KirigamiFaceKind;
pub use geometries::KirigamiMesh;
pub use geometries::KirigamiNet;
pub use geometries::KirigamiNetPanel;
pub use geometries::KirigamiPreset;
pub use geometries::LatheGeometry;
pub use geometries::Lattice;
pub use geometries::LatticeGeometry;
pub use geometries::LatticeKind;
pub use geometries::LatticeMetrics;
pub use geometries::LatticeStyle;
pub use geometries::OctahedronGeometry;
pub use geometries::ParametricGeometry;
pub use geometries::PlaneGeometry;
pub use geometries::PolygonGeometry;
pub use geometries::PolyhedronGeometry;
pub use geometries::QuadGeometry;
pub use geometries::Region;
pub use geometries::RingGeometry;
pub use geometries::ScaleRich;
pub use geometries::ScaleRichAngles;
pub use geometries::ScaleRichLigament;
pub use geometries::ScaleRichNet;
pub use geometries::SeedLayout;
pub use geometries::SolidMaterial;
pub use geometries::Solver;
pub use geometries::SphereGeometry;
pub use geometries::Stiffness;
pub use geometries::Stochastic;
pub use geometries::Strength;
pub use geometries::Strut;
pub use geometries::TetrahedronGeometry;
pub use geometries::TextGeometry;
pub use geometries::TorusGeometry;
pub use geometries::TorusKnotGeometry;
pub use geometries::Tpms;
pub use geometries::TubeGeometry;
pub use geometries::WireframeGeometry;
pub use geometries::KIRIGAMI_NET_VARIANT;
pub use helpers::ArrowHelper;
pub use helpers::AxesHelper;
pub use helpers::BoxHelper;
pub use helpers::CameraHelper;
pub use helpers::DirectionalLightHelper;
pub use helpers::GridHelper;
pub use helpers::HemisphereLightHelper;
pub use helpers::PointLightHelper;
pub use helpers::PolarGridHelper;
pub use helpers::SkeletonHelper;
pub use helpers::SpotLightHelper;
pub use helpers::VertexNormalsHelper;
pub use helpers::VertexTangentsHelper;
pub use lights::AmbientLight;
pub use lights::DirectionalLight;
pub use lights::HemisphereLight;
pub use lights::Light;
pub use lights::PointLight;
pub use lights::RectAreaLight;
pub use lights::ShadowSettings;
pub use lights::ShadowType;
pub use lights::SpotLight;
pub use loaders::AlembicArchive;
pub use loaders::AlembicError;
pub use loaders::ColladaError;
pub use loaders::ColladaLoader;
pub use loaders::DracoError;
pub use loaders::DracoHeader;
pub use loaders::ExrError;
pub use loaders::ExrLoader;
pub use loaders::FbxError;
pub use loaders::FbxLoader;
pub use loaders::FbxScene;
pub use loaders::GcodeLoader;
pub use loaders::GcodeToolpath;
pub use loaders::GltfError;
pub use loaders::GltfImages;
pub use loaders::GltfLoader;
pub use loaders::GltfScene;
pub use loaders::HdrError;
pub use loaders::HdrLoader;
pub use loaders::Ktx2;
pub use loaders::Ktx2Error;
pub use loaders::MeshoptError;
pub use loaders::ObjLoader;
pub use loaders::PlyLoader;
pub use loaders::PolyMesh;
pub use loaders::StlLoader;
pub use loaders::TtfError;
pub use loaders::TtfFont;
pub use loaders::TtfGlyph;
pub use origami::book_cardinal_cp;
pub use origami::book_cardinal_stages;
pub use origami::classic_bird_cp;
pub use origami::classic_bird_stages;
pub use origami::eagle_cp;
pub use origami::eagle_stages;
pub use origami::frog_cp;
pub use origami::frog_stages;
pub use origami::giang_cardinal_cp;
pub use origami::giang_cardinal_stages;
pub use origami::AssembledBird;
pub use origami::Assignment;
pub use origami::BirdKind;
pub use origami::BookCardinalStage;
pub use origami::ClassicBirdStage;
pub use origami::ClosureReport;
pub use origami::CreasePattern;
pub use origami::Degree4;
pub use origami::EagleStage;
pub use origami::Edge;
pub use origami::EdgeKind;
pub use origami::FoldedBirdPart;
pub use origami::FoldedState;
pub use origami::FrogStage;
pub use origami::GiangCardinalStage;
pub use origami::PartPose;
pub use origami::VertexMode;
pub use origami::TWIST_ALPHA;
pub use loaders::scene_to_glb;
pub use loaders::scene_to_gltf;
pub use loaders::GltfExportOptions;
pub use materials::MirrorMaterial;
pub use materials::AtmosphereMaterial;
pub use materials::BasicMaterial;
pub use materials::DepthMaterial;
pub use materials::LambertMaterial;
pub use materials::LineBasicMaterial;
pub use materials::MatcapMaterial;
pub use materials::Material;
pub use materials::MaterialKind;
pub use materials::MaterialTextureSlots;
pub use materials::NormalMaterial;
pub use materials::PhongMaterial;
pub use materials::PhysicalMaterial;
pub use materials::PointsMaterial;
pub use materials::ShaderMaterial;
pub use materials::SpriteMaterial;
pub use materials::StandardMaterial;
pub use materials::ToonMaterial;
pub use materials::TransparencyMode;
pub use materials::Blending;
pub use materials::DepthFunc;
pub use materials::RenderState;
pub use nurbs::NurbsCurve;nurbs
pub use nurbs::NurbsSurface;nurbs
pub use nurbs::TessellationOptions;nurbs
pub use postprocessing::BloomPass;render
pub use postprocessing::CopyPass;render
pub use postprocessing::EffectComposer;render
pub use postprocessing::FilmPass;render
pub use postprocessing::FxaaPass;render
pub use postprocessing::GlitchPass;render
pub use postprocessing::OutlinePass;render
pub use postprocessing::OutputPass;render
pub use postprocessing::Pass;render
pub use postprocessing::RenderPass;render
pub use postprocessing::ShaderPass;render
pub use postprocessing::SsaoPass;render
pub use postprocessing::SsrPass;render
pub use postprocessing::UnrealBloomPass;render
pub use renderer::headless::GpuVendor;render and non-WebAssembly
pub use renderer::headless::HeadlessBuilder;render and non-WebAssembly
pub use renderer::headless::HeadlessConfig;render and non-WebAssembly
pub use renderer::headless::HeadlessRenderer;render and non-WebAssembly
pub use renderer::headless::MappedFrame;render and non-WebAssembly
pub use renderer::halton;render
pub use renderer::stratified_jitter;render
pub use renderer::RenderBackend;render
pub use renderer::RenderTarget;render
pub use renderer::Renderer;render
pub use renderers::svg_from_rgba;
pub use renderers::Css2dRenderer;
pub use renderers::Css3dRenderer;
pub use renderers::SvgOptions;
pub use renderers::SvgRenderer;
pub use renderers::SvgShading;
pub use scene::Scene;
pub use stats::Stats;
pub use textures::pack_rgba16f;
pub use textures::AstcBlock;
pub use textures::Compression;
pub use textures::CubeTexture;
pub use textures::DataTexture;
pub use textures::DepthTexture;
pub use textures::Texture;
pub use textures::TextureFilter;
pub use textures::TextureFormat;
pub use textures::TextureWrap;
pub use utils::png::decode_png;
pub use utils::png::encode_png;
pub use utils::png::encode_png_with_dpi;
pub use utils::png::PngImage;
pub use volume::Data3DTexture;render
pub use time_smear::TimeSmear;
pub use utils::center as center_geometry;
pub use utils::compute_tangents;
pub use utils::compute_vertex_normals;
pub use utils::merge_geometries;
pub use utils::scale as scale_geometry;
pub use mesh_bvh::BuildOptions as MeshBvhBuildOptions;mesh-bvh
pub use mesh_bvh::BvhHit;mesh-bvh
pub use mesh_bvh::BvhNodeView;mesh-bvh
pub use mesh_bvh::MeshBvh;mesh-bvh
pub use mesh_bvh::SerializedMeshBvh;mesh-bvh
pub use mesh_bvh::AVERAGE;mesh-bvh
pub use mesh_bvh::CENTER;mesh-bvh
pub use mesh_bvh::CONTAINED;mesh-bvh
pub use mesh_bvh::INTERSECTED;mesh-bvh
pub use mesh_bvh::NOT_INTERSECTED;mesh-bvh
pub use mesh_bvh::SAH;mesh-bvh
pub use raytrace::intersect_box;raytrace
pub use raytrace::Aov;raytrace
pub use raytrace::BackgroundMode;raytrace
pub use raytrace::CpuBackend;raytrace
pub use raytrace::RaytraceBackend;raytrace
pub use raytrace::RaytraceError;raytrace
pub use raytrace::RaytraceRenderer;raytrace
pub use raytrace::RaytraceScene;raytrace
pub use raytrace::RaytraceSettings;raytrace
pub use csg::evaluate_hierarchy;bvh-csg
pub use csg::CsgBrush;bvh-csg
pub use csg::CsgEvaluator;bvh-csg
pub use csg::CsgNode;bvh-csg
pub use csg::CsgOperation;bvh-csg
pub use csg::CsgOperationGroup;bvh-csg
pub use csg::TriangleIntersection;bvh-csg
pub use csg::ADDITION;bvh-csg
pub use csg::DIFFERENCE;bvh-csg
pub use csg::HOLLOW_INTERSECTION;bvh-csg
pub use csg::HOLLOW_SUBTRACTION;bvh-csg
pub use csg::INTERSECTION;bvh-csg
pub use csg::REVERSE_SUBTRACTION;bvh-csg
pub use csg::SUBTRACTION;bvh-csg
pub use exact_csg::report::mesh_report;openscad
pub use exact_csg::report::DefectCluster;openscad
pub use exact_csg::report::MeshReport;openscad
pub use openscad::export::geometry_to_3mf;openscad
pub use openscad::export::geometry_to_glb;openscad
pub use openscad::export::geometry_to_obj;openscad
pub use openscad::export::geometry_to_off;openscad
pub use openscad::export::geometry_to_ply;openscad
pub use openscad::export::parts_to_glb;openscad
pub use openscad::freecad::fcstd_meshes;openscad
pub use openscad::freecad::fcstd_to_geometry;openscad
pub use openscad::freecad::fcstd_to_solid;openscad
pub use openscad::freecad::geometry_to_fcstd;openscad
pub use openscad::freecad::geometry_to_fcstd_with;openscad
pub use openscad::freecad::parse_mesh_kernel;openscad
pub use openscad::freecad::parse_mesh_kernel_full;openscad
pub use openscad::freecad::parts_to_fcstd;openscad
pub use openscad::freecad::parts_to_fcstd_with;openscad
pub use openscad::freecad::FcstdDocument;openscad
pub use openscad::freecad::FcstdDocumentMeta;openscad
pub use openscad::freecad::FcstdError;openscad
pub use openscad::freecad::FcstdLoader;openscad
pub use openscad::freecad::FcstdMesh;openscad
pub use openscad::freecad::FcstdMeshSpec;openscad
pub use openscad::freecad::FcstdPlacement;openscad
pub use openscad::freecad::FcstdReadOptions;openscad
pub use openscad::freecad::FcstdSkipped;openscad
pub use openscad::freecad::FcstdWriteOptions;openscad
pub use openscad::freecad::FcstdWriteReport;openscad
pub use openscad::freecad::FcstdWriter;openscad
pub use openscad::mechanism::DriveSpec;openscad
pub use openscad::mechanism::MateSpec;openscad
pub use openscad::mechanism::MateSpecKind;openscad
pub use openscad::mechanism::MechanismSpec;openscad
pub use openscad::mechanism::PartFit;openscad
pub use openscad::mechanism::PartSpec;openscad
pub use openscad::scad::clear_files;openscad
pub use openscad::scad::parse_scad;openscad
pub use openscad::scad::parse_scad_at;openscad
pub use openscad::scad::parse_scad_file;openscad
pub use openscad::scad::parse_scad_file_at;openscad
pub use openscad::scad::parse_scad_file_for_parts;openscad
pub use openscad::scad::parse_scad_file_with;openscad
pub use openscad::scad::parse_scad_mechanism;openscad
pub use openscad::scad::parse_scad_mechanism_at;openscad
pub use openscad::scad::parse_scad_mechanism_file;openscad
pub use openscad::scad::parse_scad_mechanism_file_at;openscad
pub use openscad::scad::parse_scad_with;openscad
pub use openscad::scad::parse_scad_with_base;openscad
pub use openscad::scad::register_file;openscad
pub use openscad::scad::scad_file_values;openscad
pub use openscad::scad::scad_value;openscad
pub use openscad::scad::scad_values;openscad
pub use openscad::scad::scad_values_in;openscad
pub use openscad::schematic::schematic_project;openscad
pub use openscad::schematic::schematic_project_view;openscad
pub use openscad::schematic::schematic_to_rgba;openscad
pub use openscad::schematic::schematic_to_svg;openscad
pub use openscad::schematic::Schematic;openscad
pub use openscad::schematic::SchematicOptions;openscad
pub use openscad::schematic::View;openscad
pub use openscad::build_nema17;openscad
pub use openscad::build_printer;openscad
pub use openscad::cone;openscad
pub use openscad::cube;openscad
pub use openscad::cylinder;openscad
pub use openscad::difference_all;openscad
pub use openscad::frustum;openscad
pub use openscad::geometry_bounds;openscad
pub use openscad::geometry_to_stl;openscad
pub use openscad::hull;openscad
pub use openscad::intersection_all;openscad
pub use openscad::linear_extrude;openscad
pub use openscad::linear_extrude_holes;openscad
pub use openscad::polyhedron;openscad
pub use openscad::rotate_extrude;openscad
pub use openscad::rotate_extrude_fn;openscad
pub use openscad::set_origin;openscad
pub use openscad::solid;openscad
pub use openscad::sphere;openscad
pub use openscad::sphere_fn;openscad
pub use openscad::union_all;openscad
pub use openscad::Origin;openscad
pub use openscad::Solid;openscad
pub use planet::generate_earth_maps;planet
pub use planet::generate_starfield;planet
pub use planet::Atmosphere;planet
pub use planet::HeightField;planet
pub use planet::MapBuffer;planet
pub use planet::Planet;planet
pub use planet::PlanetHandles;planet
pub use planet::PlanetMaps;planet
pub use planet::Starfield;planet
pub use planet::EarthTextures;planet and non-WebAssembly
pub use planet::MapSources;planet and non-WebAssembly
pub use threers_audio as audio;audio
pub use wgpu;render
pub use threers_codec as codec;native-codec

Modules§

animation
Keyframe animation. Mirrors three.js’s AnimationClip / AnimationMixer / AnimationAction / KeyframeTrack model.
assemblyassembly-check
Generic checks for assemblies that move.
brepbrep
Analytic surface provenance — every triangle knows what it came from.
cameras
Cameras: position/orientation in world space plus a projection matrix.
captionscaptions
Subtitles and captions — a timed-text track you can burn into exported video, ship as a sidecar .srt/.vtt, mux as a soft subtitle track, or draw on screen over a live render.
controls
Camera + interaction controls.
core
Scene-graph and geometry primitives.
csgbvh-csg
Constructive solid geometry — Rust port of three-bvh-csg@0.0.16.
curves
Parametric curves. Mirror three.js’s curve hierarchy: Curve base + 2D and 3D concretes + CurvePath/Path/Shape.
easing
Easing curves.
exact_csgopenscad
Robust mesh-arrangement boolean kernel — the watertight path that replaces the three-bvh-csg float kernel for OpenSCAD-parity work.
exporters
Mesh exporters — Wavefront OBJ, STL (ASCII and binary) and Stanford PLY (ASCII and binary) — written to match three.js r165’s examples/jsm/exporters/{OBJ,STL,PLY}Exporter.js byte for byte.
extras
Extras — algorithms ported from three.js’s examples/jsm/utils, examples/jsm/animation, etc.
fluidfluid or metal-fluid
An interactive 2D fluid, on the GPU.
fur
Fur by shells: a mesh drawn as a stack of offset copies of itself, each cut down to the cross-sections of procedural strands.
fx
Interactive effects on 2D elements: glossy liquids that react to the pointer, on buttons, figures and anything else with a shape.
geometries
Built-in geometry generators, mirroring three.js’s geometry module.
gpurender
Getting a device, and the limits you have to ask for.
helpers
Visual debug helpers.
kinematics
Inverse kinematics, servo physics, and gear-train simulation.
lights
Lights. Mirror three.js’s light hierarchy: ambient, directional, point, spot, hemisphere, rect-area. Lights live in the scene graph as ObjectKind::Light variants and contribute to the renderer’s per-frame lighting uniform buffer.
loaders
Asset loaders. Hand-written parsers, zero binary-crate deps.
marksrender
Data-driven marks: points, lines, arcs, instanced shapes, text labels and density fields, drawn from columns of per-instance data.
materials
Materials. Mirrors three.js’s Material family, including ShaderMaterial for custom WGSL fragments.
math
Math primitives. Mirrors three.js’s math module.
mesh_bvhmesh-bvh
BVH-accelerated raycasting for BufferGeometry (three-mesh-bvh compatible).
nurbsnurbs
NURBS curves and surfaces — the surface primitive the B-rep layer stands on.
openscadopenscad
OpenSCAD-style solid modeling front end (Cargo feature openscad).
origami
Rigid origami from a planar crease pattern.
overlay
Immediate-mode 2D drawing over the 3D view — p5’s rect, circle, line and text, for HUDs, labels, axes, plots and debug read-outs.
particles
Particles: emitters, a physical simulation, and the things built on it — falling and settling snow, pouring and drifting sand, and presets for fire, smoke, sparks, rain, dust and fountains.
planetplanet
Planets, moons and starfields — behind the planet feature.
postprocessingrender
Post-processing: three.js’s EffectComposer and its passes.
prelude
One import for the things nearly every scene uses.
raytraceraytrace
A physically-based path tracer, beside the rasteriser rather than inside it.
rendererrender
wgpu rendering: scene traversal, material pipelines, shadows, and post-fx.
renderers
Alternate renderers. The primary Renderer lives in crate::renderer and uses wgpu. This module exposes lightweight DOM-overlay renderers (CSS2D / CSS3D) — their drawing surface is HTML, so on native they are data-only descriptors that an integrator can pump into web_sys when compiled for wasm — plus SvgRenderer, which produces a complete SVG document and so needs no host at all.
scene
sdf
Signed distance fields: primitives, the operators that join them, and the same library in WGSL so a shader and the CPU agree on every shape.
sketchwinit_window
A window, a scene and a loop, in one call — p5’s setup/draw.
stats
Stats panel data. Mirrors three.js’s Stats (FPS + frame time + memory ring buffers). DOM rendering is left to the integrator; this struct just tracks the running averages.
stepstep
STEP — ISO 10303 AP203/AP214 advanced B-rep exchange.
strict_float
IEEE float arithmetic in GPU shaders, for bit-level comparisons.
textures
Texture sources. CPU-side: own the pixel data (or a reference to it) plus sampler/format metadata. The renderer uploads them on demand and caches the resulting wgpu::Texture by Arc pointer identity.
time_smear
Time smear: every moving thing gets echoes of itself at other moments in time — before it arrives as well as after it has gone.
utils
Helper utilities mirroring three.js’s BufferGeometryUtils and assorted stand-alone math helpers (centroid, merge, normal/tangent computation).
viewsrender
Many cameras at once: named cameras, viewed side by side or one at a time, switched or blended between, and seen as textures — on a screen in the scene, inside another view, or inside themselves.
volumerender
Volumes: 3D textures, and cross-sections through them.
wgsl
WGSL with its comments and spare blanks taken out at compile time.

Macros§

differenceopenscad
n-ary difference — difference![base, hole1, hole2] (base − rest…), or difference!(vec_of_solids).
hullopenscad
Convex hull of solids — hull![a, b, c] or hull!(vec_of_solids).
intersectionopenscad
n-ary intersection — intersection![a, b, c] or intersection!(vec_of_solids).
logNon-WebAssembly
passes
Write full-screen passes once for wgpu and the native Metal backend. See shared_passes.
scadopenscad
Build a Solid from an OpenSCAD-shaped tree. See the module docs for the grammar.
shader
Write a shader once for wgpu and the native Metal backend. See shared_shader.
shader_functions
Write shader functions once for wgpu and the native Metal backend. See ShaderFunctions.
unionopenscad
n-ary union — union![a, b, c] or union!(vec_of_solids).
visionos_app
Makes an [xr::App] the Apple Vision Pro app: exports threers_app_run, which the SwiftUI shell (templates/visionos-app) calls with its CompositorLayer’s layer renderer, to run the app with xr::visionos::run. Expands to nothing on other targets, so the crate still builds (and tests) on a Mac.
wgsl
A constant WGSL source — a literal, include_str!, concat! of those, or any other constant &str expression — as a &'static str without its comments, stripped at compile time (see wgsl!).

Structs§

AnimationEncodeOptionsnative-codec
Options for encode_animation_rgba.
AnimationExportProgressnative-codec
Progress tick for browser animation encoding.
ApngEncodernative-codec
Builds an APNG from RGBA frames.
Audioaudio
Non-positional audio source. Holds shared PCM data and playback parameters.
AudioAnalyseraudio
Convenience helper computing FFT-band magnitudes from raw samples. Mirrors three.js’s AudioAnalyser for the things downstream code uses (visualizer bar heights, beat detection, etc.). The actual FFT is left to the caller — this struct just holds the result vector and provides convenience accessors.
AudioListeneraudio
Receiver of positional audio. One per scene; the renderer (or the user) updates position/forward/up to match the camera each frame.
Box2
Axis-aligned bounding box in 2D. Mirrors three.js’s Box2.
Box3
Axis-aligned bounding box in 3D. Mirrors three.js’s Box3.
CaptionStylecaptions
Look, placement, and wrapping of burned-in / on-screen captions.
CaptionTrackcaptions
An ordered list of Cues plus the metadata a subtitle track carries.
Color
ColorParseError
What went wrong parsing a CSS colour.
ColorRamp
A gradient: colours at positions, blended between.
ColorScale
A mapping from numbers to colours.
Cuecaptions
One timed caption: a time range plus the text shown during it.
Cylindrical
Cylindrical coordinates (radius around Y, theta around Y, height y). Matches three.js’s Cylindrical.
Euler
Euler angles in radians plus their axis order — three.js’s Euler.
Frustum
View frustum as six planes (right, left, bottom, top, far, near). Mirrors three.js’s Frustum.
GifDecodergif
Indexed GIF reader with lazy or eager frame decoding.
GifEncodergif
Builds an animated GIF from RGBA frames.
GifFramegif
One composited full-canvas frame.
GifFrameMetagif
Per-frame descriptor metadata (before LZW decode / compositing).
GifInfogif
Logical-screen metadata from a GIF file.
GifOptionsgif
Tunables for GifEncoder / GifWriter / encode_gif.
GifWritergif
Incremental GIF writer using per-frame local palettes.
H264Encodernative-codec
A from-scratch H.264 encoder (IDR-only, I_PCM).
HevcEncodernative-codec
A from-scratch HEVC encoder (milestone 3: IDR-only, I_PCM).
Line3
Line segment in 3D. Mirrors three.js’s Line3.
Matrix3
A 3x3 column-major matrix (same layout as three.js’s Matrix3).
Matrix4
A 4x4 column-major matrix (same layout as three.js’s Matrix4).
NoopBackendaudio
Palette
Distinct colours for categories: d3’s scaleOrdinal with a scheme. Not interpolated — category 3 is the fourth colour, and past the end the colours repeat.
Plane
Plane in Hessian-normal form: dot(normal, p) + constant == 0. Mirrors three.js’s Plane.
PositionalAudioaudio
Spatial audio source. Inherits all Audio parameters plus a distance model. Attach one with Object3D::audio in threers; it points along the node’s +Z, as in three.js.
Quaternion
Ray
Mirrors three.js’s Ray.
Reconstructionnative-codec
Reconstruction a conformant decoder produces.
SpatialMixaudio
How a source sounds from a listener.
Sphere
Bounding sphere. Mirrors three.js’s math::Sphere (distinct from SphereGeometry).
Spherical
Spherical coordinates with phi from +Y (polar) and theta around Y (azimuth). Matches three.js’s Spherical.
TransparentEncodernative-codec
Encodes transparent frames and muxes them into an Apple-compatible container.
Triangle
Mirrors three.js’s Triangle.
Vector2
Vector3
Vector4
WebmFramenative-codec
One coded frame to place in the stream.
WebmParamsnative-codec
Parameters for mux_webm.
Yuv420Framenative-codec
A planar 4:2:0 (yuv420p) picture at display resolution. width/height must be even (chroma is subsampled 2×2). y is width × height; u/v are (width/2) × (height/2).

Enums§

AnimationEncodeErrornative-codec
Errors produced while encoding a browser animation.
AnimationExportPhasenative-codec
Progress phase for encode_animation_rgba_with_progress.
BrowserCodecnative-codec
Browser-friendly animation containers (no ffmpeg).
CaptionAligncaptions
Horizontal alignment of caption lines within the caption box.
CaptionAnchorcaptions
Which edge of the frame the caption block is anchored to.
CaptionErrorcaptions
Why parsing a subtitle file failed.
CaptionFormatcaptions
Timed-text file format.
ColorSpace
A space to interpolate colours in — see Color::mix.
DisposalMethodgif
How the decoder treats the canvas after displaying a frame (GCE field).
DisposalModegif
How a frame’s pixels are disposed before the following frame.
DistanceModelaudio
How gain falls with distance: the three models of Web Audio’s PannerNode, which three.js’s PositionalAudio hands them to.
EulerOrder
The axis order of an Euler — three.js’s 'XYZ', 'YXZ', … — naming the intrinsic rotation order: XYZ rotates about X, then the new Y, then the new Z, i.e. the matrix Rx · Ry · Rz.
GifErrorgif
Why a GIF could not be decoded.
GifVersiongif
GIF version from the six-byte signature.
LzwClearModegif
Policy used to clear the GIF LZW dictionary during compression.
PaletteModegif
How the color table(s) are chosen.
QuantizerKindgif
Quantization algorithm for reducing opaque colors.
ScaleKind
How a ColorScale turns a value into a position on its ramp.
SchemeKind
What a named scheme is for.
ToneMapping
How the renderer compresses linear HDR radiance into displayable range.
WebmCodecnative-codec
The video codec carried by the track (selects the Matroska CodecID).

Traits§

AudioBackendaudio
Audio playback backend. The default NoopBackend does nothing; users can plug in cpal/rodio natively or web_sys::AudioContext on wasm by implementing this trait themselves.

Functions§

decode_gifgif
Decode an entire GIF into logical-screen metadata and composited RGBA frames.
encode_animation_rgbanative-codec
Encode tightly-packed RGBA8 frames into a browser-friendly animation.
encode_animation_rgba_with_progressnative-codec
Like encode_animation_rgba, with encode-phase progress callbacks.
encode_gifgif
Encode RGBA frames to a GIF byte stream (same options as GifEncoder).
encode_gray_webmnative-codec
Encode frame_count solid mid-gray VP9 keyframes and mux them into a .webm. Uses the native crate::vp9 encoder — no ffmpeg, no C bindings — so it runs on native and wasm32.
encode_inter_framenative-codec
Encode a P-frame with per-block SAD motion search + 4×4 DCT residual.
encode_inter_frame_altrefnative-codec
Like encode_inter_frame_golden, also allowing ALTREF per block.
encode_inter_frame_compoundnative-codec
Like encode_inter_frame_altref, but every block is LAST+ALTREF compound (REFERENCE_MODE = compound; prediction is the average of the two refs).
encode_inter_frame_goldennative-codec
Like encode_inter_frame, but each block may also predict from golden.
encode_inter_frame_refreshnative-codec
LAST-only ME P-frame with a custom refresh_frame_flags bitmask.
encode_inter_newmv_residualnative-codec
Encode a NEWMV P-frame with 4×4 DCT residual against LAST.
encode_inter_newmv_skipnative-codec
Encode a showable P-frame: NEWMV + skip with a constant MV in 1/8-pel luma.
encode_inter_residualnative-codec
Encode a ZEROMV P-frame with 4×4 DCT residual against LAST.
encode_inter_zeromv_skipnative-codec
Encode a showable P-frame that copies reference (ZEROMV + skip on LAST).
encode_intra_framenative-codec
Encode one VP9 intra keyframe (4×4 DCT residual). Returns (bitstream, recon).
encode_intra_graynative-codec
Encode a solid-gray VP9 intra keyframe of width × height (currently only 64×64 — a single superblock — is supported).
encode_mp4native-codec
Encode frames of YUV420 pictures into an MP4 byte stream.
encode_mp4_with_captionsnative-codec
Like encode_mp4, optionally muxing a soft tx3g caption track.
encode_webmnative-codec
Encode VP9 keyframes from planar YUV (optional alpha) and mux into a .webm.
format_animation_progressnative-codec
Ready-to-display animation progress line.
mux_webmnative-codec
Mux the frames into a single-track .webm byte stream.

Type Aliases§

DecodedFrameDeprecatedgif
The old name of GifFrame.
RampSpace
How a ramp blends between its stops: any ColorSpace. OkLab by default — perceptually even, the midpoint of two colours the one a person would name; linear light is right for a ramp standing in for light; sRGB is what CSS gradients and d3’s default do; OkLCh and LCh keep a ramp between saturated colours saturated.