ENU_FRAME: numberFrame constant for the East-North-Up (ENU) coordinate frame, with X pointing east, Y pointing north, and Z pointing up (away from the ellipsoid surface).
CAMERA_FRAME: numberFrame constant for a camera-convention frame relative to the ENU frame, oriented with "+Y" up and "-Z" forward (matching three.js camera conventions).
OBJECT_FRAME: numberFrame constant for an object-convention frame relative to the ENU frame, oriented with "+Y" up and "+Z" forward (matching three.js object conventions).
extends B3DMLoaderBase
Loader for the legacy 3D Tiles Batched 3D Model (b3dm) format. Parses the b3dm
container and returns a GLTF result with batchTable and featureTable attached
to the resolved scene object.
constructor( manager: LoadingManager )parse(
buffer: ArrayBuffer
): Promise<{scene: Group, scenes: Array, batchTable: BatchTable, featureTable: FeatureTable}>Parses a b3dm buffer and resolves to a GLTF result object extended with legacy
tile metadata. Both model and model.scene receive the extra fields.
extends EventDispatcher
Manages an animated transition between a perspective and an orthographic camera.
During the transition a blended transitionCamera is used. Fires events for the
transition lifecycle and the active camera change.
readonly animating: booleanWhether a transition animation is currently in progress.
readonly alpha: numberTransition progress from 0 (at perspective) to 1 (at orthographic).
readonly camera: CameraThe currently active camera. Returns perspectiveCamera, orthographicCamera, or the
blended transitionCamera depending on the current transition state.
mode: stringThe target camera mode. Set to 'perspective' or 'orthographic' to jump instantly without
animation. Use toggle() to animate the transition.
orthographicPositionalZoom: booleanWhen true, the orthographic camera position is offset backwards along the view direction so it does not clip into terrain. Default is true.
orthographicOffset: numberDistance the orthographic camera is pushed back when orthographicPositionalZoom is true. Default is 50.
fixedPoint: Vector3World-space point that remains visually fixed during the transition.
duration: numberDuration of the animated transition in milliseconds. Default is 200.
autoSync: booleanWhen true, cameras are synced automatically before each update call. Default is true.
easeFunction: functionEasing function applied to the raw transition alpha. Receives and returns a value in [0, 1]. Default is the identity function.
constructor( perspectiveCamera: PerspectiveCamera, orthographicCamera: OrthographicCamera )toggle(): voidBegins an animated transition to the opposite camera mode. Dispatches a 'toggle' event.
update( deltaTime: number ): voidAdvances the transition animation and updates the active camera. Must be called each frame.
syncCameras(): voidSynchronises the non-active camera so that both cameras represent the same viewpoint.
Called automatically by update when autoSync is true.
extends CMPTLoaderBase
Loader for the legacy 3D Tiles Composite (cmpt) format. Parses a cmpt container that bundles multiple b3dm, i3dm, and pnts tiles, returning a scene Group containing all sub-tile scenes.
constructor( manager: LoadingManager )parse( buffer: ArrayBuffer ): Promise<{scene: Group, tiles: Array}>Parses a cmpt buffer and resolves to an object containing a Group with all
sub-tile scenes added as children, and the individual sub-tile results.
Represents a triaxial ellipsoid defined by three semi-axis radii. Used to model planet-scale surfaces such as the Earth (see WGS84_ELLIPSOID). All geographic coordinates use latitude and longitude in radians.
name: stringOptional name for this ellipsoid instance.
radius: Vector3Semi-axis radii of the ellipsoid.
constructor( x = 1: number, y = 1: number, z = 1: number )intersectRay( ray: Ray, target: Vector3 ): Vector3 | nullReturns the point where the given ray intersects the ellipsoid surface, or null if no
intersection exists. Writes the result into target.
getEastNorthUpFrame(
lat: number,
lon: number,
height: number,
target: Matrix4
): Matrix4Returns a Matrix4 representing the East-North-Up (ENU) frame at the given geographic
position: X points east, Y points north, Z points up. Writes the result into target.
getOrientedEastNorthUpFrame(
lat: number,
lon: number,
height: number,
az: number,
el: number,
roll: number,
target: Matrix4
): Matrix4Returns a Matrix4 representing the ENU frame at the given position, rotated by the given
azimuth, elevation, and roll. Equivalent to getObjectFrame with ENU_FRAME.
getObjectFrame(
lat: number,
lon: number,
height: number,
az: number,
el: number,
roll: number,
target: Matrix4,
frame = OBJECT_FRAME: Frames
): Matrix4Returns a Matrix4 representing a frame at the given geographic position, rotated by the
given azimuth, elevation, and roll, and adjusted to match the three.js frame convention.
OBJECT_FRAME orients with "+Y" up and "+Z" forward; CAMERA_FRAME orients with "+Y" up
and "-Z" forward; ENU_FRAME returns the raw ENU-relative rotation.
getCartographicFromObjectFrame(
matrix: Matrix4,
target: Object,
frame = OBJECT_FRAME: Frames
): ObjectExtracts geographic position and orientation (lat, lon, height, azimuth, elevation, roll)
from the given object/camera frame matrix. The inverse of getObjectFrame. Writes the
result into target and returns it.
getEastNorthUpAxes(
lat: number,
lon: number,
vecEast: Vector3,
vecNorth: Vector3,
vecUp: Vector3,
point: Vector3
): voidFills in the east, north, and up unit vectors for the ENU frame at the given latitude and
longitude. Optionally writes the surface position into point.
getCartographicToPosition(
lat: number,
lon: number,
height: number,
target: Vector3
): Vector3Converts geographic coordinates to a 3D Cartesian position on the ellipsoid surface
(plus the given height offset). Writes the result into target and returns it.
getPositionToCartographic( pos: Vector3, target: Object ): ObjectConverts a 3D Cartesian position to geographic coordinates (lat, lon, height). Writes the
result into target and returns it.
getCartographicToNormal( lat: number, lon: number, target: Vector3 ): Vector3Returns the surface normal of the ellipsoid at the given latitude and longitude. Writes the
result into target and returns it.
getPositionToNormal( pos: Vector3, target: Vector3 ): Vector3Returns the surface normal of the ellipsoid at the given 3D Cartesian position. Writes the
result into target and returns it.
getPositionToSurfacePoint( pos: Vector3, target: Vector3 ): Vector3 | nullProjects the given 3D position onto the ellipsoid surface along the geodetic normal.
Returns null if the position is at or near the center. Writes the result into target.
calculateHorizonDistance( latitude: number, elevation: number ): numberReturns the geometric distance to the horizon from the given latitude and elevation above the ellipsoid surface.
calculateEffectiveRadius( latitude: number ): numberReturns the prime vertical radius of curvature (distance from the center of the ellipsoid to the surface along the normal) at the given latitude.
getPositionElevation( pos: Vector3 ): numberReturns the height of the given 3D position above (or below) the ellipsoid surface.
closestPointToRayEstimate( ray: Ray, target: Vector3 ): Vector3Returns an estimate of the closest point on the ellipsoid surface to the given ray. Returns the exact surface intersection point if the ray intersects the ellipsoid.
copy( source: Ellipsoid ): thisCopies the radius from the given ellipsoid into this one.
clone(): EllipsoidReturns a new Ellipsoid with the same radius as this one.
extends EventDispatcher
Camera controls for exploring a 3D environment. Supports drag-to-pan, scroll-to-zoom, right-click-to-rotate, and optional damping/inertia. Works with any Three.js scene.
enabled: booleanWhether the controls are active. When set to false, all input is ignored and inertia is cleared.
cameraRadius: numberMinimum camera distance above the surface in world units. Prevents clipping into terrain. Default is 5.
rotationSpeed: numberRotation sensitivity multiplier. Default is 1.
minAltitude: numberMinimum camera angle above the horizon in radians. Default is 0.
maxAltitude: numberMaximum camera angle above the horizon in radians. Default is 0.45π.
minDistance: numberMinimum zoom distance in world units. Default is 10.
maxDistance: numberMaximum zoom distance in world units. Default is Infinity.
minZoom: numberMinimum orthographic zoom level. Default is 0.
maxZoom: numberMaximum orthographic zoom level. Default is Infinity.
zoomSpeed: numberZoom sensitivity multiplier. Default is 1.
adjustHeight: booleanWhen true, the camera height is automatically adjusted to avoid clipping into the terrain. Default is true.
enableDamping: booleanWhen true, camera movements decelerate gradually after input ends. Default is false.
dampingFactor: numberRate of inertia decay per frame when damping is enabled. Lower values produce longer coasting. Default is 0.15.
fallbackPlane: PlaneFallback plane used for drag/zoom when no scene geometry is hit. Default is the XZ plane (y=0).
useFallbackPlane: booleanWhen true, the fallback plane is used when raycasting misses scene geometry. Default is true.
constructor( scene = null: Object3D, camera = null: Camera, domElement = null: HTMLElement )setScene( scene: Object3D ): voidSets the scene to raycast against for surface-based interaction.
setCamera( camera: Camera ): voidSets the camera to control.
attach( domElement: HTMLElement ): voidAttaches the controls to a DOM element, registering all pointer and keyboard event listeners.
detach(): voidDetaches the controls from the DOM element, removing all event listeners.
getUpDirection( point: Vector3, target: Vector3 ): voidReturns the local up direction at a world-space point. Override to provide terrain-aware
up vectors (e.g. ellipsoid normals). Default returns the controls' up vector.
getCameraUpDirection( target: Vector3 ): voidReturns the local up direction at the camera's current position.
getPivotPoint( target: Vector3 ): Vector3 | nullReturns the current drag or rotation pivot point in world space.
resetState(): voidClears the current interaction state, cancelling any active drag, rotate, or zoom.
setState( state: number, fireEvent = true: boolean ): voidSets the current control state (e.g. NONE, DRAG, ROTATE, ZOOM).
update( deltaTime: number ): voidApplies pending input and inertia to the camera. Must be called each frame.
adjustCamera( camera: Camera ): voidAdjusts the camera to satisfy altitude and distance constraints. Called automatically by update.
Override in subclasses to add custom camera adjustment behaviour (e.g. near/far plane updates).
dispose(): voidDisposes of event listeners and internal resources. Calls detach if currently attached.
extends EnvironmentControls
Camera controls for navigating a globe-shaped tileset. Extends EnvironmentControls with ellipsoid-aware rotation, globe inertia, and automatic near/far plane adjustment.
readonly ellipsoidFrame: Matrix4The world matrix of ellipsoidGroup, representing the ellipsoid's coordinate frame.
readonly ellipsoidFrameInverse: Matrix4The inverse of ellipsoidFrame.
nearMargin: numberFraction of the near plane distance added as a buffer. Default is 0.25.
farMargin: numberFraction of the far plane distance added as a buffer. Default is 0.
globeInertia: QuaternionAccumulated globe rotation inertia quaternion. Applied each frame when globe inertia is active.
globeInertiaFactor: numberMagnitude of the current globe rotation inertia. Decays to zero over time.
ellipsoid: EllipsoidThe ellipsoid model used for surface interaction and up-direction calculation. Defaults to WGS84.
ellipsoidGroup: GroupThe Three.js group whose world matrix defines the ellipsoid's coordinate frame.
constructor( scene = null: Object3D, camera = null: Camera, domElement = null: HTMLElement )setEllipsoid( ellipsoid: Ellipsoid, ellipsoidGroup: Group ): voidSets the ellipsoid model and its scene group for globe-aware interaction.
getVectorToCenter( target: Vector3 ): Vector3Returns the vector from the camera to the center of the ellipsoid in world space.
getDistanceToCenter(): numberReturns the distance from the camera to the center of the ellipsoid.
extends I3DMLoaderBase
Loader for the legacy 3D Tiles Instanced 3D Model (i3dm) format. Parses the i3dm
container and returns instanced meshes with batchTable and featureTable attached
to the resolved scene object.
constructor( manager: LoadingManager )parse(
buffer: ArrayBuffer
): Promise<{scene: Group, batchTable: BatchTable, featureTable: FeatureTable}>Parses an i3dm buffer and resolves to a GLTF result object where the scene's
meshes have been replaced with InstancedMesh objects (one per GLTF mesh), with
metadata attached to both model and model.scene.
extends PNTSLoaderBase
Loader for the legacy 3D Tiles Point Cloud (pnts) format. Parses the pnts container
and returns a three.js Points object with batchTable and featureTable attached
to the resolved scene object.
constructor( manager: LoadingManager )parse(
buffer: ArrayBuffer
): Promise<{scene: Points, batchTable: BatchTable, featureTable: FeatureTable}>Parses a pnts buffer and resolves to a result object containing a constructed
three.js Points scene with metadata attached.
extends TilesRendererBase
Three.js implementation of a 3D Tiles renderer. Extends TilesRendererBase with
camera management, three.js scene integration, and GPU-accelerated tile loading.
Add tiles.group to your scene and call tiles.update() each frame.
autoDisableRendererCulling: booleanIf true, all tile meshes automatically have frustumCulled set to false since the
tiles renderer performs its own frustum culling. If displayActiveTiles is true or
multiple cameras are being used, consider setting this to false.
group: GroupThe container Group for the 3D tiles. Add this to the three.js scene. The group
also exposes a matrixWorldInverse field for transforming objects into the local
tileset frame.
ellipsoid: EllipsoidThe ellipsoid definition used for the tileset. Defaults to WGS84 and may be
overridden by the 3DTILES_ellipsoid extension. Specified in the local frame of
TilesRenderer.group.
cameras: Array<Camera>Array of cameras registered with this renderer.
manager: LoadingManagerThe LoadingManager used when loading tile geometry.
getBoundingBox( target: Box3 ): booleanReturns the axis-aligned bounding box of the root tile in the group's local space.
getOrientedBoundingBox( targetBox: Box3, targetMatrix: Matrix4 ): booleanReturns the oriented bounding box and transform of the root tile.
getBoundingSphere( target: Sphere ): booleanReturns the bounding sphere of the root tile in the group's local space.
forEachLoadedModel( callback: function ): voidIterates over all currently loaded tile scenes.
raycast( raycaster: Raycaster, intersects: Array ): voidPerforms a raycast against all loaded tile scenes. Compatible with Three.js raycasting.
Supports raycaster.firstHitOnly for early termination.
hasCamera( camera: Camera ): booleanReturns whether the given camera is registered with this renderer.
setCamera( camera: Camera ): booleanRegisters a camera with the renderer so it is used for tile selection and screen-space error
calculation. Use setResolution or setResolutionFromRenderer to provide the camera's resolution.
setResolution( camera: Camera, xOrVec: number | Vector2, y: number ): booleanSets the render resolution for a registered camera, used for screen-space error calculation.
setResolutionFromRenderer( camera: Camera, renderer: WebGLRenderer ): booleanSets the render resolution for a camera by reading the current size from a WebGLRenderer.
deleteCamera( camera: Camera ): booleanUnregisters a camera from the renderer.
extends ENU_FRAME
decodeOctNormal( x: number, y: number, target: Vector3 ): voidDecode an octahedron-encoded normal (as a pair of 8-bit unsigned numbers) into a Vector3.
Resources: