#![cfg_attr(target_arch = "wasm32", allow(clippy::arc_with_non_send_sync))]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![allow(clippy::new_ret_no_self)]
#![allow(clippy::too_many_arguments)]
#[allow(unused_macros)] macro_rules! cfg_metal {
($($item:item)*) => {
$(
#[cfg(metal_backend)]
$item
)*
};
}
#[allow(unused_macros)] macro_rules! cfg_apple {
($($item:item)*) => {
$(
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "visionos"))]
$item
)*
};
}
#[allow(unused_macros)] macro_rules! cfg_no_metal {
($($item:item)*) => {
$(
#[cfg(not(metal_backend))]
$item
)*
};
}
#[allow(unused_macros)] macro_rules! on_metal {
($($body:tt)*) => {
#[cfg(metal_backend)]
{
$($body)*
}
};
}
pub mod animation;
#[cfg(feature = "assembly-check")]
pub mod assembly;
#[cfg(feature = "audio")]
pub use threers_audio as audio;
pub mod cameras;
#[cfg(feature = "captions")]
pub mod captions;
pub mod controls;
pub mod core;
pub mod curves;
pub mod exporters;
pub mod extras;
pub mod fur;
pub mod fx;
pub use fur::{FurGroom, FurMaterial};
pub mod geometries;
pub mod helpers;
pub mod kinematics;
pub mod lights;
pub mod loaders;
#[cfg(feature = "render")]
pub mod marks;
pub mod materials;
pub mod math;
pub mod origami;
pub mod particles;
#[cfg(feature = "render")]
pub mod postprocessing;
#[cfg(feature = "splats")]
pub mod splats;
pub mod prelude;
pub mod renderers;
pub mod scene;
pub mod sdf;
#[cfg(feature = "softbody")]
pub mod softbody;
pub mod stats;
pub mod textures;
pub mod utils;
#[cfg(feature = "render")]
pub mod volume;
pub mod wgsl;
pub use threers_math::easing;
pub mod overlay;
#[cfg(feature = "render")]
pub mod renderer;
#[cfg(winit_window)]
pub mod sketch;
#[cfg(feature = "render")]
pub mod views;
#[cfg(feature = "ui")]
pub mod ui;
#[cfg(feature = "ui")]
pub use threers_ui::{style, ui};
#[cfg(feature = "render")]
pub mod gpu;
pub mod strict_float;
#[cfg(feature = "xr")]
pub mod xr;
#[macro_export]
macro_rules! visionos_app {
($app:ty) => {
#[cfg(target_os = "visionos")]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn threers_app_run(layer_renderer: *mut ::core::ffi::c_void) {
unsafe { $crate::xr::visionos::run::<$app>(layer_renderer) }
}
};
}
#[cfg(all(
target_arch = "wasm32",
feature = "render",
not(threers_no_js_bindings)
))]
pub mod wasm;
#[cfg(all(target_arch = "wasm32", feature = "bvh-csg"))]
pub mod wasm_csg;
#[cfg(all(target_arch = "wasm32", feature = "raytrace"))]
pub mod wasm_denoise;
#[cfg(all(
target_arch = "wasm32",
feature = "raytrace",
not(threers_no_js_bindings)
))]
pub mod wasm_pathtrace;
#[cfg(metal_core)]
pub mod metal;
#[cfg(all(
feature = "nvidia",
any(target_os = "linux", target_os = "windows"),
target_pointer_width = "64"
))]
pub use threers_codec::nvidia;
#[cfg(all(feature = "vaapi", target_os = "linux"))]
pub use threers_codec::vaapi;
#[cfg(all(feature = "videotoolbox", target_os = "macos"))]
pub use threers_codec::videotoolbox;
#[cfg(all(
feature = "videotoolbox",
feature = "native-decode",
target_os = "macos"
))]
pub use threers_codec::videotoolbox_decode;
#[cfg(feature = "mesh-bvh")]
pub mod mesh_bvh;
#[cfg(feature = "raytrace")]
pub mod raytrace;
#[cfg(feature = "bvh-csg")]
pub mod csg;
#[cfg(feature = "openscad")]
pub mod openscad;
#[cfg(feature = "planet")]
pub mod planet;
#[cfg(any(feature = "fluid", feature = "metal-fluid"))]
pub mod fluid;
#[cfg(feature = "nurbs")]
pub mod nurbs;
#[cfg(feature = "brep")]
pub mod brep;
#[cfg(feature = "step")]
pub mod step;
#[cfg(feature = "openscad")]
pub mod exact_csg;
#[cfg(any(feature = "rlx", feature = "rlx-geo"))]
pub mod rlx;
#[cfg(target_arch = "wasm32")]
#[macro_export]
macro_rules! log {
($($t:tt)*) => {{
let s = format!($($t)*);
web_sys::console::log_1(&wasm_bindgen::JsValue::from_str(&s));
}};
}
#[cfg(not(target_arch = "wasm32"))]
#[macro_export]
macro_rules! log {
($($t:tt)*) => {{ eprintln!($($t)*); }};
}
pub use animation::{
AnimationAction, AnimationClip, AnimationMixer, Interpolation, KeyframeTrack, TrackTarget,
};
#[cfg(feature = "audio")]
pub use audio::{
Audio, AudioAnalyser, AudioBackend, AudioListener, DistanceModel, NoopBackend, PositionalAudio,
SpatialMix,
};
#[cfg(feature = "brep")]
pub use brep::{retessellate, Surface, SurfaceTable};
pub use cameras::{Camera, OrthographicCamera, PerspectiveCamera, ScreenProjector, ViewOffset};
#[cfg(feature = "captions")]
pub use captions::{
CaptionAlign, CaptionAnchor, CaptionError, CaptionFont, CaptionFormat, CaptionOverlay,
CaptionPainter, CaptionStyle, CaptionTrack, Cue,
};
pub use controls::{
ArcballControls, DragControls, FirstPersonControls, GlobeControls, MapControls, OrbitControls,
PointerEvent, PointerLockControls, TrackballControls,
};
pub use core::{
Bone, BufferAttribute, BufferGeometry, Clock, InstancedMesh, Intersection, Layers,
LineSegments, Mesh, MorphAttributes, MorphTarget, Object3D, ObjectArena, ObjectId, ObjectKind,
Points, Raycaster, Skeleton, SkinnedMesh, Sprite, DEFAULT_INFER_QUADS_ANGLE,
};
pub use curves::{
parse_svg_subpaths, segments_to_path_data, CatmullRomCurve3, CubicBezierCurve,
CubicBezierCurve3, Curve2, Curve3, CurvePath, EllipseCurve, LineCurve, LineCurve3, NURBSCurve,
NURBSSurface, Path, PathSegment, QuadraticBezierCurve, QuadraticBezierCurve3, Shape,
SplineCurve, SvgPathError,
};
pub use extras::{
CcdIkSolver, IkBone, MarchingCubes, Octree, PmremGenerator, SimplexNoise, PMREM_MIP_LEVELS,
};
#[cfg(feature = "nurbs")]
pub use geometries::NurbsGeometry;
pub use geometries::{
BoxGeometry, BoxLineGeometry, CapsuleGeometry, ChiralRule, CircleGeometry, Conductivity,
ConeGeometry, Conform, ConvexGeometry, Cuboct, CuboctAssembly, CuboctAssemblyPlan,
CuboctAssemblyStep, CuboctFrame, CuboctJoint, CuboctJointKind, CylinderGeometry, DecalGeometry,
DodecahedronGeometry, EdgesGeometry, ExtrudeGeometry, Field, FrameMaterial, FrameResponse,
Glyph, Hand, IcosahedronGeometry, Infill, KirigamiAssembly, KirigamiCell, KirigamiCoreLattice,
KirigamiCrease, KirigamiCreaseKind, KirigamiExpandedMiura, KirigamiFace, KirigamiFaceKind,
KirigamiMesh, KirigamiNet, KirigamiNetPanel, KirigamiPreset, LatheGeometry, Lattice,
LatticeGeometry, LatticeKind, LatticeMetrics, LatticeStyle, OctahedronGeometry,
ParametricGeometry, PlaneGeometry, PolygonGeometry, PolyhedronGeometry, QuadGeometry, Region,
RingGeometry, ScaleRich, ScaleRichAngles, ScaleRichLigament, ScaleRichNet, SeedLayout,
SolidMaterial, Solver, SphereGeometry, Stiffness, Stochastic, Strength, Strut,
TetrahedronGeometry, TextGeometry, TorusGeometry, TorusKnotGeometry, Tpms, TubeGeometry,
WireframeGeometry, KIRIGAMI_NET_VARIANT,
};
pub use helpers::{
ArrowHelper, AxesHelper, BoxHelper, CameraHelper, DirectionalLightHelper, GridHelper,
HemisphereLightHelper, PointLightHelper, PolarGridHelper, SkeletonHelper, SpotLightHelper,
VertexNormalsHelper, VertexTangentsHelper,
};
pub use lights::{
AmbientLight, DirectionalLight, HemisphereLight, Light, PointLight, RectAreaLight,
ShadowSettings, ShadowType, SpotLight,
};
pub use loaders::{
AlembicArchive, AlembicError, ColladaError, ColladaLoader, DracoError, DracoHeader, ExrError,
ExrLoader, FbxError, FbxLoader, FbxScene, GcodeLoader, GcodeToolpath, GltfError, GltfImages,
GltfLoader, GltfScene, HdrError, HdrLoader, Ktx2, Ktx2Error, MeshoptError, ObjLoader, PlyLoader, PolyMesh, StlLoader,
TtfError, TtfFont, TtfGlyph,
};
pub use origami::{
book_cardinal_cp, book_cardinal_stages, classic_bird_cp, classic_bird_stages, eagle_cp,
eagle_stages, frog_cp, frog_stages, giang_cardinal_cp, giang_cardinal_stages, AssembledBird,
Assignment, BirdKind, BookCardinalStage, ClassicBirdStage, ClosureReport, CreasePattern,
Degree4, EagleStage, Edge, EdgeKind, FoldedBirdPart, FoldedState, FrogStage,
GiangCardinalStage, PartPose, VertexMode, TWIST_ALPHA,
};
pub use loaders::{scene_to_glb, scene_to_gltf, GltfExportOptions};
pub use materials::MirrorMaterial;
pub use materials::{
AtmosphereMaterial, BasicMaterial, DepthMaterial, LambertMaterial, LineBasicMaterial,
MatcapMaterial, Material, MaterialKind, MaterialTextureSlots, NormalMaterial, PhongMaterial,
PhysicalMaterial, PointsMaterial, ShaderMaterial, SpriteMaterial, StandardMaterial,
ToonMaterial, TransparencyMode,
};
pub use materials::{Blending, DepthFunc, RenderState};
pub use math::{
Box2, Box3, Color, Cylindrical, Euler, EulerOrder, Frustum, Line3, Matrix3, Matrix4, Plane,
Quaternion, Ray, Sphere, Spherical, Triangle, Vector2, Vector3, Vector4,
};
pub use math::{
ColorParseError, ColorRamp, ColorScale, ColorSpace, Palette, RampSpace, ScaleKind, SchemeKind,
};
#[cfg(feature = "nurbs")]
pub use nurbs::{NurbsCurve, NurbsSurface, TessellationOptions};
#[cfg(feature = "render")]
pub use postprocessing::{
BloomPass, CopyPass, EffectComposer, FilmPass, FxaaPass, GlitchPass, OutlinePass, OutputPass,
Pass, RenderPass, ShaderPass, SsaoPass, SsrPass, UnrealBloomPass,
};
#[cfg(all(feature = "render", not(target_arch = "wasm32")))]
pub use renderer::headless::{
GpuVendor, HeadlessBuilder, HeadlessConfig, HeadlessRenderer, MappedFrame,
};
#[cfg(feature = "render")]
pub use wgpu;
pub use math::ToneMapping;
#[cfg(feature = "render")]
pub use renderer::{halton, stratified_jitter, RenderBackend, RenderTarget, Renderer};
pub use renderers::{
svg_from_rgba, Css2dRenderer, Css3dRenderer, SvgOptions, SvgRenderer, SvgShading,
};
pub use scene::Scene;
pub use stats::Stats;
pub use textures::{
pack_rgba16f, AstcBlock, Compression, CubeTexture, DataTexture, DepthTexture, Texture,
TextureFilter, TextureFormat, TextureWrap,
};
pub use utils::png::{decode_png, encode_png, encode_png_with_dpi, PngImage};
#[cfg(feature = "render")]
pub use volume::Data3DTexture;
pub mod time_smear;
pub use time_smear::TimeSmear;
pub use utils::{
center as center_geometry, compute_tangents, compute_vertex_normals, merge_geometries,
scale as scale_geometry,
};
#[cfg(feature = "native-codec")]
pub use codec::animation::{
encode_animation_rgba, encode_animation_rgba_with_progress, format_animation_progress,
AnimationEncodeError, AnimationEncodeOptions, AnimationExportPhase, AnimationExportProgress,
BrowserCodec,
};
#[cfg(feature = "native-codec")]
pub use codec::apng::ApngEncoder;
#[cfg(feature = "gif")]
#[allow(deprecated)]
pub use codec::gif::DecodedFrame;
#[cfg(feature = "gif")]
pub use codec::gif::{
decode_gif, encode_gif, DisposalMethod, DisposalMode, GifDecoder, GifEncoder, GifError,
GifFrame, GifFrameMeta, GifInfo, GifOptions, GifVersion, GifWriter, LzwClearMode, PaletteMode,
QuantizerKind,
};
#[cfg(feature = "native-codec")]
pub use codec::h264::{encode_mp4, encode_mp4_with_captions, H264Encoder};
#[cfg(feature = "native-codec")]
pub use codec::hevc::{HevcEncoder, TransparentEncoder, Yuv420Frame};
#[cfg(feature = "native-codec")]
pub use codec::vp9::{
encode_inter_frame, encode_inter_frame_altref, encode_inter_frame_compound,
encode_inter_frame_golden, encode_inter_frame_refresh, encode_inter_newmv_residual,
encode_inter_newmv_skip, encode_inter_residual, encode_inter_zeromv_skip, encode_intra_frame,
encode_intra_gray, Reconstruction,
};
#[cfg(feature = "native-codec")]
pub use codec::webm::{encode_gray_webm, encode_webm, mux_webm, WebmCodec, WebmFrame, WebmParams};
#[cfg(feature = "native-codec")]
pub use threers_codec as codec;
#[cfg(feature = "mesh-bvh")]
pub use mesh_bvh::{
BuildOptions as MeshBvhBuildOptions, BvhHit, BvhNodeView, MeshBvh, SerializedMeshBvh, AVERAGE,
CENTER, CONTAINED, INTERSECTED, NOT_INTERSECTED, SAH,
};
#[cfg(feature = "raytrace")]
pub use raytrace::{
intersect_box, Aov, BackgroundMode, CpuBackend, RaytraceBackend, RaytraceError,
RaytraceRenderer, RaytraceScene, RaytraceSettings,
};
#[cfg(feature = "bvh-csg")]
pub use csg::{
evaluate_hierarchy, CsgBrush, CsgEvaluator, CsgNode, CsgOperation, CsgOperationGroup,
TriangleIntersection, ADDITION, DIFFERENCE, HOLLOW_INTERSECTION, HOLLOW_SUBTRACTION,
INTERSECTION, REVERSE_SUBTRACTION, SUBTRACTION,
};
#[cfg(feature = "openscad")]
pub use exact_csg::report::{mesh_report, DefectCluster, MeshReport};
#[cfg(feature = "openscad")]
pub use openscad::export::{
geometry_to_3mf, geometry_to_glb, geometry_to_obj, geometry_to_off, geometry_to_ply,
parts_to_glb,
};
#[cfg(feature = "openscad")]
pub use openscad::freecad::{
fcstd_meshes, fcstd_to_geometry, fcstd_to_solid, geometry_to_fcstd, geometry_to_fcstd_with,
parse_mesh_kernel, parse_mesh_kernel_full, parts_to_fcstd, parts_to_fcstd_with, FcstdDocument,
FcstdDocumentMeta, FcstdError, FcstdLoader, FcstdMesh, FcstdMeshSpec, FcstdPlacement,
FcstdReadOptions, FcstdSkipped, FcstdWriteOptions, FcstdWriteReport, FcstdWriter,
};
#[cfg(feature = "openscad")]
pub use openscad::mechanism::{
DriveSpec, MateSpec, MateSpecKind, MechanismSpec, PartFit, PartSpec,
};
#[cfg(feature = "openscad")]
pub use openscad::scad::{
clear_files, parse_scad, parse_scad_at, parse_scad_file, parse_scad_file_at,
parse_scad_file_for_parts, parse_scad_file_with, parse_scad_mechanism, parse_scad_mechanism_at,
parse_scad_mechanism_file, parse_scad_mechanism_file_at, parse_scad_with, parse_scad_with_base,
register_file, scad_file_values, scad_value, scad_values, scad_values_in,
};
#[cfg(feature = "openscad")]
pub use openscad::schematic::{
schematic_project, schematic_project_view, schematic_to_rgba, schematic_to_svg, Schematic,
SchematicOptions, View,
};
#[cfg(feature = "openscad")]
pub use openscad::{build_nema17, build_printer};
#[cfg(feature = "openscad")]
pub use openscad::{
cone, cube, cylinder, difference_all, frustum, geometry_bounds, geometry_to_stl, hull,
intersection_all, linear_extrude, linear_extrude_holes, polyhedron, rotate_extrude,
rotate_extrude_fn, set_origin, solid, sphere, sphere_fn, union_all, Origin, Solid,
};
#[cfg(feature = "planet")]
pub use planet::{
generate_earth_maps, generate_starfield, Atmosphere, HeightField, MapBuffer, Planet,
PlanetHandles, PlanetMaps, Starfield,
};
#[cfg(all(feature = "planet", not(target_arch = "wasm32")))]
pub use planet::{EarthTextures, MapSources};