Three.js API手册

动画
AnimationAction AnimationClip AnimationMixer AnimationObjectGroup AnimationUtils KeyframeTrack PropertyBinding PropertyMixer
动画 / 轨道
BooleanKeyframeTrack ColorKeyframeTrack NumberKeyframeTrack QuaternionKeyframeTrack StringKeyframeTrack VectorKeyframeTrack
音频
Audio AudioAnalyser AudioContext AudioListener PositionalAudio
摄像机
ArrayCamera Camera CubeCamera OrthographicCamera PerspectiveCamera StereoCamera
常量
Animation Core CustomBlendingEquation DrawModes Materials Renderer Textures
核心
BufferAttribute BufferGeometry Clock DirectGeometry EventDispatcher Face3 Geometry InstancedBufferAttribute InstancedBufferGeometry InstancedInterleavedBuffer InterleavedBuffer InterleavedBufferAttribute Layers Object3D Raycaster Uniform
核心 / BufferAttributes
BufferAttribute_Types
弃用列表
DeprecatedList
附件
Earcut ShapeUtils
附件 / 核心
Curve CurvePath Font Interpolations Path Shape ShapePath
附件 / 曲线
ArcCurve CatmullRomCurve3 CubicBezierCurve CubicBezierCurve3 EllipseCurve LineCurve LineCurve3 QuadraticBezierCurve QuadraticBezierCurve3 SplineCurve
附件 / 物体
ImmediateRenderObject
几何体
BoxBufferGeometry BoxGeometry CircleBufferGeometry CircleGeometry ConeBufferGeometry ConeGeometry CylinderBufferGeometry CylinderGeometry DodecahedronBufferGeometry DodecahedronGeometry EdgesGeometry ExtrudeBufferGeometry ExtrudeGeometry IcosahedronBufferGeometry IcosahedronGeometry LatheBufferGeometry LatheGeometry OctahedronBufferGeometry OctahedronGeometry ParametricBufferGeometry ParametricGeometry PlaneBufferGeometry PlaneGeometry PolyhedronBufferGeometry PolyhedronGeometry RingBufferGeometry RingGeometry ShapeBufferGeometry ShapeGeometry SphereBufferGeometry SphereGeometry TetrahedronBufferGeometry TetrahedronGeometry TextBufferGeometry TextGeometry TorusBufferGeometry TorusGeometry TorusKnotBufferGeometry TorusKnotGeometry TubeBufferGeometry TubeGeometry WireframeGeometry
辅助对象
ArrowHelper AxesHelper BoxHelper Box3Helper CameraHelper DirectionalLightHelper FaceNormalsHelper GridHelper PolarGridHelper PositionalAudioHelper HemisphereLightHelper PlaneHelper PointLightHelper RectAreaLightHelper SkeletonHelper SpotLightHelper VertexNormalsHelper
灯光
AmbientLight DirectionalLight HemisphereLight Light PointLight RectAreaLight SpotLight
灯光 / 阴影
DirectionalLightShadow LightShadow SpotLightShadow
加载器
AnimationLoader AudioLoader BufferGeometryLoader Cache CompressedTextureLoader CubeTextureLoader DataTextureLoader FileLoader FontLoader ImageBitmapLoader ImageLoader Loader LoaderUtils MaterialLoader ObjectLoader TextureLoader
加载器 / 管理器
DefaultLoadingManager LoadingManager
材质
LineBasicMaterial LineDashedMaterial Material MeshBasicMaterial MeshDepthMaterial MeshDistanceMaterial MeshLambertMaterial MeshMatcapMaterial MeshNormalMaterial MeshPhongMaterial MeshPhysicalMaterial MeshStandardMaterial MeshToonMaterial PointsMaterial RawShaderMaterial ShaderMaterial ShadowMaterial SpriteMaterial
数学库
Box2 Box3 Color Cylindrical Euler Frustum Interpolant Line3 Math Matrix3 Matrix4 Plane Quaternion Ray Sphere Spherical Triangle Vector2 Vector3 Vector4
数学库 / 插值
CubicInterpolant DiscreteInterpolant LinearInterpolant QuaternionLinearInterpolant
物体
Bone Group Line LineLoop LineSegments LOD Mesh Points Skeleton SkinnedMesh Sprite
渲染器
WebGLMultisampleRenderTarget WebGLRenderer WebGLRenderTarget WebGLRenderTargetCube
渲染器 / 着色器
ShaderChunk ShaderLib UniformsLib UniformsUtils
场景
Fog FogExp2 Scene
纹理贴图
CanvasTexture CompressedTexture CubeTexture DataTexture DataTexture3D DepthTexture Texture VideoTexture
在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

已被弃用API列表(Deprecated API List)

由于three.js具有一个快速发展的接口,你可能会遇上类似“提示你当前所调用的API元素不再是Three.js核心的一部分”的提示。

下面就列举出了这些API元素,以及一些关于他们的替代信息。

音频(Audio)

Audio

Audio.load 已被弃用。 请使用 AudioLoader。

AudioAnalyser

AudioAnalyser.getData() 已被重命名为 AudioAnalyser.getFrequencyData()。

BinaryTextureLoader

BinaryTextureLoader 已被重命名为 DataTextureLoader。

缓冲器(Buffers)

BufferAttribute

BufferAttribute.length 已被重命名为 BufferAttribute.count。

BufferAttribute.copyIndicesArray() 已被删除。

DynamicBufferAttribute

DynamicBufferAttribute 已被删除。 请使用BufferAttribute.setDynamic( true )。

Int8Attribute

Int8Attribute 已被删除。 请使用Int8BufferAttribute。

Uint8Attribute

Uint8Attribute 已被删除。 请使用Uint8BufferAttribute。

Uint8ClampedAttribute

Uint8ClampedAttribute 已被删除。 请使用Uint8ClampedBufferAttribute。

Int16Attribute

Int16Attribute 已被删除。 请使用Int16BufferAttribute。

Uint16Attribute

Uint16Attribute 已被删除。 请使用Uint16BufferAttribute。

Int32Attribute

Int32Attribute 已被删除。 请使用Int32BufferAttribute。

Uint32Attribute

Uint32Attribute 已被删除。 请使用Uint32BufferAttribute。

Float32Attribute

Float32Attribute 已被删除。 请使用Float32BufferAttribute。

Float64Attribute

Float64Attribute 已被删除。 请使用Float64BufferAttribute。

摄像机(Cameras)

PerspectiveCamera

PerspectiveCamera.setLens() 已被弃用。 请使用PerspectiveCamera.setFocalLength() 和 PerspectiveCamera.filmGauge() 来对摄像机拍摄进行设置。

常量(Constants)

LineStrip

LinePieces

LinePieces mode 已经不再对 Lines 进行支持。 请创建一个 LineSegments 。

核心(Core)

EventDispatcher

EventDispatcher.apply 已被删除。 请继承或者Object.assign其原型来“混合”。Inherit or Object.assign the prototype to mix-in。

Raycaster

Raycaster.params.PointCloud 已被重命名为 Raycaster.params.Points。

Uniform

Uniform.dynamic 已被删除。 请使用object.onBeforeRender()。

Uniform.onUpdate 已被删除。 请使用object.onBeforeRender() 。

附件(Extras)

ClosedSplineCurve3

ClosedSplineCurve3 已被弃用。 请使用CatmullRomCurve3。

SplineCurve3

SplineCurve3 已被弃用。 请使用CatmullRomCurve3。

几何体(Geometry)

Geometry.computeTangents() 已被删除。

Geometry.computeLineDistances() 已被删除。 请使用Line.computeLineDistances。

BufferGeometry

BufferGeometry.addIndex 已被重命名为 BufferGeometry.setIndex。

BufferGeometry.addDrawCall 现在是 BufferGeometry.addGroup。

BufferGeometry.clearDrawCalls 现在是 BufferGeometry.clearGroups。

BufferGeometry.computeTangents 已被删除。

BufferGeometry.computeOffsets 已被删除。

BufferGeometry.drawcalls 已被重命名为 BufferGeometry.groups。

BufferGeometry.offsets 已被重命名为 BufferGeometry.groups。

CubeGeometry

CubeGeometry 已被重命名为 BoxGeometry。

Geometry

Geometry.computeTangents() 已被删除。

GeometryUtils

GeometryUtils.merge 已被移动到了 Geometry,请使用Geometry.merge( geometry2, matrix, materialIndexOffset )。

GeometryUtils.center 已被移动到了 Geometry,请使用Geometry.center( ) 。

Plane

Plane.isIntersectionLine() 已被重命名为 Plane.intersectsLine()。

辅助工具(Helpers)

BoundingBoxHelper

BoundingBoxHelper 已被弃用。 请使用BoxHelper。

EdgesHelper

EdgesHelper 已被删除。 请使用EdgesGeometry。

GridHelper

GridHelper.setColors() 已被弃用,请在构造器中传递它们。

WireframeHelper

WireframeHelper 已被删除。 请使用WireframeGeometry。

灯光(Lights)

Light

Light.onlyShadow 已被删除。

Light.shadowCameraLeft 现在是 Light.shadow.camera.left。

Light.shadowCameraRight 现在是 Light.shadow.camera.right。

Light.shadowCameraTop 现在是 Light.shadow.camera.top。

Light.shadowCameraBottom 现在是 Light.shadow.camera.bottom。

Light.shadowCameraNear 现在是 Light.shadow.camera.near。

Light.shadowCameraFar 现在是 Light.shadow.camera.far。

Light.shadowCameraVisible 已被删除。 请使用CameraHelper ( light.shadow.camera )。

Light.shadowMapWidth 现在是 Light.shadow.mapSize.width。

Light.shadowMapHeight 现在是 Light.shadow.mapSize.height。

加载器(Loaders)

XHRLoader

XHRLoader 已被重命名为 FileLoader。

JSONLoader

JSONLoader has been removed from core.

数学(Maths)

Box2

Box2.center 已被重命名为 Box2.getCenter()。

Box2.empty 已被重命名为 Box2.isEmpty()。

Box2.isIntersectionBox 已被重命名为 Box2.intersectsBox()。

Box2.size 已被重命名为 Box2.getSize()。

Box3

Box3.center 已被重命名为 Box3.getCenter()。

Box3.empty 已被重命名为 Box3.isEmpty()。

Box3.isIntersectionBox 已被重命名为 Box3.intersectsBox()。

Box3.isIntersectionSphere 已被重命名为 Box3.intersectsSphere()。

Box3.size 已被重命名为 Box3.getSize()。

Face4

Face4 已被删除。 请使用Face3。

Line3

Line3.center 已被重命名为 Line3.getCenter()。

Math

Math.random16() 已被弃用。 请使用Math.random() 。

Matrix3

Matrix3.flattenToArrayOffset 已被弃用。请使用Matrix3.toArray()。

Matrix3.multiplyVector3 已被删除。 请使用vector.applyMatrix3( matrix )。

Matrix3.multiplyVector3Array 已被重命名为 Matrix3.applyToVector3Array( array )。

Matrix3.applyToBuffer 已被删除。 请使用matrix.applyToBufferAttribute( attribute )。

Matrix3.applyToVector3Array 已被删除。

Matrix4

Matrix4.flattenToArrayOffset() 已被弃用。请使用Matrix4.toArray()。

Matrix4.extractPosition() 已被重命名为 Matrix4.copyPosition( matrix )。

Matrix4.getPosition() 已被删除。 请使用Vector3.setFromMatrixPosition( matrix )。

Matrix4.setRotationFromQuaternion() 已被重命名为 Matrix4.makeRotationFromQuaternion( quaternion )。

Matrix4.multiplyVector3() 已被删除。 请使用vector.applyMatrix4( matrix )。

Matrix4.multiplyVector4() 已被删除。 请使用vector.applyMatrix4( matrix )。

Matrix4.multiplyVector3Array() 已被重命名为 Matrix4.applyToVector3Array ( array )。

Matrix4.rotateAxis() 已被删除。 请使用Matrix4.transformDirection( matrix )。

Matrix4.crossVector() 已被删除。 请使用vector.applyMatrix4( matrix )。

Matrix4.rotateX() 已被删除。

Matrix4.rotateY() 已被删除。

Matrix4.rotateZ() 已被删除。

Matrix4.rotateByAxis() 已被删除。

Matrix4.applyToBuffer() 已被删除。 请使用matrix.applyToBufferAttribute()。

Matrix4.applyToVector3Array() 已被删除。

Matrix4.makeFrustum() 已被删除。 请使用Matrix4.makePerspective( left, right, top, bottom, near, far ) 。

Quaternion.multiplyVector3

Quaternion.multiplyVector3() 已被删除。 请使用vector.applyQuaternion( quaternion )。

Ray

Ray.isIntersectionBox() 已被重命名为 Ray.intersectsBox()。

Ray.isIntersectionPlane 已被重命名为 Ray.intersectsPlane。

Ray.isIntersectionSphere 已被重命名为 Ray.intersectsSphere。

Triangle

Triangle.area() 已被重命名为 Triangle.getArea()。

Triangle.barycoordFromPoint() 已被重命名为 Triangle.getBarycoord()。

Triangle.midpoint() 已被重命名为 Triangle.getMidpoint()。

Triangle.normal() 已被重命名为 Triangle.getNormal()。

Triangle.plane() 已被重命名为 Triangle.getPlane()。

Vector2

Vector2.fromAttribute() 已被重命名为 Vector2.fromBufferAttribute()。

Vector3

Vector3.setEulerFromRotationMatrix() 已被删除。 请使用Euler.setFromRotationMatrix()。

Vector3.setEulerFromQuaternion() 已被删除。 请使用Euler.setFromQuaternion()。

Vector3.getPositionFromMatrix() 已被重命名为 Vector3.setFromMatrixPosition()。

Vector3.getScaleFromMatrix() 已被重命名为 Vector3.setFromMatrixScale()。

Vector3.getColumnFromMatrix() 已被重命名为 Vector3.setFromMatrixColumn()。

Vector3.applyProjection() 已被删除。 请使用Vector3.applyMatrix4()。

Vector3.fromAttribute() 已被重命名为 Vector3.fromBufferAttribute()。

Vector4

Vector4.fromAttribute() 已被重命名为 Vector4.fromBufferAttribute().

Vertex

Vertex 已被删除。 请使用Vector3。

Spline

Spline 已被删除。 请使用CatmullRomCurve3。

材质(Materials)

Material

Material.wrapAround 已被删除。

Material.wrapRGB 已被删除。

MeshFaceMaterial

MeshFaceMaterial 已被删除。 请使用一个材质数组。

MultiMaterial

MultiMaterial 已被删除。 请使用一个材质数组。

MeshPhongMaterial

MeshPhongMaterial.metal 已被删除。 请使用MeshStandardMaterial。

ParticleBasicMaterial

ParticleBasicMaterial 已被重命名为 PointsMaterial。

ParticleSystemMaterial

ParticleBasicMaterial 已被重命名为 PointsMaterial。

PointCloudMaterial

PointCloudMaterial 已被重命名为 PointsMaterial。

ShaderMaterial.derivatives

ShaderMaterial.derivatives 已被移动到了 ShaderMaterial.extensions.derivatives。

物体(Objects)

LOD.objects

LOD.objects 已被重命名为 LOD.levels。

Object3D

Object3D.eulerOrder 现在是 Object3D.rotation.order。

Object3D.getChildByName() 已被重命名为 Object3D.getObjectByName()。

Object3D.renderDepth 已被删除。 请使用Object3D.renderOrder。

Object3D.translate() 已被删除。 请使用Object3D.translateOnAxis( axis, distance )。

Object3D.useQuaternion 已被删除。 默认情况下,Three.js库是使用quaternions(四元数)的。

LensFlare

LensFlare 已被移动到了 /examples/js/objects/Lensflare.js.

Particle

Particle 已被重命名为 Sprite。

ParticleSystem

ParticleSystem 已被重命名为 Points。

PointCloud

PointCloud 已被重命名为 Points。

Shape

Shape.extrude 已被删除。 请使用ExtrudeGeometry。

Shape.makeGeometry 已被删除。 请使用ShapeGeometry 。

SkinnedMesh

SkinnedMesh.initBones() has been removed.

渲染器(Renderer)

Projector

CanvasRenderer 已被移动到了 /examples/js/renderers/CanvasRenderer.js.

Projector

Projector 已被移动到了 /examples/js/renderers/Projector.js

Projector.projectVector() 现在是 Vector.project()。

Projector.unprojectVector() 现在是 Vector.unproject()。

Projector:.pickingRay() 现在是 Raycaster.setFromCamera()。

WebGLProgram

WebGLProgram.uniforms 现在是 WebGLProgram.getUniforms()。

WebGLProgram.attributes 现在是 WebGLProgram.getAttributes()。

WebGLRenderer

WebGLRenderer.supportsFloatTextures() 现在是 WebGLRenderer.extensions.get( 'OES_texture_float' )。

WebGLRenderer.supportsHalfFloatTextures() 现在是 WebGLRenderer.extensions.get( 'OES_texture_half_float' )。

WebGLRenderer.supportsStandardDerivatives() 现在是 WebGLRenderer.extensions.get( 'OES_standard_derivatives' )。

WebGLRenderer.supportsCompressedTextureS3TC() 现在是 WebGLRenderer.extensions.get( 'WEBGL_compressed_texture_s3tc' )。

WebGLRenderer.supportsCompressedTexturePVRTC() 现在是 WebGLRenderer.extensions.get( 'WEBGL_compressed_texture_pvrtc' )。

WebGLRenderer.supportsBlendMinMax() 现在是 WebGLRenderer.extensions.get( 'EXT_blend_minmax' )。

WebGLRenderer.supportsVertexTextures() 现在是 WebGLRenderer.capabilities.vertexTextures。

WebGLRenderer.supportsInstancedArrays() 现在是 WebGLRenderer.extensions.get( 'ANGLE_instanced_arrays' )。

WebGLRenderer.enableScissorTest() 现在是 WebGLRenderer.setScissorTest()。

WebGLRenderer.initMaterial() 已被删除。

WebGLRenderer.addPrePlugin() 已被删除。

WebGLRenderer.addPostPlugin() 已被删除。

WebGLRenderer.updateShadowMap() 已被删除。

WebGLRenderer.setFaceCulling() 已被删除。

WebGLRenderer.setTexture is deprecated, 请使用WebGLRenderer.setTexture2D()。

WebGLRenderer.shadowMapEnabled 现在是 WebGLRenderer.shadowMap.enabled。

WebGLRenderer.shadowMapType 现在是 WebGLRenderer.shadowMap.type。

WebGLRenderer.shadowMapCullFace 已被删除。请设置Material.shadowSide。

WebGLRenderer.shadowMap.cullFace 已被删除。请设置Material.shadowSide。

WebGLRenderer.shadowMap.renderReverseSided 已被删除。请设置Material.shadowSide。

WebGLRenderer.shadowMap.renderSingleSided 已被删除。请设置Material.shadowSide。

WebGLRenderTarget

WebGLRenderTarget.wrapS 现在是 WebGLRenderTarget.texture.wrapS。

WebGLRenderTarget.wrapT 现在是 WebGLRenderTarget.texture.wrapT。

WebGLRenderTarget.magFilter 现在是 WebGLRenderTarget.texture.magFilter。

WebGLRenderTarget.minFilter 现在是 WebGLRenderTarget.texture.minFilter。

WebGLRenderTarget.anisotropy 现在是 WebGLRenderTarget.texture.anisotropy。

WebGLRenderTarget.offset 现在是 WebGLRenderTarget.texture.offset。

WebGLRenderTarget.repeat 现在是 WebGLRenderTarget.texture.repeat。

WebGLRenderTarget.format 现在是 WebGLRenderTarget.texture.format。

WebGLRenderTarget.type 现在是 WebGLRenderTarget.texture.type。

WebGLRenderTarget.generateMipmaps 现在是 WebGLRenderTarget.texture.generateMipmaps.

纹理(Textures)

ImageUtils

ImageUtils.loadTexture 已被弃用。 请使用TextureLoader。

ImageUtils.loadTextureCube 已被弃用。 请使用CubeTextureLoader。

ImageUtils.loadCompressedTexture 已被删除。 请使用DDSLoader。

ImageUtils.loadCompressedTextureCube 已被删除。 请使用DDSLoader 。

源代码

src/Three.Legacy.js