Optional
name: stringOptional
duration: numberOptional
tracks: KeyframeTrack[]Optional
blendMode: AnimationBlendModeStatic
CreateStatic
findStatic
CreateStatic
parseStatic
parseStatic
toJSONArrayCamera can be used in order to efficiently render a scene with a predefined set of cameras
-This is an important performance aspect for rendering VR scenes.
-An instance of ArrayCamera always has an array of sub cameras
-It's mandatory to define for each sub camera the viewport
property which determines the part of the viewport that is rendered with this camera.
An array of cameras.
-Optional
cameras: PerspectiveCamera[]Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
isRead-only flag to check if a given object is of type ArrayCamera.
-An array of cameras.
-Readonly
isRead-only flag to check if a given object is of type Camera.
-Readonly
typeGets or sets the zoom factor of the camera.
-Camera frustum vertical field of view, from bottom to top of view, in degrees.
-Camera frustum aspect ratio, usually the canvas width / canvas height.
-Camera frustum near plane.
-The valid range is greater than 0
and less than the current value of the .far plane.
Camera frustum far plane.
-Must be greater than the current value of .near plane.
-Object distance used for stereoscopy and depth-of-field effects.
-Frustum window specification or null.
-This is set using the .setViewOffset method and cleared using .clearViewOffset.
Film size used for the larger axis.
-This parameter does not influence the projection matrix unless .filmOffset is set to a nonzero value.
Horizontal off-center offset in the same unit as .filmGauge.
-Readonly
isRead-only flag to check if a given object is of type Camera.
-The THREE.Layers | layers that the Camera is a member of.
-Objects must share at least one layer with the Camera to be n when the camera's viewpoint is rendered.
-This is the inverse of matrixWorld.
-MatrixWorld contains the Matrix which has the world transform of the Camera .
-This is the matrix which contains the projection.
-This is the inverse of projectionMatrix.
-Optional
viewportReadonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-Returns the focal length of the current .fov | fov in respect to .filmGauge.
-Sets the FOV by focal length in respect to the current .filmGauge.
-Expects a Float
Returns the current vertical field of view angle in degrees considering .zoom.
-Returns the width of the image on the film
-If .aspect. is greater than or equal to one (landscape format), the result equals .filmGauge.
-Returns the height of the image on the film
-If .aspect. is less than or equal to one (portrait format), the result equals .filmGauge.
-Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.
-Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.
Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
-Copies the result into the target Vector2, where x is width and y is height.
Sets an offset in a larger frustum.
-Full width of multiview setup Expects a Float
.
Full height of multiview setup Expects a Float
.
Horizontal offset of subcamera Expects a Float
.
Vertical offset of subcamera Expects a Float
.
Width of subcamera Expects a Float
.
Height of subcamera Expects a Float
.
This is useful for multi-window or multi-monitor/multi-machine setups.
-For example, if you have 3x2 monitors and each monitor is 1920x1080 and
-the monitors are in grid like this
┌───┬───┬───┐
│ A │ B │ C │
├───┼───┼───┤
│ D │ E │ F │
└───┴───┴───┘
-
-
-then for each monitor you would call it like this
- const w = 1920;
const h = 1080;
const fullWidth = w * 3;
const fullHeight = h * 2;
// Monitor - A
camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
// Monitor - B
camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
// Monitor - C
camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
// Monitor - D
camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
// Monitor - E
camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
// Monitor - F
camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
-
-
-Note there is no reason monitors have to be the same size or in a grid.
-Removes any offset set by the .setViewOffset method.
-Optional
frameHeight: numberUse .setFocalLength() and .filmGauge instead.
-Convert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Fire an event type.
-The event that gets fired.
-A Bone which is part of a THREE.Skeleton | Skeleton
-Creates a new Bone.
-Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
isRead-only flag to check if a given object is of type Bone.
-Readonly
typeReadonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-The layer membership of the object.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Convert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
Use .isEmpty() instead.
-Use .intersectsBox() instead.
-Use .isEmpty() instead.
-Use .intersectsBox() instead.
-Use .intersectsSphere() instead.
-This class stores data for an attribute (such as vertex positions, face indices, normals, colors, UVs, and any custom attributes )
-associated with a THREE.BufferGeometry | BufferGeometry, which allows for more efficient passing of data to the GPU
When working with vector-like data, the .fromBufferAttribute( attribute, index )
helper methods on
-THREE.Vector2.fromBufferAttribute | Vector2,
-THREE.Vector3.fromBufferAttribute | Vector3,
-THREE.Vector4.fromBufferAttribute | Vector4, and
-THREE.Color.fromBufferAttribute | Color classes may be helpful.
This creates a new THREE.GLBufferAttribute | GLBufferAttribute object.
-Must be a TypedArray
. Used to instantiate the buffer.
-This array should have itemSize * numVertices
elements, where numVertices is the number of vertices in the associated THREE.BufferGeometry | BufferGeometry.
the number of values of the array that should be associated with a particular vertex.
-For instance, if this attribute is storing a 3-component vector (such as a position, normal, or color),
-then itemSize should be 3
.
Optional
normalized: booleanApplies to integer data only.
-Indicates how the underlying data in the buffer maps to the values in the GLSL code.
-For instance, if array is an instance of UInt16Array
, and normalized is true,
-the values 0
- +65535
in the array data will be mapped to 0.0f
- +1.0f
in the GLSL attribute.
-An Int16Array
(signed) would map from -32768
- +32767
to -1.0f
- +1.0f
.
-If normalized is false, the values will be converted to floats unmodified,
-i.e. 32767
becomes 32767.0f
.
-Default false
.
TypeError
When the array is not a TypedArray
;
Optional name for this attribute instance.
-The TypedArray holding data stored in the buffer.
-The length of vectors that are being stored in the array.
-Defines the intended usage pattern of the data store for optimization purposes.
-Corresponds to the usage parameter of
-WebGLRenderingContext.bufferData.
After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render.
-Configures the bound GPU type for use in shaders. Either FloatType or IntType, default is FloatType.
-Note: this only has an effect for integer arrays and is not configurable for float arrays. For lower precision
-float types, see https://threejs.org/docs/#api/en/core/bufferAttributeTypes/BufferAttributeTypes.
This can be used to only update some components of stored vectors (for example, just the component related to
-color). Use the .addUpdateRange function to add ranges to this array.
Position at which to start update.
-The number of components to update.
-A version number, incremented every time the needsUpdate property is set to true.
-Indicates how the underlying data in the buffer maps to the values in the GLSL shader code.
-Readonly
countReadonly
isRead-only flag to check if a given object is of type BufferAttribute.
-A callback function that is executed after the Renderer has transferred the attribute array data to the GPU.
-Flag to indicate that this attribute has changed and should be re-sent to the GPU.
-Set this to true when you modify the value of the array.
Setting this to true also increments the version.
-Sets the value of the onUploadCallback property.
-function that is executed after the Renderer has transferred the attribute array data to the GPU.
-Set usage
-After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render.
-a copy of this BufferAttribute.
-Copies another BufferAttribute to this BufferAttribute.
-Copy a vector from bufferAttribute[index2] to array[index1].
-Copy the array given here (which can be a normal array or TypedArray
) into array.
TypedArray.set for notes on requirements if copying a TypedArray
.
Applies matrix m to every Vector3 element of this BufferAttribute.
-Applies matrix m to every Vector3 element of this BufferAttribute.
-Applies normal matrix m to every Vector3 element of this BufferAttribute.
-Applies matrix m to every Vector3 element of this BufferAttribute, interpreting the elements as a direction vectors.
-Calls TypedArray.set( value, offset )
-on the array.
Array | Array or TypedArray
from which to copy values.
Optional
offset: numberindex of the array at which to start copying. Expects a Integer
. Default 0
.
RangeError
When offset is negative or is too large.
Convert this object to three.js to the data.attributes
part of JSON Geometry format v4,
A representation of mesh, line, or point geometry
-Includes vertex positions, face indices, normals, colors, UVs, and custom attributes within buffers, reducing the cost of passing all this data to the GPU.
To read and edit data in BufferGeometry attributes, see THREE.BufferAttribute | BufferAttribute documentation.
-const geometry = new THREE.BufferGeometry();
// create a simple square shape. We duplicate the top left and bottom right
// vertices because each vertex needs to appear once per triangle.
const vertices = new Float32Array( [
-1.0, -1.0, 1.0, // v0
1.0, -1.0, 1.0, // v1
1.0, 1.0, 1.0, // v2
1.0, 1.0, 1.0, // v3
-1.0, 1.0, 1.0, // v4
-1.0, -1.0, 1.0 // v5
] );
// itemSize = 3 because there are 3 values (components) per vertex
geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
const mesh = new THREE.Mesh( geometry, material );
-
-
-const geometry = new THREE.BufferGeometry();
const vertices = new Float32Array( [
-1.0, -1.0, 1.0, // v0
1.0, -1.0, 1.0, // v1
1.0, 1.0, 1.0, // v2
-1.0, 1.0, 1.0, // v3
] );
geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
const indices = [
0, 1, 2,
2, 3, 0,
];
geometry.setIndex( indices );
geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
const mesh = new THREE.Mesh( geometry, material );
-
-
-This creates a new THREE.BufferGeometry | BufferGeometry object.
-Unique number for this THREE.BufferGeometry | BufferGeometry instance.
-UUID of this object instance.
-Optional name for this THREE.BufferGeometry | BufferGeometry instance.
-Readonly
typeA Read-only string to check if this
object type.
Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles".
-Each triangle is associated with the indices of three vertices. This attribute therefore stores the index of each vertex for each triangular face.
-If this attribute is not set, the THREE.WebGLRenderer | renderer assumes that each three contiguous positions represent a single triangle.
This hashmap has as id the name of the attribute to be set and as value the THREE.BufferAttribute | buffer to set it to. Rather than accessing this property directly,
-use .setAttribute and .getAttribute to access attributes of this geometry.
Hashmap of THREE.BufferAttribute | BufferAttributes holding details of the geometry's morph targets.
-Once the geometry has been rendered, the morph attribute data cannot be changed.
-You will have to call .dispose(), and create a new instance of THREE.BufferGeometry | BufferGeometry.
Used to control the morph target behavior; when set to true, the morph target data is treated as relative offsets, rather than as absolute positions/normals.
-Split the geometry into groups, each of which will be rendered in a separate WebGL draw call. This allows an array of materials to be used with the geometry.
-Bounding box for the THREE.BufferGeometry | BufferGeometry, which can be calculated with .computeBoundingBox().
-Bounding sphere for the THREE.BufferGeometry | BufferGeometry, which can be calculated with .computeBoundingSphere().
-Determines the part of the geometry to render. This should not be set directly, instead use .setDrawRange(...).
-An object that can be used to store custom data about the BufferGeometry. It should not hold references to functions as these will not be cloned.
-Readonly
isRead-only flag to check if a given object is of type BufferGeometry.
-Return the .index buffer.
-Set the THREE.BufferGeometry.index | .index buffer.
-Sets an attribute to this geometry with the specified name.
-Use this rather than the attributes property, because an internal hashmap of .attributes is maintained to speed up iterating over attributes.
-Returns the attribute with the specified name.
-Deletes the attribute with the specified name.
-Returns true if the attribute with the specified name exists.
-Adds a group to this geometry
-Optional
materialIndex: numberthe groups property for details.
-Set the .drawRange property
-is the number of vertices or indices to render. Expects a Integer
Applies the rotation represented by the quaternion to the geometry.
-Defines a geometry by creating a position
attribute based on the given array of points. The array can hold
-instances of Vector2 or Vector3. When using two-dimensional data, the z
coordinate for all
-vertices is set to 0
.
If the method is used with an existing position
attribute, the vertex data are overwritten with the data from
-the array. The length of the array must match the vertex count.
Computes the bounding sphere of the geometry, and updates the .boundingSphere attribute. The engine
-automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling. You
-may need to recompute the bounding sphere if the geometry vertices are modified.
Computes vertex normals for the given vertex data. For indexed geometries, the method sets each vertex normal to
-be the average of the face normals of the faces that share that vertex. For non-indexed geometries, vertices are
-not shared, and the method sets each vertex normal to be the same as the face normal.
Return a non-index version of an indexed BufferGeometry.
-Convert the buffer geometry to three.js JSON Object/Scene format.
-Copies another BufferGeometry to this BufferGeometry.
-Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Abstract base class for cameras
-Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
isRead-only flag to check if a given object is of type Camera.
-Readonly
typeThe THREE.Layers | layers that the Camera is a member of.
-Objects must share at least one layer with the Camera to be n when the camera's viewpoint is rendered.
-This is the inverse of matrixWorld.
-MatrixWorld contains the Matrix which has the world transform of the Camera .
-This is the matrix which contains the projection.
-This is the inverse of projectionMatrix.
-Optional
viewportReadonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Convert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Fire an event type.
-The event that gets fired.
-Class representing a color.
-A Color instance is represented by RGB components in the linear working color space, which defaults to
-LinearSRGBColorSpace
. Inputs conventionally using SRGBColorSpace
(such as hexadecimals and CSS strings) are
-converted to the working color space automatically.
// converted automatically from SRGBColorSpace to LinearSRGBColorSpace
const color = new THREE.Color().setHex( 0x112233 );
-
-
-Source color spaces may be specified explicitly, to ensure correct conversions.
-// assumed already LinearSRGBColorSpace; no conversion
const color = new THREE.Color().setRGB( 0.5, 0.5, 0.5 );
// converted explicitly from SRGBColorSpace to LinearSRGBColorSpace
const color = new THREE.Color().setRGB( 0.5, 0.5, 0.5, SRGBColorSpace );
-
-
-If THREE.ColorManagement is disabled, no conversions occur. For details, see Color management.
-Iterating through a Color instance will yield its components (r, g, b) in the corresponding order.
-Optional
color: ColorRepresentationStatic
NAMESList of X11 color names.
-Readonly
isRed channel value between 0.0
and 1.0
. Default is 1
.
Green channel value between 0.0
and 1.0
. Default is 1
.
Blue channel value between 0.0
and 1.0
. Default is 1
.
Sets this color from HSL values.
-Based on MochiKit implementation by Bob Ippolito.
Hue channel value between 0 and 1.
-Saturation value channel between 0 and 1.
-Value channel value between 0 and 1.
-Optional
colorSpace: stringSets this color from a color name.
-Faster than .setStyle() method if you don't need the other CSS-style formats.
Color name in X11 format.
-Optional
colorSpace: stringSets this color's red, green and blue value from the provided array or array-like.
-the source array or array-like.
-Optional
offset: number(optional) offset into the array-like. Default is 0.
-Returns an array [red, green, blue], or copies red, green and blue into the provided array.
-Optional
array: number[](optional) array to store the color to. If this is not provided, a new array will be created.
-Optional
offset: number(optional) optional offset into the array.
-The created or provided array.
-Copies red, green and blue into the provided array-like.
-Optional
offset: number(optional) optional offset into the array-like.
-The provided array-like.
-Creates a cube texture made up of six images.
-CubeTexture is almost equivalent in functionality and usage to Texture.
-The only differences are that the images are an array of 6 images as opposed to a single image,
-and the mapping options are THREE.CubeReflectionMapping (default) or THREE.CubeRefractionMapping
const loader = new THREE.CubeTextureLoader();
loader.setPath('textures/cube/pisa/');
const textureCube = loader.load(['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png']);
const material = new THREE.MeshBasicMaterial({
color: 0xffffff,
envMap: textureCube
});
-
-
-This creates a new THREE.CubeTexture | CubeTexture object.
-Optional
images: any[]Optional
mapping: CubeTextureMappingSee .mapping. Default THREE.CubeReflectionMapping
-Optional
wrapS: WrappingSee .wrapS. Default THREE.ClampToEdgeWrapping
-Optional
wrapT: WrappingSee .wrapT. Default THREE.ClampToEdgeWrapping
-Optional
magFilter: MagnificationTextureFilterSee .magFilter. Default THREE.LinearFilter
-Optional
minFilter: MinificationTextureFilterSee .minFilter. Default THREE.LinearMipmapLinearFilter
-Optional
format: PixelFormatSee .format. Default THREE.RGBAFormat
-Optional
type: TextureDataTypeSee .type. Default THREE.UnsignedByteType
-Optional
anisotropy: numberSee .anisotropy. Default THREE.Texture.DEFAULT_ANISOTROPY
-Optional
colorSpace: stringSee .colorSpace. Default NoColorSpace
-Static
DEFAULT_The Global default value for .anisotropy.
-Static
DEFAULT_The Global default value for .image.
-Static
DEFAULT_The Global default value for .mapping.
-Readonly
isRead-only flag to check if a given object is of type CubeTexture.
-How the image is applied to the object.
-All Texture types except THREE.CubeTexture expect the values be THREE.Mapping
-If set to true
, the texture is flipped along the vertical axis when uploaded to the GPU.
Note that this property has no effect for ImageBitmap.
-You need to configure on bitmap creation instead. See THREE.ImageBitmapLoader | ImageBitmapLoader.
Readonly
isRead-only flag to check if a given object is of type Texture.
-Readonly
idUnique number for this Texture instance.
-UUID of this object instance.
-Optional name of the object
-The data definition of a texture. A reference to the data source can be shared across textures.
-This is often useful in context of spritesheets where multiple textures render the same data
-but with different Texture transformations.
Array of user-specified mipmaps
-Lets you select the uv attribute to map the texture to. 0
for uv
, 1
for uv1
, 2
for uv2
and 3
for
-uv3
.
This defines how the Texture is wrapped horizontally and corresponds to U in UV mapping.
-for WEBGL1 - tiling of images in textures only functions if image dimensions are powers of two
-(2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
-Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL1, not three.js.
-WEBGL2 does not have this limitation.
This defines how the Texture is wrapped vertically and corresponds to V in UV mapping.
-for WEBGL1 - tiling of images in textures only functions if image dimensions are powers of two
-(2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
-Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL1, not three.js.
-WEBGL2 does not have this limitation.
How the Texture is sampled when a texel covers more than one pixel.
-How the Texture is sampled when a texel covers less than one pixel.
-The number of samples taken along the axis through the pixel that has the highest density of texels.
-A higher value gives a less blurry result than a basic mipmap, at the cost of more Texture samples being used.
-These define how elements of a 2D texture, or texels, are read by shaders.
-All Texture types except THREE.DepthTexture and THREE.CompressedPixelFormat expect the values be THREE.PixelFormat
-This must correspond to the .format.
-The GPU Pixel Format allows the developer to specify how the data is going to be stored on the GPU.
-Compatible only with WebGL2RenderingContext | WebGL 2 Rendering Context.
-The uv-transform matrix for the texture.
-When .matrixAutoUpdate property is true
.
-Will be updated by the renderer from the properties:
Whether is to update the texture's uv-transform .matrix.
-How much a single repetition of the texture is offset from the beginning, in each direction U and V.
-How many times the texture is repeated across the surface, in each direction U and V.
-The point around which rotation occurs.
-How much the texture is rotated around the center point, in radians.
-Whether to generate mipmaps, (if possible) for a texture.
-If set to true
, the alpha channel, if present, is multiplied into the color channels when the texture is uploaded to the GPU.
Note that this property has no effect for ImageBitmap.
-You need to configure on bitmap creation instead. See THREE.ImageBitmapLoader | ImageBitmapLoader.
Specifies the alignment requirements for the start of each pixel row in memory.
-The allowable values are:
-1
(byte-alignment)2
(rows aligned to even-numbered bytes)4
(word-alignment)8
(rows start on double-word boundaries).glPixelStorei for more information.
-The Textures | {@link Texture constants} page for details of other color spaces.
-Textures containing color data should be annotated with SRGBColorSpace THREE.SRGBColorSpace or
-LinearSRGBColorSpace THREE.LinearSRGBColorSpace.
Indicates whether a texture belongs to a render target or not
-An object that can be used to store custom data about the texture.
-This starts at 0
and counts how many times .needsUpdate is set to true
.
Indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target
-textures)
A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true and then the texture is used).
-An image object, typically created using the THREE.CubeTextureLoader.load | CubeTextureLoader.load() method.
-An image object, typically created using the THREE.TextureLoader.load | TextureLoader.load() method.
-An image object, typically created using the THREE.CubeTextureLoader.load | CubeTextureLoader.load() method.
-Set this to true
to trigger an update next time the texture is used. Particularly important for setting the wrap mode.
Indicates whether this texture should be processed by THREE.PMREMGenerator or not.
-Convert the texture to three.js JSON Object/Scene format.
-Optional
meta: string | {}Optional object containing metadata.
-Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Optional
resultBuffer: anyOptional
radius: numberOptional
theta: numberOptional
y: numberCreates a three-dimensional texture from raw data, with parameters to divide it into width, height, and depth
-This creates a[name] with repeating data, 0 to 255
// create a buffer with some data
const sizeX = 64;
const sizeY = 64;
const sizeZ = 64;
const data = new Uint8Array(sizeX * sizeY * sizeZ);
let i = 0;
for (let z = 0; z & lt; sizeZ; z++) {
for (let y = 0; y & lt; sizeY; y++) {
for (let x = 0; x & lt; sizeX; x++) {
data[i] = i % 256;
i++;
}
}
}
// use the buffer to create the texture
const texture = new THREE.Data3DTexture(data, sizeX, sizeY, sizeZ);
texture.needsUpdate = true;
-
-
-Create a new instance of Data3DTexture
-Optional
data: null | BufferSourceArrayBufferView of the texture. Default null
.
Optional
width: numberWidth of the texture. Default 1
.
Optional
height: numberHeight of the texture. Default 1
.
Optional
depth: numberDepth of the texture. Default 1
.
Static
DEFAULT_The Global default value for .anisotropy.
-Static
DEFAULT_The Global default value for .image.
-Static
DEFAULT_The Global default value for .mapping.
-Readonly
isRead-only flag to check if a given object is of type Data3DTexture.
-Readonly
isRead-only flag to check if a given object is of type Texture.
-Readonly
idUnique number for this Texture instance.
-UUID of this object instance.
-Optional name of the object
-The data definition of a texture. A reference to the data source can be shared across textures.
-This is often useful in context of spritesheets where multiple textures render the same data
-but with different Texture transformations.
Array of user-specified mipmaps
-How the image is applied to the object.
-All Texture types except THREE.CubeTexture expect the values be THREE.Mapping
-Lets you select the uv attribute to map the texture to. 0
for uv
, 1
for uv1
, 2
for uv2
and 3
for
-uv3
.
This defines how the Texture is wrapped horizontally and corresponds to U in UV mapping.
-for WEBGL1 - tiling of images in textures only functions if image dimensions are powers of two
-(2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
-Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL1, not three.js.
-WEBGL2 does not have this limitation.
This defines how the Texture is wrapped vertically and corresponds to V in UV mapping.
-for WEBGL1 - tiling of images in textures only functions if image dimensions are powers of two
-(2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
-Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL1, not three.js.
-WEBGL2 does not have this limitation.
The number of samples taken along the axis through the pixel that has the highest density of texels.
-A higher value gives a less blurry result than a basic mipmap, at the cost of more Texture samples being used.
-These define how elements of a 2D texture, or texels, are read by shaders.
-All Texture types except THREE.DepthTexture and THREE.CompressedPixelFormat expect the values be THREE.PixelFormat
-This must correspond to the .format.
-The GPU Pixel Format allows the developer to specify how the data is going to be stored on the GPU.
-Compatible only with WebGL2RenderingContext | WebGL 2 Rendering Context.
-The uv-transform matrix for the texture.
-When .matrixAutoUpdate property is true
.
-Will be updated by the renderer from the properties:
Whether is to update the texture's uv-transform .matrix.
-How much a single repetition of the texture is offset from the beginning, in each direction U and V.
-How many times the texture is repeated across the surface, in each direction U and V.
-The point around which rotation occurs.
-How much the texture is rotated around the center point, in radians.
-If set to true
, the alpha channel, if present, is multiplied into the color channels when the texture is uploaded to the GPU.
Note that this property has no effect for ImageBitmap.
-You need to configure on bitmap creation instead. See THREE.ImageBitmapLoader | ImageBitmapLoader.
The Textures | {@link Texture constants} page for details of other color spaces.
-Textures containing color data should be annotated with SRGBColorSpace THREE.SRGBColorSpace or
-LinearSRGBColorSpace THREE.LinearSRGBColorSpace.
Indicates whether a texture belongs to a render target or not
-An object that can be used to store custom data about the texture.
-This starts at 0
and counts how many times .needsUpdate is set to true
.
Indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target
-textures)
A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true and then the texture is used).
-Overridden with a record type holding data, width and height and depth.
-An image object, typically created using the THREE.TextureLoader.load | TextureLoader.load() method.
-Set this to true
to trigger an update next time the texture is used. Particularly important for setting the wrap mode.
Indicates whether this texture should be processed by THREE.PMREMGenerator or not.
-Convert the texture to three.js JSON Object/Scene format.
-Optional
meta: string | {}Optional object containing metadata.
-Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Creates an array of textures directly from raw data, width and height and depth
-This creates a[name] where each texture has a different color.
// create a buffer with color data
const width = 512;
const height = 512;
const depth = 100;
const size = width * height;
const data = new Uint8Array(4 * size * depth);
for (let i = 0; i & lt; depth; i++) {
const color = new THREE.Color(Math.random(), Math.random(), Math.random());
const r = Math.floor(color.r * 255);
const g = Math.floor(color.g * 255);
const b = Math.floor(color.b * 255);
for (let j = 0; j & lt; size; j++) {
const stride = (i * size + j) * 4;
data[stride] = r;
data[stride + 1] = g;
data[stride + 2] = b;
data[stride + 3] = 255;
}
}
// used the buffer to create a [name]
const texture = new THREE.DataArrayTexture(data, width, height, depth);
texture.needsUpdate = true;
-
-
-This creates a new THREE.DataArrayTexture | DataArrayTexture object.
-Optional
data: null | BufferSourceArrayBufferView of the texture. Default null
.
Optional
width: numberWidth of the texture. Default 1
.
Optional
height: numberHeight of the texture. Default 1
.
Optional
depth: numberDepth of the texture. Default 1
.
Static
DEFAULT_The Global default value for .anisotropy.
-Static
DEFAULT_The Global default value for .image.
-Static
DEFAULT_The Global default value for .mapping.
-Readonly
isRead-only flag to check if a given object is of type DataArrayTexture.
-A set of all layers which need to be updated in the texture. See DataArrayTexture.addLayerUpdate.
-Readonly
isRead-only flag to check if a given object is of type Texture.
-Readonly
idUnique number for this Texture instance.
-UUID of this object instance.
-Optional name of the object
-The data definition of a texture. A reference to the data source can be shared across textures.
-This is often useful in context of spritesheets where multiple textures render the same data
-but with different Texture transformations.
Array of user-specified mipmaps
-How the image is applied to the object.
-All Texture types except THREE.CubeTexture expect the values be THREE.Mapping
-Lets you select the uv attribute to map the texture to. 0
for uv
, 1
for uv1
, 2
for uv2
and 3
for
-uv3
.
This defines how the Texture is wrapped horizontally and corresponds to U in UV mapping.
-for WEBGL1 - tiling of images in textures only functions if image dimensions are powers of two
-(2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
-Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL1, not three.js.
-WEBGL2 does not have this limitation.
This defines how the Texture is wrapped vertically and corresponds to V in UV mapping.
-for WEBGL1 - tiling of images in textures only functions if image dimensions are powers of two
-(2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
-Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL1, not three.js.
-WEBGL2 does not have this limitation.
The number of samples taken along the axis through the pixel that has the highest density of texels.
-A higher value gives a less blurry result than a basic mipmap, at the cost of more Texture samples being used.
-These define how elements of a 2D texture, or texels, are read by shaders.
-All Texture types except THREE.DepthTexture and THREE.CompressedPixelFormat expect the values be THREE.PixelFormat
-This must correspond to the .format.
-The GPU Pixel Format allows the developer to specify how the data is going to be stored on the GPU.
-Compatible only with WebGL2RenderingContext | WebGL 2 Rendering Context.
-The uv-transform matrix for the texture.
-When .matrixAutoUpdate property is true
.
-Will be updated by the renderer from the properties:
Whether is to update the texture's uv-transform .matrix.
-How much a single repetition of the texture is offset from the beginning, in each direction U and V.
-How many times the texture is repeated across the surface, in each direction U and V.
-The point around which rotation occurs.
-How much the texture is rotated around the center point, in radians.
-If set to true
, the alpha channel, if present, is multiplied into the color channels when the texture is uploaded to the GPU.
Note that this property has no effect for ImageBitmap.
-You need to configure on bitmap creation instead. See THREE.ImageBitmapLoader | ImageBitmapLoader.
The Textures | {@link Texture constants} page for details of other color spaces.
-Textures containing color data should be annotated with SRGBColorSpace THREE.SRGBColorSpace or
-LinearSRGBColorSpace THREE.LinearSRGBColorSpace.
Indicates whether a texture belongs to a render target or not
-An object that can be used to store custom data about the texture.
-This starts at 0
and counts how many times .needsUpdate is set to true
.
Indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target
-textures)
A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true and then the texture is used).
-Overridden with a record type holding data, width and height and depth.
-An image object, typically created using the THREE.TextureLoader.load | TextureLoader.load() method.
-Set this to true
to trigger an update next time the texture is used. Particularly important for setting the wrap mode.
Indicates whether this texture should be processed by THREE.PMREMGenerator or not.
-Describes that a specific layer of the texture needs to be updated. Normally when Texture.needsUpdate is
-set to true, the entire compressed texture array is sent to the GPU. Marking specific layers will only transmit
-subsets of all mipmaps associated with a specific depth in the array which is often much more performant.
Resets the layer updates registry. See DataArrayTexture.addLayerUpdate.
-Convert the texture to three.js JSON Object/Scene format.
-Optional
meta: string | {}Optional object containing metadata.
-Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-This class can be used to automatically save the depth information of a rendering into a texture
-Create a new instance of DepthTexture
-Width of the texture.
-Height of the texture.
-Optional
type: TextureDataTypeSee .type. Default THREE.UnsignedByteType or THREE.UnsignedInt248Type
-Optional
mapping: MappingSee .mapping. Default THREE.Texture.DEFAULT_MAPPING
-Optional
wrapS: WrappingSee .wrapS. Default THREE.ClampToEdgeWrapping
-Optional
wrapT: WrappingSee .wrapT. Default THREE.ClampToEdgeWrapping
-Optional
magFilter: MagnificationTextureFilterSee .magFilter. Default THREE.NearestFilter
-Optional
minFilter: MinificationTextureFilterSee .minFilter. Default THREE.NearestFilter
-Optional
anisotropy: numberSee .anisotropy. Default THREE.Texture.DEFAULT_ANISOTROPY
-Optional
format: DepthTexturePixelFormatSee .format. Default THREE.DepthFormat
-Static
DEFAULT_The Global default value for .anisotropy.
-Static
DEFAULT_The Global default value for .image.
-Static
DEFAULT_The Global default value for .mapping.
-Readonly
isRead-only flag to check if a given object is of type DepthTexture.
-Depth textures do not use mipmaps.
-This is used to define the comparison function used when comparing texels in the depth texture to the value in
-the depth buffer. Default is null
which means comparison is disabled.
See THREE.TextureComparisonFunction for functions.
-Readonly
isRead-only flag to check if a given object is of type Texture.
-Readonly
idUnique number for this Texture instance.
-UUID of this object instance.
-Optional name of the object
-The data definition of a texture. A reference to the data source can be shared across textures.
-This is often useful in context of spritesheets where multiple textures render the same data
-but with different Texture transformations.
Array of user-specified mipmaps
-How the image is applied to the object.
-All Texture types except THREE.CubeTexture expect the values be THREE.Mapping
-Lets you select the uv attribute to map the texture to. 0
for uv
, 1
for uv1
, 2
for uv2
and 3
for
-uv3
.
This defines how the Texture is wrapped horizontally and corresponds to U in UV mapping.
-for WEBGL1 - tiling of images in textures only functions if image dimensions are powers of two
-(2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
-Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL1, not three.js.
-WEBGL2 does not have this limitation.
This defines how the Texture is wrapped vertically and corresponds to V in UV mapping.
-for WEBGL1 - tiling of images in textures only functions if image dimensions are powers of two
-(2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
-Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL1, not three.js.
-WEBGL2 does not have this limitation.
The number of samples taken along the axis through the pixel that has the highest density of texels.
-A higher value gives a less blurry result than a basic mipmap, at the cost of more Texture samples being used.
-The GPU Pixel Format allows the developer to specify how the data is going to be stored on the GPU.
-Compatible only with WebGL2RenderingContext | WebGL 2 Rendering Context.
-The uv-transform matrix for the texture.
-When .matrixAutoUpdate property is true
.
-Will be updated by the renderer from the properties:
Whether is to update the texture's uv-transform .matrix.
-How much a single repetition of the texture is offset from the beginning, in each direction U and V.
-How many times the texture is repeated across the surface, in each direction U and V.
-The point around which rotation occurs.
-How much the texture is rotated around the center point, in radians.
-If set to true
, the alpha channel, if present, is multiplied into the color channels when the texture is uploaded to the GPU.
Note that this property has no effect for ImageBitmap.
-You need to configure on bitmap creation instead. See THREE.ImageBitmapLoader | ImageBitmapLoader.
Specifies the alignment requirements for the start of each pixel row in memory.
-The allowable values are:
-1
(byte-alignment)2
(rows aligned to even-numbered bytes)4
(word-alignment)8
(rows start on double-word boundaries).glPixelStorei for more information.
-The Textures | {@link Texture constants} page for details of other color spaces.
-Textures containing color data should be annotated with SRGBColorSpace THREE.SRGBColorSpace or
-LinearSRGBColorSpace THREE.LinearSRGBColorSpace.
Indicates whether a texture belongs to a render target or not
-An object that can be used to store custom data about the texture.
-This starts at 0
and counts how many times .needsUpdate is set to true
.
Indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target
-textures)
A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true and then the texture is used).
-Overridden with a record type holding width and height.
-An image object, typically created using the THREE.TextureLoader.load | TextureLoader.load() method.
-Set this to true
to trigger an update next time the texture is used. Particularly important for setting the wrap mode.
Indicates whether this texture should be processed by THREE.PMREMGenerator or not.
-Convert the texture to three.js JSON Object/Scene format.
-Optional
meta: string | {}Optional object containing metadata.
-Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Optional
resultBuffer: anyOptional
x: numberOptional
y: numberOptional
z: numberOptional
order: EulerOrderStatic
DEFAULT_Readonly
isOptional
order: EulerOrderOptional
order: EulerOrderOptional
update: booleanOptional
order: EulerOrderOptional
update: booleanOptional
order: EulerOrderOptional
array: [x: number, y: number, z: number, order?: EulerOrder]Optional
offset: numberJavaScript events for custom objects
-// Adding events to a custom object
class Car extends EventDispatcher {
start() {
this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } );
}
};
// Using events with the custom object
const car = new Car();
car.addEventListener( 'start', ( event ) => {
alert( event.message );
} );
car.start();
-
-
-Creates THREE.EventDispatcher | EventDispatcher object.
-Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-This class contains the parameters that define linear fog, i.e., that grows linearly denser with the distance.
-The color parameter is passed to the THREE.Color | Color constructor to set the color property
-Optional
near: numberExpects a Float
Optional
far: numberExpects a Float
Readonly
isRead-only flag to check if a given object is of type Fog.
-Optional name of the object
-Fog color.
-The minimum distance to start applying fog.
-The maximum distance at which fog stops being calculated and applied.
-This class contains the parameters that define exponential squared fog, which gives a clear view near the camera and a faster than exponentially densening fog farther from the camera.
-The color parameter is passed to the THREE.Color | Color constructor to set the color property
-Optional
density: numberExpects a Float
Readonly
isRead-only flag to check if a given object is of type FogExp2.
-Optional name of the object
-Fog color.
-Defines how fast the fog will grow dense.
-Return FogExp2 data in JSON format.
-Frustums are used to determine what is inside the camera's field of view. They help speed up the rendering process.
-Optional
coordinateSystem: CoordinateSystemThis buffer attribute class does not construct a VBO.
-Instead, it uses whatever VBO is passed in constructor and can later be altered via the .buffer property.
This creates a new GLBufferAttribute object.
-Must be a WebGLBuffer. See .buffer
-One of WebGL Data Types. See .type
-How many values make up each item (vertex). See .itemSize
-1
, 2
or 4
. The corresponding size (in bytes) for the given type param. See .elementSize
The expected number of vertices in VBO. See .count
-Readonly
isGLBufferRead-only flag to check if a given object is of type GLBufferAttribute.
-Optional name for this attribute instance.
-The current WebGLBuffer instance.
-A WebGL Data Type describing the underlying VBO contents.
-GLenum
)Set this property together with .elementSize. The recommended way is using the .setType() method.
-How many values make up each item (vertex).
-Stores the corresponding size in bytes for the current .type property value.
-The corresponding size (in bytes) for the given "type" param.
-GLenum
)The expected number of vertices in VBO.
-A version number, incremented every time the needsUpdate property is set to true.
-Setting this to true increments .version.
-Sets the .buffer property.
-Sets the both type and elementSize properties.
-Sets the itemSize property.
-Sets the count property.
-Its purpose is to make working with groups of objects syntactically clearer.
-This is almost identical to an Object3D
-const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshBasicMaterial({
color: 0x00ff00
});
const cubeA = new THREE.Mesh(geometry, material);
cubeA.position.set(100, 100, 0);
const cubeB = new THREE.Mesh(geometry, material);
cubeB.position.set(-100, -100, 0);
//create a {@link Group} and add the two cubes
//These cubes can now be rotated / scaled etc as a {@link Group} * const {@link Group} = new THREE.Group();
group.add(cubeA);
group.add(cubeB);
scene.add(group);
-
-
-Creates a new Group.
-Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
isRead-only flag to check if a given object is of type Group.
-Readonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Readonly
typeA Read-only string to check this
object type.
Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-The layer membership of the object.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Convert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
This class stores data for an attribute (such as vertex positions, face indices, normals, colors, UVs, and any custom attributes )
-associated with a THREE.BufferGeometry | BufferGeometry, which allows for more efficient passing of data to the GPU
When working with vector-like data, the .fromBufferAttribute( attribute, index )
helper methods on
-THREE.Vector2.fromBufferAttribute | Vector2,
-THREE.Vector3.fromBufferAttribute | Vector3,
-THREE.Vector4.fromBufferAttribute | Vector4, and
-THREE.Color.fromBufferAttribute | Color classes may be helpful.
Readonly
isReadonly
isOptional name for this attribute instance.
-The TypedArray holding data stored in the buffer.
-The length of vectors that are being stored in the array.
-Defines the intended usage pattern of the data store for optimization purposes.
-Corresponds to the usage parameter of
-WebGLRenderingContext.bufferData.
After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render.
-Configures the bound GPU type for use in shaders. Either FloatType or IntType, default is FloatType.
-Note: this only has an effect for integer arrays and is not configurable for float arrays. For lower precision
-float types, see https://threejs.org/docs/#api/en/core/bufferAttributeTypes/BufferAttributeTypes.
This can be used to only update some components of stored vectors (for example, just the component related to
-color). Use the .addUpdateRange function to add ranges to this array.
Position at which to start update.
-The number of components to update.
-A version number, incremented every time the needsUpdate property is set to true.
-Indicates how the underlying data in the buffer maps to the values in the GLSL shader code.
-Readonly
countReadonly
isRead-only flag to check if a given object is of type BufferAttribute.
-A callback function that is executed after the Renderer has transferred the attribute array data to the GPU.
-Flag to indicate that this attribute has changed and should be re-sent to the GPU.
-Set this to true when you modify the value of the array.
Setting this to true also increments the version.
-Sets the value of the onUploadCallback property.
-function that is executed after the Renderer has transferred the attribute array data to the GPU.
-Set usage
-After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render.
-a copy of this BufferAttribute.
-Copies another BufferAttribute to this BufferAttribute.
-Copy a vector from bufferAttribute[index2] to array[index1].
-Copy the array given here (which can be a normal array or TypedArray
) into array.
TypedArray.set for notes on requirements if copying a TypedArray
.
Applies matrix m to every Vector3 element of this BufferAttribute.
-Applies matrix m to every Vector3 element of this BufferAttribute.
-Applies normal matrix m to every Vector3 element of this BufferAttribute.
-Applies matrix m to every Vector3 element of this BufferAttribute, interpreting the elements as a direction vectors.
-Calls TypedArray.set( value, offset )
-on the array.
Array | Array or TypedArray
from which to copy values.
Optional
offset: numberindex of the array at which to start copying. Expects a Integer
. Default 0
.
RangeError
When offset is negative or is too large.
Convert this object to three.js to the data.attributes
part of JSON Geometry format v4,
"Interleaved" means that multiple attributes, possibly of different types, (e.g., position, normal, uv, color) are packed into a single array buffer.
-An introduction into interleaved arrays can be found here: Interleaved array basics
Create a new instance of InterleavedBuffer
-A TypedArray with a shared buffer. Stores the geometry data.
-The number of typed-array elements per vertex. Expects a Integer
Readonly
isA TypedArray with a shared buffer. Stores the geometry data.
-The number of TypedArray elements per vertex.
-Defines the intended usage pattern of the data store for optimization purposes.
-Corresponds to the usage parameter of
-WebGLRenderingContext.bufferData.
After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render.
-This can be used to only update some components of stored data. Use the .addUpdateRange function to add
-ranges to this array.
Position at which to start update.
-The number of components to update.
-A version number, incremented every time the needsUpdate property is set to true.
-Gives the total number of elements in the array.
-UUID of this object instance.
-A callback function that is executed after the Renderer has transferred the geometry data to the GPU.
-Flag to indicate that this attribute has changed and should be re-sent to the GPU.
-Set this to true when you modify the value of the array.
Setting this to true also increments the version.
-Sets the value of the onUploadCallback property.
-function that is executed after the Renderer has transferred the geometry data to the GPU.
-Set usage
-Corresponds to the usage parameter of
-WebGLRenderingContext.bufferData.
After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render.
-Copies another InterleavedBuffer to this InterleavedBuffer instance.
-Expects a Integer
Expects a Integer
Creates a clone of this InterleavedBuffer.
-This object holds shared array buffers required for properly cloning geometries with interleaved attributes.
-Serializes this InterleavedBuffer.
-Converting to JSON Geometry format v4,
This object holds shared array buffers required for properly serializing geometries with interleaved attributes.
-Create a new instance of THREE.InterleavedBufferAttribute | InterleavedBufferAttribute.
-Optional
normalized: booleanDefault false
.
Optional name for this attribute instance.
-The InterleavedBuffer instance passed in the constructor.
-How many values make up each item.
-The offset in the underlying array buffer where an item starts.
-Readonly
isRead-only flag to check if a given object is of type InterleavedBufferAttribute.
-Flag to indicate that the .data (InterleavedBuffer) attribute has changed and should be re-sent to the GPU.
-Setting this to have the same result of setting true also increments the InterleavedBuffer.needsUpdate of .data.
-Creates a clone of this InterleavedBufferAttribute.
-Optional
data: {}This object holds shared array buffers required for properly cloning geometries with interleaved attributes.
-Serializes this InterleavedBufferAttribute.
-Converting to JSON Geometry format v4,
Optional
data: {}This object holds shared array buffers required for properly serializing geometries with interleaved attributes.
-Abstract
Optional
resultBuffer: anyOptional
interpolation: InterpolationModesStatic
toJSONA THREE.Layers | Layers object assigns an THREE.Object3D | Object3D to 1 or more of 32 layers numbered 0
to 31
- internally the
-layers are stored as a bit mask, and
-by default all Object3Ds are a member of layer 0
.
This can be used to control visibility - an object must share a layer with a camera to be visible when that camera's view is rendered.
-A bit mask storing which of the 32 layers this layers object is currently a member of.
-Abstract
Abstract base class for lights.
-Creates a new Light
-Optional
color: ColorRepresentationHexadecimal color of the light. Default 0xffffff
(white).
Optional
intensity: numberNumeric value of the light's strength/intensity. Expects a Float
. Default 1
.
Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
isRead-only flag to check if a given object is of type HemisphereLight.
-Readonly
typeA Read-only string to check if this
object type.
Color of the light. \
-The light's intensity, or strength.
-The units of intensity depend on the type of light.
A THREE.LightShadow | LightShadow used to calculate shadows for this light.
-Readonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-The layer membership of the object.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-Copies value of all the properties from the source to this instance.
-Optional
recursive: booleanConvert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Fire an event type.
-The event that gets fired.
-Serves as a base class for the other shadow classes.
-Create a new instance of LightShadow
-The light's view of the world.
-The light's view of the world.
-The intensity of the shadow. The default is 1
. Valid values are in the range [0, 1]
.
Shadow map bias, how much to add or subtract from the normalized depth when deciding whether a surface is in shadow.
-Defines how much the position used to query the shadow map is offset along the object normal.
-Setting this to values greater than 1 will blur the edges of the shadow.toi
-High values will cause unwanted banding effects in the shadows - a greater mapSize will allow for a higher value to be used here before these effects become visible. @remark If {@link THREE.WebGLRenderer.shadowMap.type | WebGLRenderer.shadowMap.type is set to PCFSoftShadowMap,
-radius has no effect and it is recommended to increase softness by decreasing mapSize instead.
The amount of samples to use when blurring a VSM shadow map.
-A THREE.Vector2 | Vector2 defining the width and height of the shadow map.
-The depth map generated using the internal camera; a location beyond a pixel's depth is in shadow. Computed internally during rendering.
-The distribution map generated using the internal camera; an occlusion is calculated based on the distribution of depths. Computed internally during rendering.
-Model to shadow camera space, to compute location and depth in shadow map.
-Stored in a Matrix4.
Enables automatic updates of the light's shadow. If you do not require dynamic lighting / shadows, you may set this to false
.
When set to true
, shadow maps will be updated in the next render
call.
-If you have set autoUpdate to false
, you will need to set this property to true
and then make a render call to update the light's shadow.
Copies value of all the properties from the {@link LightShadow | source} to this Light.
-Creates a new LightShadow with the same properties as this one.
-Optional
recursive: booleanSerialize this LightShadow.
-Optional
resultBuffer: anyBase class for implementing loaders.
-Optional
manager: LoadingManagerStatic
DEFAULT_Optional
onProgress: (event: ProgressEvent) => voidOptional
onError: (err: unknown) => voidOptional
onProgress: (event: ProgressEvent) => voidHandles and keeps track of loaded and pending data.
-Optional
onLoad: () => voidOptional
onProgress: (url: string, loaded: number, total: number) => voidOptional
onError: (url: string) => voidOptional
onWill be called when loading of an item starts.
-The url of the item that started loading.
-The number of items already loaded so far.
-The total amount of items to be loaded.
-Will be called when all items finish loading.
-The default is a function with empty body.
Will be called for each loaded item.
-The default is a function with empty body.
The url of the item just loaded.
-The number of items already loaded so far.
-The total amount of items to be loaded.
-Will be called when item loading fails.
-The default is a function with empty body.
The url of the item that errored.
-If provided, the callback will be passed each resource URL before a request is sent.
-The callback may return the original URL, or a new URL to override loading behavior.
-This behavior can be used to load assets from .ZIP files, drag-and-drop APIs, and Data URIs.
Optional
callback: (url: string) => stringURL modifier callback. Called with url argument, and must return resolvedURL.
-Materials describe the appearance of objects. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer.
-Readonly
isRead-only flag to check if a given object is of type Material.
-Value is the string 'Material'. This shouldn't be changed, and can be used to find all objects of this type in a
-scene.
Enables alpha hashed transparency, an alternative to .transparent or .alphaTest. The material
-will not be rendered if opacity is lower than a random threshold. Randomization introduces some grain or noise,
-but approximates alpha blending without the associated problems of sorting. Using TAARenderPass can reduce the
-resulting noise.
Enables alpha to coverage. Can only be used with MSAA-enabled rendering contexts (meaning when the renderer was
-created with antialias parameter set to true
). Enabling this will smooth aliasing on clip plane edges and
-alphaTest-clipped edges.
Represents the alpha value of the constant blend color. This property has only an effect when using custom
-blending with ConstantAlphaFactor or OneMinusConstantAlphaFactor.
Represent the RGB values of the constant blend color. This property has only an effect when using custom
-blending with ConstantColorFactor or OneMinusConstantColorFactor.
Blending destination. It's one of the blending mode constants defined in Three.js. Default is OneMinusSrcAlphaFactor.
-The tranparency of the .blendDst. Default is null.
-Blending equation to use when applying blending. It's one of the constants defined in Three.js. Default is AddEquation.
-The tranparency of the .blendEquation. Default is null.
-Which blending to use when displaying objects with this material. Default is NormalBlending.
-Blending source. It's one of the blending mode constants defined in Three.js. Default is SrcAlphaFactor.
-The tranparency of the .blendSrc. Default is null.
-Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union. Default is false.
-User-defined clipping planes specified as THREE.Plane objects in world space.
-These planes apply to the objects this material is attached to.
-Points in space whose signed distance to the plane is negative are clipped (not rendered).
-See the WebGL / clipping /intersection example. Default is null.
Defines whether to clip shadows according to the clipping planes specified on this material. Default is false.
-Whether to render the material's color. This can be used in conjunction with a mesh's .renderOrder property to create invisible objects that occlude other objects. Default is true.
-Custom defines to be injected into the shader. These are passed in form of an object literal, with key/value pairs. { MY_CUSTOM_DEFINE: '' , PI2: Math.PI * 2 }.
-The pairs are defined in both vertex and fragment shaders. Default is undefined.
Which depth function to use. Default is LessEqualDepth. See the depth mode constants for all possible values.
-Whether to have depth test enabled when rendering this material. When the depth test is disabled, the depth write
-will also be implicitly disabled.
Whether rendering this material has any effect on the depth buffer. Default is true.
-When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
Unique number of this material instance.
-Whether rendering this material has any effect on the stencil buffer. Default is false.
-The stencil comparison function to use. Default is AlwaysStencilFunc. See stencil operation constants for all possible values.
-The value to use when performing stencil comparisons or stencil operations. Default is 0.
-The bit mask to use when writing to the stencil buffer. Default is 0xFF.
-The bit mask to use when comparing against the stencil buffer. Default is 0xFF.
-Which stencil operation to perform when the comparison function returns false. Default is KeepStencilOp. See the stencil operation constants for all possible values.
-Which stencil operation to perform when the comparison function returns true but the depth test fails.
-Default is KeepStencilOp.
-See the stencil operation constants for all possible values.
Which stencil operation to perform when the comparison function returns true and the depth test passes.
-Default is KeepStencilOp.
-See the stencil operation constants for all possible values.
Material name. Default is an empty string.
-Opacity. Default is 1.
-Whether to use polygon offset. Default is false. This corresponds to the POLYGON_OFFSET_FILL WebGL feature.
-Sets the polygon offset factor. Default is 0.
-Sets the polygon offset units. Default is 0.
-Override the renderer's default precision for this material. Can be "highp", "mediump" or "lowp". Defaults is null.
-Whether to premultiply the alpha (transparency) value. See WebGL / Materials / Transparency for an example of the difference. Default is false.
-Whether to apply dithering to the color to remove the appearance of banding. Default is false.
-Defines which of the face sides will be rendered - front, back or both.
-Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide.
Defines which of the face sides will cast shadows. Default is null.
-If null, the value is opposite that of side, above.
Defines whether this material is tone mapped according to the renderer's
-toneMapping setting. It is ignored when rendering to a render target or using
-post processing.
Defines whether this material is transparent. This has an effect on rendering as transparent objects need special treatment and are rendered after non-transparent objects.
-When set to true, the extent to which the material is transparent is controlled by setting it's .opacity property.
UUID of this material instance. This gets automatically assigned, so this shouldn't be edited.
-Defines whether vertex coloring is used. Default is false.
-Defines whether this material is visible. Default is true.
-An object that can be used to store custom data about the Material. It should not hold references to functions as these will not be cloned.
-This starts at 0 and counts how many times .needsUpdate is set to true.
-Gets the alpha value to be used when running an alpha test. Default is 0.
-Sets the alpha value to be used when running an alpha test. Default is 0.
-Specifies that the material needs to be updated, WebGL wise. Set it to true if you made changes that need to be reflected in WebGL.
-This property is automatically set to true when instancing a new material.
An optional callback that is executed immediately before the material is used to render a 3D object.
-Unlike properties, the callback is not supported by .clone(), .copy() and .toJSON().
-This callback is only supported in WebGLRenderer
(not WebGPURenderer
).
An optional callback that is executed immediately before the shader program is compiled.
-This function is called with the shader source code as a parameter.
-Useful for the modification of built-in materials.
-Unlike properties, the callback is not supported by .clone(), .copy() and .toJSON().
-This callback is only supported in WebGLRenderer
(not WebGPURenderer
).
WebGL program parameters
-WebGLRenderer context that is initializing the material
-Sets the properties based on the values.
-A container with parameters.
-Convert the material to three.js JSON format.
-Optional
meta: JSONMetaObject containing metadata such as textures or images for the material.
-Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer
-used in your app.
Material textures must be disposed of by the dispose() method of Texture.
-Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Creates an identity matrix.
-Creates a 3x3 matrix with the given arguments in row-major order.
-Sets this matrix as a 2D translation transform:
-1, 0, x,
0, 1, y,
0, 0, 1
-
-
-the amount to translate.
-Sets this matrix as a 2D translation transform:
-1, 0, x,
0, 1, y,
0, 0, 1
-
-
-the amount to translate in the X axis.
-the amount to translate in the Y axis.
-Writes the elements of this matrix to an array in
-column-major format.
Writes the elements of this matrix to an array in
-column-major format.
array to store the resulting vector in. If not given a new array will be created.
-Optional
offset: number(optional) offset in the array at which to put the result.
-A 4x4 Matrix.
-// Simple rig for rotating around 3 axes
const m = new THREE.Matrix4();
const m1 = new THREE.Matrix4();
const m2 = new THREE.Matrix4();
const m3 = new THREE.Matrix4();
const alpha = 0;
const beta = Math.PI;
const gamma = Math.PI/2;
m1.makeRotationX( alpha );
m2.makeRotationY( beta );
m3.makeRotationZ( gamma );
m.multiplyMatrices( m1, m2 );
m.multiply( m3 );
-
-
-Creates an identity matrix.
-Creates a 4x4 matrix with the given arguments in row-major order.
-Sets all fields of this matrix.
-Computes determinant of this matrix.
-Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
Sets this matrix as rotation transform around axis by angle radians.
-Based on http://www.gamedev.net/reference/articles/article1199.asp.
Rotation axis.
-Rotation angle in radians.
-Sets this matrix to the transformation composed of translation, rotation and scale.
-Decomposes this matrix into it's position, quaternion and scale components.
-Creates a perspective projection matrix.
-Optional
coordinateSystem: CoordinateSystemCreates an orthographic projection matrix.
-Optional
coordinateSystem: CoordinateSystemWrites the elements of this matrix to an array in
-column-major format.
Writes the elements of this matrix to an array in
-column-major format.
array to store the resulting vector in.
-Optional
offset: number(optional) offset in the array at which to put the result.
-Class representing triangular polygon mesh based objects.
-Also serves as a base for other classes such as THREE.SkinnedMesh | SkinnedMesh, THREE.InstancedMesh | InstancedMesh.
-const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshBasicMaterial({
color: 0xffff00
});
const {@link Mesh} = new THREE.Mesh(geometry, material);
scene.add(mesh);
-
-
-Create a new instance of Mesh
-Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
isRead-only flag to check if a given object is of type Mesh.
-Readonly
typeAn instance of THREE.BufferGeometry | BufferGeometry (or derived classes), defining the object's structure.
-An instance of material derived from the THREE.Material | Material base class or an array of materials, defining the object's appearance.
-Optional
morphAn array of weights typically from 0-1
that specify how much of the morph is applied.
undefined
, but reset to a blank array by .updateMorphTargets().
Optional
morphA dictionary of morphTargets based on the morphTarget.name
property.
undefined
, but rebuilt by .updateMorphTargets().
Readonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-The layer membership of the object.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-Updates the morphTargets to have no influence on the object
-Resets the morphTargetInfluences and morphTargetDictionary properties.
-Convert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
This is the base class for most objects in three.js and provides a set of properties and methods for manipulating objects in 3D space.
-This creates a new Object3D object.
-Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Readonly
typeA Read-only string to check this
object type.
Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-The layer membership of the object.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Convert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
Camera that uses perspective projection.
-This projection mode is designed to mimic the way the human eye sees
const camera = new THREE.PerspectiveCamera(45, width / height, 1, 1000);
scene.add(camera);
-
-
-Creates a new PerspectiveCamera.
-Optional
fov: numberCamera frustum vertical field of view. Default 50
.
Optional
aspect: numberCamera frustum aspect ratio. Default 1
.
Optional
near: numberCamera frustum near plane. Default 0.1
.
Optional
far: numberCamera frustum far plane. Default 2000
.
Together these define the camera's viewing frustum.
-Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
isRead-only flag to check if a given object is of type Camera.
-Readonly
typeGets or sets the zoom factor of the camera.
-Camera frustum vertical field of view, from bottom to top of view, in degrees.
-Camera frustum aspect ratio, usually the canvas width / canvas height.
-Camera frustum near plane.
-The valid range is greater than 0
and less than the current value of the .far plane.
Camera frustum far plane.
-Must be greater than the current value of .near plane.
-Object distance used for stereoscopy and depth-of-field effects.
-Frustum window specification or null.
-This is set using the .setViewOffset method and cleared using .clearViewOffset.
Film size used for the larger axis.
-This parameter does not influence the projection matrix unless .filmOffset is set to a nonzero value.
Horizontal off-center offset in the same unit as .filmGauge.
-Readonly
isRead-only flag to check if a given object is of type Camera.
-The THREE.Layers | layers that the Camera is a member of.
-Objects must share at least one layer with the Camera to be n when the camera's viewpoint is rendered.
-This is the inverse of matrixWorld.
-MatrixWorld contains the Matrix which has the world transform of the Camera .
-This is the matrix which contains the projection.
-This is the inverse of projectionMatrix.
-Optional
viewportReadonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-Returns the focal length of the current .fov | fov in respect to .filmGauge.
-Sets the FOV by focal length in respect to the current .filmGauge.
-Expects a Float
Returns the current vertical field of view angle in degrees considering .zoom.
-Returns the width of the image on the film
-If .aspect. is greater than or equal to one (landscape format), the result equals .filmGauge.
-Returns the height of the image on the film
-If .aspect. is less than or equal to one (portrait format), the result equals .filmGauge.
-Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.
-Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.
Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
-Copies the result into the target Vector2, where x is width and y is height.
Sets an offset in a larger frustum.
-Full width of multiview setup Expects a Float
.
Full height of multiview setup Expects a Float
.
Horizontal offset of subcamera Expects a Float
.
Vertical offset of subcamera Expects a Float
.
Width of subcamera Expects a Float
.
Height of subcamera Expects a Float
.
This is useful for multi-window or multi-monitor/multi-machine setups.
-For example, if you have 3x2 monitors and each monitor is 1920x1080 and
-the monitors are in grid like this
┌───┬───┬───┐
│ A │ B │ C │
├───┼───┼───┤
│ D │ E │ F │
└───┴───┴───┘
-
-
-then for each monitor you would call it like this
- const w = 1920;
const h = 1080;
const fullWidth = w * 3;
const fullHeight = h * 2;
// Monitor - A
camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
// Monitor - B
camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
// Monitor - C
camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
// Monitor - D
camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
// Monitor - E
camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
// Monitor - F
camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
-
-
-Note there is no reason monitors have to be the same size or in a grid.
-Removes any offset set by the .setViewOffset method.
-Optional
frameHeight: numberUse .setFocalLength() and .filmGauge instead.
-Convert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Fire an event type.
-The event that gets fired.
-Use .intersectsLine() instead.
-Implementation of a quaternion. This is used for rotating things without incurring in the dreaded gimbal lock issue, amongst other advantages.
-Optional
x: numberx coordinate
-Optional
y: numbery coordinate
-Optional
z: numberz coordinate
-Optional
w: numberw coordinate
-Readonly
isStatic
slerpStatic
multiplyCopies values of q to this quaternion.
-Sets this quaternion from rotation specified by axis and angle.
-Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm.
-Axis have to be normalized, angle is in radians.
Sets this quaternion from rotation component of m. Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm.
-Multiplies this quaternion by b.
-Sets this quaternion to a x b
-Adapted from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm.
Sets this quaternion's x, y, z and w value from the provided array or array-like.
-the source array or array-like.
-Optional
offset: number(optional) offset into the array. Default is 0.
-Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.
-Optional
array: number[](optional) array to store the quaternion to. If this is not provided, a new array will be created.
-Optional
offset: number(optional) optional offset into the array.
-The created or provided array.
-Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.
-Optional
array: QuaternionTuple(optional) array to store the quaternion to. If this is not provided, a new array will be created.
-Optional
offset: 0(optional) optional offset into the array.
-The created or provided array.
-Copies x, y, z and w into the provided array-like.
-array-like to store the quaternion to.
-Optional
offset: number(optional) optional offset into the array.
-The provided array-like.
-Sets x, y, z, w properties of this quaternion from the attribute.
-the source attribute.
-index in the attribute.
-Use .intersectsBox() instead.
-Use .intersectsPlane() instead.
-Use .intersectsSphere() instead.
-This class is designed to assist with raycasting
-Raycasting is used for mouse picking (working out what objects in the 3d space the mouse is over) amongst other things.
-const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
function onPointerMove(event) {
// calculate pointer position in normalized device coordinates (-1 to +1) for both components
pointer.x = (event.clientX / window.innerWidth) * 2 - 1;
pointer.y = -(event.clientY / window.innerHeight) * 2 + 1;
}
function render() {
// update the picking ray with the camera and pointer position
raycaster.setFromCamera(pointer, camera);
// calculate objects intersecting the picking ray
const intersects = raycaster.intersectObjects(scene.children);
for (let i = 0; i & lt; intersects.length; i++) {
intersects[i].object.material.color.set(0xff0000);
}
renderer.render(scene, camera);
}
window.addEventListener('pointermove', onPointerMove);
window.requestAnimationFrame(render);
-
-
-This creates a new Raycaster object.
-Optional
origin: Vector3The origin vector where the ray casts from. Default new Vector3()
Optional
direction: Vector3The direction vector that gives direction to the ray. Should be normalized. Default new Vector3(0, 0, -1)
Optional
near: numberAll results returned are further away than near. Near can't be negative. Expects a Float
. Default 0
Optional
far: numberAll results returned are closer than far. Far can't be lower than near. Expects a Float
. Default Infinity
The THREE.RaycasterRay | Ray used for the raycasting.
-The near factor of the raycaster. This value indicates which objects can be discarded based on the distance.
-This value shouldn't be negative and should be smaller than the far property.
The far factor of the raycaster. This value indicates which objects can be discarded based on the distance.
-This value shouldn't be negative and should be larger than the near property.
The camera to use when raycasting against view-dependent objects such as billboarded objects like THREE.Sprites | Sprites.
-This field can be set manually or is set when calling setFromCamera.
Used by Raycaster to selectively ignore 3D objects when performing intersection tests.
-The following code example ensures that only 3D objects on layer 1
will be honored by the instance of Raycaster.
raycaster.layers.set( 1 );
object.layers.enable( 1 );
-
-
-An data object where threshold is the precision of the Raycaster when intersecting objects, in world units.
-Updates the ray with a new origin and direction.
-The controller to copy the position and direction from.
-Checks all intersection between the ray and the object with or without the descendants
-The object to check for intersection with the ray.
-Optional
recursive: booleanIf true, it also checks all descendants. Otherwise it only checks intersection with the object. Default true
Optional
optionalTarget: Intersection<TIntersected>[]Target to set the result. Otherwise a new Array | Array is instantiated.
-If set, you must clear this array prior to each call (i.e., array.length = 0;). Default []
An array of intersections is returned.
-Checks all intersection between the ray and the objects with or without the descendants
-The objects to check for intersection with the ray.
-Optional
recursive: booleanIf true, it also checks all descendants of the objects. Otherwise it only checks intersection with the objects. Default true
Optional
optionalTarget: Intersection<TIntersected>[]Target to set the result. Otherwise a new Array | Array is instantiated.
-If set, you must clear this array prior to each call (i.e., array.length = 0;). Default []
An array of intersections is returned.
-JavaScript events for custom objects
-// Adding events to a custom object
class Car extends EventDispatcher {
start() {
this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } );
}
};
// Using events with the custom object
const car = new Car();
car.addEventListener( 'start', ( event ) => {
alert( event.message );
} );
car.start();
-
-
-Optional
width: numberOptional
height: numberOptional
options: RenderTargetOptionsReadonly
isDefines whether the depth buffer should be resolved when rendering into a multisampled render target.
-Defines whether the stencil buffer should be resolved when rendering into a multisampled render target.
-This property has no effect when .resolveDepthBuffer is set to false
.
Defines the count of MSAA samples. Can only be used with WebGL 2. Default is 0.
-Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Scenes allow you to set up what and where is to be rendered by three.js
-Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
isRead-only flag to check if a given object is of type Scene.
-A fog instance defining the type of fog that affects everything rendered in the scene.
-Sets the blurriness of the background. Only influences environment maps assigned to THREE.Scene.background | Scene.background.
-Attenuates the color of the background. Only applies to background textures.
-Forces everything in the Scene to be rendered with the defined material.
-Defines the background of the scene.
-The rotation of the background in radians. Only influences environment maps assigned to .background.
-Default is (0,0,0)
.
Sets the environment map for all physical materials in the scene.
-However, it's not possible to overwrite an existing texture assigned to THREE.MeshStandardMaterial.envMap | MeshStandardMaterial.envMap.
Attenuates the color of the environment. Only influences environment maps assigned to Scene.environment.
-The rotation of the environment map in radians. Only influences physical materials in the scene when
-.environment is used. Default is (0,0,0)
.
Readonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-The layer membership of the object.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Fire an event type.
-The event that gets fired.
-Represents the data Source of a texture.
-Readonly
isFlag to check if a given object is of type Source.
-Readonly
idThe actual data of a texture.
-This property is only relevant when .needsUpdate is set to true
and provides more control on how
-texture data should be processed.
-When dataReady
is set to false
, the engine performs the memory allocation (if necessary) but does not
-transfer the data into the GPU memory.
UUID of this object instance.
-This starts at 0
and counts how many times .needsUpdate is set to true
.
When the property is set to true
, the engine allocates the memory for the texture (if necessary) and triggers
-the actual texture upload to the GPU next time the source is used.
Convert the data Source to three.js JSON Object/Scene format.
-Optional
meta: string | {}Optional object containing metadata.
-Readonly
isRead-only flag to check if a given object is of type Sphere.
-Use .isEmpty() instead.
-A Sprite is a plane that always faces towards the camera, generally with a partially transparent texture applied.
-Creates a new Sprite.
-Optional
material: SpriteMaterialAn instance of THREE.SpriteMaterial | SpriteMaterial. Default THREE.SpriteMaterial | new SpriteMaterial()
, with white color.
Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
isRead-only flag to check if a given object is of type Sprite.
-Readonly
typeAn instance of THREE.SpriteMaterial | SpriteMaterial, defining the object's appearance.
-The sprite's anchor point, and the point around which the Sprite rotates.
-A value of (0.5, 0.5) corresponds to the midpoint of the sprite.
-A value of (0, 0) corresponds to the lower left corner of the sprite.
Readonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-The layer membership of the object.
-Object gets rendered if true
.
Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Convert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
Materials describe the appearance of objects. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer.
-Optional
parameters: SpriteMaterialParametersReadonly
isRead-only flag to check if a given object is of type SpriteMaterial.
-Whether the material is affected by fog. Default is true.
-Readonly
isRead-only flag to check if a given object is of type Material.
-Value is the string 'Material'. This shouldn't be changed, and can be used to find all objects of this type in a
-scene.
Enables alpha hashed transparency, an alternative to .transparent or .alphaTest. The material
-will not be rendered if opacity is lower than a random threshold. Randomization introduces some grain or noise,
-but approximates alpha blending without the associated problems of sorting. Using TAARenderPass can reduce the
-resulting noise.
Enables alpha to coverage. Can only be used with MSAA-enabled rendering contexts (meaning when the renderer was
-created with antialias parameter set to true
). Enabling this will smooth aliasing on clip plane edges and
-alphaTest-clipped edges.
Represents the alpha value of the constant blend color. This property has only an effect when using custom
-blending with ConstantAlphaFactor or OneMinusConstantAlphaFactor.
Represent the RGB values of the constant blend color. This property has only an effect when using custom
-blending with ConstantColorFactor or OneMinusConstantColorFactor.
Blending destination. It's one of the blending mode constants defined in Three.js. Default is OneMinusSrcAlphaFactor.
-The tranparency of the .blendDst. Default is null.
-Blending equation to use when applying blending. It's one of the constants defined in Three.js. Default is AddEquation.
-The tranparency of the .blendEquation. Default is null.
-Which blending to use when displaying objects with this material. Default is NormalBlending.
-Blending source. It's one of the blending mode constants defined in Three.js. Default is SrcAlphaFactor.
-The tranparency of the .blendSrc. Default is null.
-Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union. Default is false.
-User-defined clipping planes specified as THREE.Plane objects in world space.
-These planes apply to the objects this material is attached to.
-Points in space whose signed distance to the plane is negative are clipped (not rendered).
-See the WebGL / clipping /intersection example. Default is null.
Defines whether to clip shadows according to the clipping planes specified on this material. Default is false.
-Whether to render the material's color. This can be used in conjunction with a mesh's .renderOrder property to create invisible objects that occlude other objects. Default is true.
-Custom defines to be injected into the shader. These are passed in form of an object literal, with key/value pairs. { MY_CUSTOM_DEFINE: '' , PI2: Math.PI * 2 }.
-The pairs are defined in both vertex and fragment shaders. Default is undefined.
Which depth function to use. Default is LessEqualDepth. See the depth mode constants for all possible values.
-Whether to have depth test enabled when rendering this material. When the depth test is disabled, the depth write
-will also be implicitly disabled.
Whether rendering this material has any effect on the depth buffer. Default is true.
-When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
Unique number of this material instance.
-Whether rendering this material has any effect on the stencil buffer. Default is false.
-The stencil comparison function to use. Default is AlwaysStencilFunc. See stencil operation constants for all possible values.
-The value to use when performing stencil comparisons or stencil operations. Default is 0.
-The bit mask to use when writing to the stencil buffer. Default is 0xFF.
-The bit mask to use when comparing against the stencil buffer. Default is 0xFF.
-Which stencil operation to perform when the comparison function returns false. Default is KeepStencilOp. See the stencil operation constants for all possible values.
-Which stencil operation to perform when the comparison function returns true but the depth test fails.
-Default is KeepStencilOp.
-See the stencil operation constants for all possible values.
Which stencil operation to perform when the comparison function returns true and the depth test passes.
-Default is KeepStencilOp.
-See the stencil operation constants for all possible values.
Material name. Default is an empty string.
-Opacity. Default is 1.
-Whether to use polygon offset. Default is false. This corresponds to the POLYGON_OFFSET_FILL WebGL feature.
-Sets the polygon offset factor. Default is 0.
-Sets the polygon offset units. Default is 0.
-Override the renderer's default precision for this material. Can be "highp", "mediump" or "lowp". Defaults is null.
-Whether to premultiply the alpha (transparency) value. See WebGL / Materials / Transparency for an example of the difference. Default is false.
-Whether to apply dithering to the color to remove the appearance of banding. Default is false.
-Defines which of the face sides will be rendered - front, back or both.
-Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide.
Defines which of the face sides will cast shadows. Default is null.
-If null, the value is opposite that of side, above.
Defines whether this material is tone mapped according to the renderer's
-toneMapping setting. It is ignored when rendering to a render target or using
-post processing.
UUID of this material instance. This gets automatically assigned, so this shouldn't be edited.
-Defines whether vertex coloring is used. Default is false.
-Defines whether this material is visible. Default is true.
-An object that can be used to store custom data about the Material. It should not hold references to functions as these will not be cloned.
-This starts at 0 and counts how many times .needsUpdate is set to true.
-Gets the alpha value to be used when running an alpha test. Default is 0.
-Sets the alpha value to be used when running an alpha test. Default is 0.
-Specifies that the material needs to be updated, WebGL wise. Set it to true if you made changes that need to be reflected in WebGL.
-This property is automatically set to true when instancing a new material.
Sets the properties based on the values.
-Copy the parameters from the passed material into this material.
-An optional callback that is executed immediately before the material is used to render a 3D object.
-Unlike properties, the callback is not supported by .clone(), .copy() and .toJSON().
-This callback is only supported in WebGLRenderer
(not WebGPURenderer
).
An optional callback that is executed immediately before the shader program is compiled.
-This function is called with the shader source code as a parameter.
-Useful for the modification of built-in materials.
-Unlike properties, the callback is not supported by .clone(), .copy() and .toJSON().
-This callback is only supported in WebGLRenderer
(not WebGPURenderer
).
WebGL program parameters
-WebGLRenderer context that is initializing the material
-Convert the material to three.js JSON format.
-Optional
meta: JSONMetaObject containing metadata such as textures or images for the material.
-Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer
-used in your app.
Material textures must be disposed of by the dispose() method of Texture.
-Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Create a Texture to apply to a surface or as a reflection or refraction map.
-After the initial use of a texture, its dimensions, format, and type cannot be changed
-Instead, call .dispose() on the Texture and instantiate a new Texture.
// load a texture, set wrap mode to repeat
const texture = new THREE.TextureLoader().load("textures/water.jpg");
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(4, 4);
-
-
-This creates a new THREE.Texture | Texture object.
-Optional
image: OffscreenCanvas | TexImageSourceSee .image. Default THREE.Texture.DEFAULT_IMAGE
-Optional
mapping: MappingSee .mapping. Default THREE.Texture.DEFAULT_MAPPING
-Optional
wrapS: WrappingSee .wrapS. Default THREE.ClampToEdgeWrapping
-Optional
wrapT: WrappingSee .wrapT. Default THREE.ClampToEdgeWrapping
-Optional
magFilter: MagnificationTextureFilterSee .magFilter. Default THREE.LinearFilter
-Optional
minFilter: MinificationTextureFilterSee .minFilter. Default THREE.LinearMipmapLinearFilter
-Optional
format: PixelFormatSee .format. Default THREE.RGBAFormat
-Optional
type: TextureDataTypeSee .type. Default THREE.UnsignedByteType
-Optional
anisotropy: numberSee .anisotropy. Default THREE.Texture.DEFAULT_ANISOTROPY
-Optional
colorSpace: stringSee .colorSpace. Default THREE.NoColorSpace
-Static
DEFAULT_The Global default value for .anisotropy.
-Static
DEFAULT_The Global default value for .image.
-Static
DEFAULT_The Global default value for .mapping.
-Readonly
isRead-only flag to check if a given object is of type Texture.
-Readonly
idUnique number for this Texture instance.
-UUID of this object instance.
-Optional name of the object
-The data definition of a texture. A reference to the data source can be shared across textures.
-This is often useful in context of spritesheets where multiple textures render the same data
-but with different Texture transformations.
Array of user-specified mipmaps
-How the image is applied to the object.
-All Texture types except THREE.CubeTexture expect the values be THREE.Mapping
-Lets you select the uv attribute to map the texture to. 0
for uv
, 1
for uv1
, 2
for uv2
and 3
for
-uv3
.
This defines how the Texture is wrapped horizontally and corresponds to U in UV mapping.
-for WEBGL1 - tiling of images in textures only functions if image dimensions are powers of two
-(2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
-Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL1, not three.js.
-WEBGL2 does not have this limitation.
This defines how the Texture is wrapped vertically and corresponds to V in UV mapping.
-for WEBGL1 - tiling of images in textures only functions if image dimensions are powers of two
-(2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
-Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL1, not three.js.
-WEBGL2 does not have this limitation.
How the Texture is sampled when a texel covers more than one pixel.
-How the Texture is sampled when a texel covers less than one pixel.
-The number of samples taken along the axis through the pixel that has the highest density of texels.
-A higher value gives a less blurry result than a basic mipmap, at the cost of more Texture samples being used.
-These define how elements of a 2D texture, or texels, are read by shaders.
-All Texture types except THREE.DepthTexture and THREE.CompressedPixelFormat expect the values be THREE.PixelFormat
-This must correspond to the .format.
-The GPU Pixel Format allows the developer to specify how the data is going to be stored on the GPU.
-Compatible only with WebGL2RenderingContext | WebGL 2 Rendering Context.
-The uv-transform matrix for the texture.
-When .matrixAutoUpdate property is true
.
-Will be updated by the renderer from the properties:
Whether is to update the texture's uv-transform .matrix.
-How much a single repetition of the texture is offset from the beginning, in each direction U and V.
-How many times the texture is repeated across the surface, in each direction U and V.
-The point around which rotation occurs.
-How much the texture is rotated around the center point, in radians.
-Whether to generate mipmaps, (if possible) for a texture.
-If set to true
, the alpha channel, if present, is multiplied into the color channels when the texture is uploaded to the GPU.
Note that this property has no effect for ImageBitmap.
-You need to configure on bitmap creation instead. See THREE.ImageBitmapLoader | ImageBitmapLoader.
If set to true
, the texture is flipped along the vertical axis when uploaded to the GPU.
Note that this property has no effect for ImageBitmap.
-You need to configure on bitmap creation instead. See THREE.ImageBitmapLoader | ImageBitmapLoader.
Specifies the alignment requirements for the start of each pixel row in memory.
-The allowable values are:
-1
(byte-alignment)2
(rows aligned to even-numbered bytes)4
(word-alignment)8
(rows start on double-word boundaries).glPixelStorei for more information.
-The Textures | {@link Texture constants} page for details of other color spaces.
-Textures containing color data should be annotated with SRGBColorSpace THREE.SRGBColorSpace or
-LinearSRGBColorSpace THREE.LinearSRGBColorSpace.
Indicates whether a texture belongs to a render target or not
-An object that can be used to store custom data about the texture.
-This starts at 0
and counts how many times .needsUpdate is set to true
.
Indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target
-textures)
A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true and then the texture is used).
-An image object, typically created using the THREE.TextureLoader.load | TextureLoader.load() method.
-Set this to true
to trigger an update next time the texture is used. Particularly important for setting the wrap mode.
Indicates whether this texture should be processed by THREE.PMREMGenerator or not.
-Convert the texture to three.js JSON Object/Scene format.
-Optional
meta: string | {}Optional object containing metadata.
-Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Class for loading a texture.
-Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object.
Optional
manager: LoadingManagerStatic
DEFAULT_Optional
onLoad: (data: Texture) => voidOptional
onProgress: (event: ProgressEvent) => voidOptional
onError: (err: unknown) => voidOptional
onProgress: (event: ProgressEvent) => voidStatic
getStatic
getStatic
containsStatic
getStatic
getStatic
isThe main interface of VFX-JS.
-The main interface of VFX-JS.
+Update the texture for the given element.
If the element is an HTMLImageElemnt or HTMLVideoElement, VFX-JS does nothing.
Otherwise, VFX-JS captures a new snapshot of the DOM tree under the elemnt and udpate the WebGL texture with it.
This is useful to apply effects to eleents whose contents change dynamically (e.g. input, textare etc).
-2D vector.
-Readonly
isCopies value of v to this vector.
-Adds v to this vector.
-Sets this vector to a + b.
-Adds the multiple of v and s to this vector.
-Subtracts v from this vector.
-Sets this vector to a - b.
-Multiplies this vector by v.
-Divides this vector by v.
-If this vector's x or y value is greater than v's x or y value, replace that value with the corresponding min value.
-If this vector's x or y value is less than v's x or y value, replace that value with the corresponding max value.
-If this vector's x or y value is greater than the max vector's x or y value, it is replaced by the corresponding value.
-If this vector's x or y value is less than the min vector's x or y value, it is replaced by the corresponding value.
the minimum x and y values.
-the maximum x and y values in the desired range.
-If this vector's x or y values are greater than the max value, they are replaced by the max value.
-If this vector's x or y values are less than the min value, they are replaced by the min value.
the minimum value the components will be clamped to.
-the maximum value the components will be clamped to.
-If this vector's length is greater than the max value, it is replaced by the max value.
-If this vector's length is less than the min value, it is replaced by the min value.
the minimum value the length will be clamped to.
-the maximum value the length will be clamped to.
-Computes dot product of this vector and v.
-Computes cross product of this vector and v.
-Computes the Manhattan length of this vector.
-see Taxicab Geometry
-Computes distance of this vector to v.
-Computes squared distance of this vector to v.
-Computes the Manhattan length (distance) from this vector to the given vector v
-see Taxicab Geometry
-Linearly interpolates between this vector and v, where alpha is the distance along the line - alpha = 0 will be this vector, and alpha = 1 will be v.
-vector to interpolate towards.
-interpolation factor in the closed interval [0, 1].
-Sets this vector to be the vector linearly interpolated between v1 and v2 where alpha is the distance along the line connecting the two vectors - alpha = 0 will be v1, and alpha = 1 will be v2.
-the starting vector.
-vector to interpolate towards.
-interpolation factor in the closed interval [0, 1].
-Checks for strict equality of this vector and v.
-Sets this vector's x and y value from the provided array or array-like.
-the source array or array-like.
-Optional
offset: number(optional) offset into the array. Default is 0.
-Returns an array [x, y], or copies x and y into the provided array.
-Optional
array: number[](optional) array to store the vector to. If this is not provided, a new array will be created.
-Optional
offset: number(optional) optional offset into the array.
-The created or provided array.
-Returns an array [x, y], or copies x and y into the provided array.
-Optional
array: Vector2Tuple(optional) array to store the vector to. If this is not provided, a new array will be created.
-Optional
offset: 0(optional) optional offset into the array.
-The created or provided array.
-Copies x and y into the provided array-like.
-array-like to store the vector to.
-Optional
offset: number(optional) optional offset into the array.
-The provided array-like.
-Sets this vector's x and y values from the attribute.
-the source attribute.
-index in the attribute.
-Rotates the vector around center by angle radians.
-the point around which to rotate.
-the angle to rotate, in radians.
-3D vector.
-see https://github.com/mrdoob/three.js/blob/master/src/math/Vector3.js
-Copies value of v to this vector.
-Adds v to this vector.
-Sets this vector to a + b.
-Subtracts v from this vector.
-Sets this vector to a - b.
-Computes dot product of this vector and v.
-Computes the Manhattan length of this vector.
-see Taxicab Geometry
-Sets this vector to cross product of itself and v.
-Sets this vector to cross product of a and b.
-Computes distance of this vector to v.
-Computes squared distance of this vector to v.
-Computes the Manhattan length (distance) from this vector to the given vector v
-see Taxicab Geometry
-Checks for strict equality of this vector and v.
-Sets this vector's x, y and z value from the provided array or array-like.
-the source array or array-like.
-Optional
offset: number(optional) offset into the array. Default is 0.
-Returns an array [x, y, z], or copies x, y and z into the provided array.
-Optional
array: number[](optional) array to store the vector to. If this is not provided, a new array will be created.
-Optional
offset: number(optional) optional offset into the array.
-The created or provided array.
-Returns an array [x, y, z], or copies x, y and z into the provided array.
-Optional
array: Vector3Tuple(optional) array to store the vector to. If this is not provided, a new array will be created.
-Optional
offset: 0(optional) optional offset into the array.
-The created or provided array.
-Copies x, y and z into the provided array-like.
-array-like to store the vector to.
-Optional
offset: number(optional) optional offset into the array-like.
-The provided array-like.
-4D vector.
-Readonly
isCopies value of v to this vector.
-Adds v to this vector.
-Sets this vector to a + b.
-Subtracts v from this vector.
-Sets this vector to a - b.
-is assumed to be normalized
-Sets this vector to the position elements of the
-[transformation matrix]https://en.wikipedia.org/wiki/Transformation_matrix m.
Computes dot product of this vector and v.
-Computes the Manhattan length of this vector.
-see Taxicab Geometry
-Linearly interpolate between this vector and v with alpha factor.
-Checks for strict equality of this vector and v.
-Sets this vector's x, y, z and w value from the provided array or array-like.
-the source array or array-like.
-Optional
offset: number(optional) offset into the array. Default is 0.
-Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.
-Optional
array: number[](optional) array to store the vector to. If this is not provided, a new array will be created.
-Optional
offset: number(optional) optional offset into the array.
-The created or provided array.
-Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.
-Optional
array: Vector4Tuple(optional) array to store the vector to. If this is not provided, a new array will be created.
-Optional
offset: 0(optional) optional offset into the array.
-The created or provided array.
-Copies x, y, z and w into the provided array-like.
-array-like to store the vector to.
-Optional
offset: number(optional) optional offset into the array-like.
-The provided array-like.
-Readonly
isAn object with a series of statistical information about the graphics board memory and the rendering process.
-Use getUniforms() instead.
-Use getAttributes() instead.
-JavaScript events for custom objects
-// Adding events to a custom object
class Car extends EventDispatcher {
start() {
this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } );
}
};
// Using events with the custom object
const car = new Car();
car.addEventListener( 'start', ( event ) => {
alert( event.message );
} );
car.start();
-
-
-Optional
width: numberOptional
height: numberOptional
options: RenderTargetOptionsReadonly
isReadonly
isDefines whether the depth buffer should be resolved when rendering into a multisampled render target.
-Defines whether the stencil buffer should be resolved when rendering into a multisampled render target.
-This property has no effect when .resolveDepthBuffer is set to false
.
Defines the count of MSAA samples. Can only be used with WebGL 2. Default is 0.
-Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-The WebGL renderer displays your beautifully crafted scenes using WebGL, if your device supports it.
-This renderer has way better performance than CanvasRenderer.
parameters is an optional object with properties defining the renderer's behavior.
-The constructor also accepts no parameters at all.
-In all cases, it will assume sane defaults when parameters are missing.
Optional
parameters: WebGLRendererParametersA Canvas where the renderer draws its output.
-This is automatically created by the renderer in the constructor (if not provided already); you just need to add it to your page.
Defines whether the renderer should automatically clear its output before rendering.
-If autoClear is true, defines whether the renderer should clear the color buffer. Default is true.
-If autoClear is true, defines whether the renderer should clear the depth buffer. Default is true.
-If autoClear is true, defines whether the renderer should clear the stencil buffer. Default is true.
-Debug configurations.
-Defines whether the renderer should sort objects. Default is true.
-Compiles all materials in the scene with the camera. This is useful to precompile shaders before the first
-rendering. If you want to add a 3D object to an existing scene, use the third optional parameter for applying the
-target scene.
-Note that the (target) scene's lighting should be configured before calling this method.
Asynchronous version of compile(). The method returns a Promise that resolves when the given scene can be
-rendered without unnecessary stalling due to shader compilation.
-This method makes use of the KHR_parallel_shader_compile WebGL extension.
Use .xr instead.
-Use .shadowMap.enabled instead.
-Use .shadowMap.type instead.
-Use .shadowMap.cullFace instead.
-Color space used for output to HTMLCanvasElement. Supported values are
-SRGBColorSpace and LinearSRGBColorSpace.
Use .capabilities.getMaxAnisotropy() instead.
-Use .capabilities.precision instead.
-Sets the viewport to render from (x, y) to (x + width, y + height).
-(x, y) is the lower-left corner of the region.
Optional
y: numberOptional
width: numberOptional
height: numberSets the clear color, using color for the color and alpha for the opacity.
-Optional
alpha: numberUse .state.reset() instead.
-A build in function that can be used instead of requestAnimationFrame. For WebXR projects this function must be used.
-The function will be called every available frame. If null
is passed it will stop any already ongoing animation.
Use .setAnimationLoop() instead.
-Render a scene or an object using a camera.
-The render is done to a previously specified WebGLRenderTarget#renderTarget .renderTarget set by calling
-.setRenderTarget or to the canvas as usual.
By default render buffers are cleared before rendering but you can prevent this by setting the property
-autoClear to false. If you want to prevent only certain buffers being cleared
-you can set either the autoClearColor,
-autoClearStencil or autoClearDepth
-properties to false. To forcibly clear one ore more buffers call .clear.
Returns the current render target. If no render target is set, null is returned.
-Use .getRenderTarget() instead.
-Sets the active render target.
-The renderTarget that needs to be activated. When null
is given, the canvas is set as the active render target instead.
Optional
activeCubeFace: numberSpecifies the active cube side (PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5) of WebGLCubeRenderTarget.
-Optional
activeMipmapLevel: numberSpecifies the active mipmap level.
-Optional
activeCubeFaceIndex: numberOptional
activeCubeFaceIndex: numberCopies a region of the currently bound framebuffer into the selected mipmap level of the selected texture.
-This region is defined by the size of the destination texture's mip level, offset by the input position.
Copies the pixels of a texture in the bounds [srcRegion]Box3 in the destination texture starting from the
-given position. 2D Texture, 3D Textures, or a mix of the two can be used as source and destination texture
-arguments for copying between layers of 3d textures
The depthTexture
and texture
property of render targets are supported as well.
When using render target textures as srcTexture
and dstTexture
, you must make sure both render targets are
-initialized e.g. via .initRenderTarget().
Specifies the source texture.
-Specifies the destination texture.
-Optional
srcRegion: null | Box2 | Box3Specifies the bounds
-Optional
dstPosition: null | Vector3 | Vector2Specifies the pixel offset into the dstTexture where the copy will occur.
-Optional
srcLevel: numberSpecifies the source mipmap level of the texture.
-Optional
dstLevel: numberSpecifies the destination mipmap level of the texture.
-Specifies the source texture.
-Specifies the destination texture.
-Optional
srcRegion: null | Box3Specifies the bounds
-Optional
dstPosition: null | Vector3Specifies the pixel offset into the dstTexture where the copy will occur.
-Optional
level: numberSpecifies the destination mipmap level of the texture.
-Use "copyTextureToTexture" instead.
-Copies the pixels of a texture in the bounds srcRegion
in the destination texture starting from the given
-position. The depthTexture
and texture
property of 3D render targets are supported as well.
When using render target textures as srcTexture
and dstTexture
, you must make sure both render targets are
-intitialized e.g. via .initRenderTarget().
Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data can be copied
-into it using WebGLRenderer.copyTextureToTexture before it has been rendered to.
Use .extensions.get( 'OES_texture_float' ) instead.
-Use .extensions.get( 'OES_texture_half_float' ) instead.
-Use .extensions.get( 'OES_standard_derivatives' ) instead.
-Use .extensions.get( 'WEBGL_compressed_texture_s3tc' ) instead.
-Use .extensions.get( 'WEBGL_compressed_texture_pvrtc' ) instead.
-Use .extensions.get( 'EXT_blend_minmax' ) instead.
-Use .capabilities.vertexTextures instead.
-Use .extensions.get( 'ANGLE_instanced_arrays' ) instead.
-Use .setScissorTest() instead.
-Use Material#shadowSide instead.
-Optional
blendEquation: BlendingEquationOptional
blendSrc: BlendingSrcFactorOptional
blendDst: BlendingDstFactorOptional
blendEquationAlpha: BlendingEquationOptional
blendSrcAlpha: BlendingSrcFactorOptional
blendDstAlpha: BlendingDstFactorOptional
premultiplyAlpha: booleanStatic
uploadStatic
seqOptional
colorSpace: stringJavaScript events for custom objects
-// Adding events to a custom object
class Car extends EventDispatcher {
start() {
this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } );
}
};
// Using events with the custom object
const car = new Car();
car.addEventListener( 'start', ( event ) => {
alert( event.message );
} );
car.start();
-
-
-Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Fire an event type.
-The event that gets fired.
-Abstract
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsAbstract
Readonly
layoutOptional
chromaticReadonly
mipReadonly
needsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Removes the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsAbstract
Readonly
layoutOptional
chromaticReadonly
mipReadonly
needsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Removes the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsAbstract
Readonly
layoutOptional
chromaticReadonly
mipReadonly
needsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Removes the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsAbstract
Readonly
layoutOptional
chromaticReadonly
mipReadonly
needsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Removes the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsAbstract
Readonly
sessionReadonly
predictedOptional
trackedOptional
createOptional
Readonly
detectedXRFrame is extended to contain detectedPlanes attribute which contains
-all planes that are still tracked in the frame.
The set is initially empty and will be populated by the update planes
-algorithm. If this attribute is accessed when the frame is not active,
-the user agent MUST throw InvalidStateError.
Optional
Readonly
detectedXRFrame is extended to contain detectedMeshes attribute
-which contains all meshes that are still tracked in the frame.
The set is initially empty and will be populated by the update meshes algorithm.
-If this attribute is accessed when the frame is not active, the user agent
-MUST throw InvalidStateError.
Optional
getProvides the pose of the viewer relative to referenceSpace as an XRViewerPose, at the
-XRFrame's time.
Its purpose is to make working with groups of objects syntactically clearer.
-This is almost identical to an Object3D
-const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshBasicMaterial({
color: 0x00ff00
});
const cubeA = new THREE.Mesh(geometry, material);
cubeA.position.set(100, 100, 0);
const cubeB = new THREE.Mesh(geometry, material);
cubeB.position.set(-100, -100, 0);
//create a {@link Group} and add the two cubes
//These cubes can now be rotated / scaled etc as a {@link Group} * const {@link Group} = new THREE.Group();
group.add(cubeA);
group.add(cubeB);
scene.add(group);
-
-
-Creates a new Group.
-Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
linearReadonly
angularReadonly
isRead-only flag to check if a given object is of type Group.
-Readonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Readonly
typeA Read-only string to check this
object type.
Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-The layer membership of the object.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Convert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Fire an event type.
-The event that gets fired.
-Abstract
Readonly
WRISTReadonly
THUMB_Readonly
THUMB_Readonly
THUMB_Readonly
THUMB_Readonly
INDEX_Readonly
INDEX_Readonly
INDEX_Readonly
INDEX_Readonly
INDEX_Readonly
MIDDLE_Readonly
MIDDLE_Readonly
MIDDLE_Readonly
MIDDLE_Readonly
MIDDLE_Readonly
RING_Readonly
RING_Readonly
RING_Readonly
RING_Readonly
RING_Readonly
LITTLE_Readonly
LITTLE_Readonly
LITTLE_Readonly
LITTLE_Readonly
LITTLE_Readonly
sizeReadonly
[totrue if an element in the Map existed and has been removed, or false if the element does not exist.
-Executes a provided function once per each key/value pair in the Map, in insertion order.
-Optional
thisArg: anyReturns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
-Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
-boolean indicating whether an element with the specified key exists or not.
-Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
-Returns an iterable of key, value pairs for every entry in the map.
-Returns an iterable of keys in the map
-Returns an iterable of values in the map
-Returns an iterable of entries in the map.
-Its purpose is to make working with groups of objects syntactically clearer.
-This is almost identical to an Object3D
-const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshBasicMaterial({
color: 0x00ff00
});
const cubeA = new THREE.Mesh(geometry, material);
cubeA.position.set(100, 100, 0);
const cubeB = new THREE.Mesh(geometry, material);
cubeB.position.set(-100, -100, 0);
//create a {@link Group} and add the two cubes
//These cubes can now be rotated / scaled etc as a {@link Group} * const {@link Group} = new THREE.Group();
group.add(cubeA);
group.add(cubeB);
scene.add(group);
-
-
-Creates a new Group.
-Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
jointsReadonly
inputReadonly
isRead-only flag to check if a given object is of type Group.
-Readonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Readonly
typeA Read-only string to check this
object type.
Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-The layer membership of the object.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Convert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Fire an event type.
-The event that gets fired.
-Abstract
Abstract
Abstract
Abstract
Optional
thisArg: anyXRInputSourceEvents are fired to indicate changes to the state of an XRInputSource.
-ref: https://immersive-web.github.io/webxr/#xrinputsourceevent-interface
Optional
eventInitDict: XRInputSourceEventInitStatic
Readonly
NONEStatic
Readonly
CAPTURING_Static
Readonly
AT_Static
Readonly
BUBBLING_Readonly
typeReturns the type of event, e.g. "click", "hashchange", or "submit".
- -Readonly
frameReadonly
inputReadonly
bubblesReturns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
- -Readonly
cancelableReturns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method.
- -Readonly
composedReturns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise.
- -Readonly
currentReturns the object whose event listener's callback is currently being invoked.
- -Readonly
defaultReturns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
- -Readonly
eventReturns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
- -Readonly
isReturns true if event was dispatched by the user agent, and false otherwise.
- -Readonly
srcReadonly
targetReturns the object to which event is dispatched (its target).
- -Readonly
timeReturns the event's timestamp as the number of milliseconds measured relative to the time origin.
- -Readonly
NONEReadonly
CAPTURING_Readonly
AT_Readonly
BUBBLING_Abstract
Its purpose is to make working with groups of objects syntactically clearer.
-This is almost identical to an Object3D
-const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshBasicMaterial({
color: 0x00ff00
});
const cubeA = new THREE.Mesh(geometry, material);
cubeA.position.set(100, 100, 0);
const cubeB = new THREE.Mesh(geometry, material);
cubeB.position.set(-100, -100, 0);
//create a {@link Group} and add the two cubes
//These cubes can now be rotated / scaled etc as a {@link Group} * const {@link Group} = new THREE.Group();
group.add(cubeA);
group.add(cubeB);
scene.add(group);
-
-
-Creates a new Group.
-Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
jointReadonly
isRead-only flag to check if a given object is of type Group.
-Readonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Readonly
typeA Read-only string to check this
object type.
Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-The layer membership of the object.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Convert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Fire an event type.
-The event that gets fired.
-Abstract
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsAbstract
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsAbstract
Abstract
Readonly
textureReadonly
textureReadonly
textureReadonly
ignoreReadonly
layoutOptional
chromaticReadonly
mipReadonly
needsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Removes the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsAbstract
Readonly
layoutOptional
chromaticReadonly
mipReadonly
needsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Removes the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsOptional
transformOrOrigin: XRRigidTransform | DOMPointInitOptional
direction: DOMPointInitAbstract
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsOptional
eventInitDict: XRReferenceSpaceEventInitReadonly
typeReturns the type of event, e.g. "click", "hashchange", or "submit".
- -Readonly
referenceOptional
Readonly
transformReadonly
bubblesReturns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
- -Readonly
cancelableReturns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method.
- -Readonly
composedReturns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise.
- -Readonly
currentReturns the object whose event listener's callback is currently being invoked.
- -Readonly
defaultReturns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
- -Readonly
eventReturns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
- -Readonly
isReturns true if event was dispatched by the user agent, and false otherwise.
- -Readonly
srcReadonly
targetReturns the object to which event is dispatched (its target).
- -Readonly
timeReturns the event's timestamp as the number of milliseconds measured relative to the time origin.
- -Readonly
NONEReadonly
CAPTURING_Readonly
AT_Readonly
BUBBLING_Abstract
A transform described by a position and orientation. When interpreting an
-XRRigidTransform the orientation is always applied prior to the position.
ref: https://immersive-web.github.io/webxr/#xrrigidtransform-interface
-Optional
position: DOMPointInitOptional
direction: DOMPointInitAbstract
Readonly
inputReturns a list of this session's XRInputSources, each representing an input device
-used to control the camera and/or scene.
Readonly
renderobject which contains options affecting how the imagery is rendered.
-This includes things such as the near and far clipping planes
Readonly
environmentReadonly
visibilityOptional
Readonly
frameOptional
Readonly
supportedOptional
Readonly
enabledReadonly
isOptional
requestOptional
requestOptional
requestOptional
Readonly
domOptional
Readonly
depthOptional
Readonly
depthSchedules the specified method to be called the next time the user agent
-is working on rendering an animation frame for the WebXR device. Returns an
-integer value which can be used to identify the request for the purposes of
-canceling the callback using cancelAnimationFrame(). This method is comparable
-to the Window.requestAnimationFrame() method.
Requests that a new XRReferenceSpace of the specified type be created.
-Returns a promise which resolves with the XRReferenceSpace or
-XRBoundedReferenceSpace which was requested, or throws a NotSupportedError if
-the requested space type isn't supported by the device.
Optional
renderStateInit: XRRenderStateInitAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsOptional
initiateXRSession is extended to contain the initiateRoomCapture method which,
-if supported, will ask the XR Compositor to capture the current room layout.
-It is up to the XRCompositor if this will replace or augment the set of tracked planes.
-The user agent MAY also ignore this call, for instance if it doesn’t support a manual room
-capture more or if it determines that the room is already set up.
-The initiateRoomCapture method MUST only be able to be called once per XRSession.
XRSessionEvents are fired to indicate changes to the state of an XRSession.
-ref: https://immersive-web.github.io/webxr/#xrsessionevent-interface
Optional
eventInitDict: XRSessionEventInitStatic
Readonly
NONEStatic
Readonly
CAPTURING_Static
Readonly
AT_Static
Readonly
BUBBLING_Readonly
sessionReadonly
bubblesReturns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
- -Readonly
cancelableReturns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method.
- -Readonly
composedReturns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise.
- -Readonly
currentReturns the object whose event listener's callback is currently being invoked.
- -Readonly
defaultReturns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
- -Readonly
eventReturns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
- -Readonly
isReturns true if event was dispatched by the user agent, and false otherwise.
- -Readonly
srcReadonly
targetReturns the object to which event is dispatched (its target).
- -Readonly
timeReturns the event's timestamp as the number of milliseconds measured relative to the time origin.
- -Readonly
typeReturns the type of event, e.g. "click", "hashchange", or "submit".
- -Readonly
NONEReadonly
CAPTURING_Readonly
AT_Readonly
BUBBLING_Abstract
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsAbstract
Its purpose is to make working with groups of objects syntactically clearer.
-This is almost identical to an Object3D
-const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshBasicMaterial({
color: 0x00ff00
});
const cubeA = new THREE.Mesh(geometry, material);
cubeA.position.set(100, 100, 0);
const cubeB = new THREE.Mesh(geometry, material);
cubeB.position.set(-100, -100, 0);
//create a {@link Group} and add the two cubes
//These cubes can now be rotated / scaled etc as a {@link Group} * const {@link Group} = new THREE.Group();
group.add(cubeA);
group.add(cubeB);
scene.add(group);
-
-
-Creates a new Group.
-Static
DEFAULT_The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight,
-THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).
Static
DEFAULT_The default setting for matrixAutoUpdate for newly created Object3Ds.
-Static
DEFAULT_The default setting for matrixWorldAutoUpdate for newly created Object3Ds.
-Readonly
linearReadonly
angularReadonly
isRead-only flag to check if a given object is of type Group.
-Readonly
isFlag to check if a given object is of type Object3D.
-Readonly
idUnique number for this Object3D instance.
-UUID of this object instance.
-Optional name of the object
-Readonly
typeA Read-only string to check this
object type.
Object's parent in the scene graph.
-Array with object's children.
-This is used by the lookAt method, for example, to determine the orientation of the result.
-Object3D.DEFAULT_UP - that is (0, 1, 0)
.
Readonly
positionObject's local position.
-Readonly
rotationObject's local rotation (Euler angles), in radians.
-Readonly
quaternionObject's local rotation as a THREE.Quaternion | Quaternion.
-Readonly
scaleThe object's local scale.
-Readonly
modelReadonly
normalThe local transform matrix.
-The global transform of the object.
-If the Object3D has no parent, then it's identical to the local transform THREE.Object3D.matrix | .matrix.
-When this is set, it calculates the matrix of position, (rotation or quaternion) and
-scale every frame and also recalculates the matrixWorld property.
DEFAULT_MATRIX_AUTO_UPDATE - that is (true)
.
If set, then the renderer checks every frame if the object and its children need matrix updates.
-When it isn't, then you have to maintain all matrices in the object and its children yourself.
DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true)
.
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
-The layer membership of the object.
-Object gets rendered if true
.
Whether the object gets rendered into shadow map.
-Whether the material receives shadows.
-When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
-If set to false
the object gets rendered every frame even if it is not in the frustum of the camera.
This value allows the default rendering order of scene graph
-objects to be overridden although opaque and transparent objects remain sorted independently.
When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
-Sorting is from lowest to highest renderOrder.
Array with object's animation clips.
-An object that can be used to store custom data about the Object3D.
-Optional
customCustom depth material to be used when rendering to the depth map.
-Optional
customSame as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.
-An optional callback that is executed immediately before a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered to a shadow map.
-This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry,
-depthMaterial, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately before a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
An optional callback that is executed immediately after a 3D object is rendered.
-This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
-Please notice that this callback is only executed for renderable
3D objects. Meaning 3D objects which
-define their visual appearance with geometries and materials like instances of Mesh, Line,
-Points or Sprite. Instances of Object3D, Group or Bone are not renderable
-and thus this callback is not executed for such objects.
Applies the rotation represented by the quaternion to the object.
-Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.
-A normalized vector in object space.
-Angle in radians. Expects a Float
Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.
-Euler angle specifying rotation amount.
-Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.
-Rotate the quaternion by the rotation component of the matrix.
-Copy the given THREE.Quaternion | Quaternion into .quaternion.
-Normalized Quaternion.
-Translates object along x axis in object space by distance units.
-Expects a Float
Translates object along y axis in object space by distance units.
-Expects a Float
Translates object along z axis in object space by distance units.
-Expects a Float
Rotates the object to face a point in world space.
-A vector representing a position in world space to look at.
-Rotates the object to face a point in world space.
-Expects a Float
Expects a Float
Expects a Float
Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
-String to match to the children's Object3D.name property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
the property name to search for.
-value of the given property.
-Searches through an object and its children, starting with the object itself,
-and returns the first with a property that matches the value given.
The property name to search for.
-Value of the given property.
-Optional
optionalTarget: Object3D[]target to set the result. Otherwise a new Array is instantiated. If set, you must clear
-this array prior to each call (i.e., array.length = 0;).
Returns a quaternion representing the rotation of the object in world space.
-The result will be copied into this Quaternion.
-Abstract (empty) method to get intersections between a casted ray and this object
-Updates the global transform of the object.
-And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true
.
Optional
force: booleanA boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame.
-Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true
.
Convert the object to three.js JSON Object/Scene format.
-Optional
meta: JSONMetaObject containing metadata such as materials, textures or images for the object.
-Copies the given object into this object.
-Optional
recursive: booleanIf set to true
, descendants of the object are copied next to the existing ones. If set to
-false
, descendants are left unchanged. Default is true
.
Adds a listener to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Checks if listener is added to an event type.
-The type of event to listen to.
-The function that gets called when the event is fired.
-Removes a listener from an event type.
-The type of the listener that gets removed.
-The listener function that gets removed.
-Fire an event type.
-The event that gets fired.
-Abstract
Abstract
Abstract
Optional
init: XRProjectionLayerInitOptional
init: XRQuadLayerInitOptional
init: XRCylinderLayerInitOptional
init: XREquirectLayerInitOptional
init: XRCubeLayerInitOptional
eye: XREyeA layer which provides a WebGL framebuffer to render into, enabling hardware accelerated
-rendering of 3D graphics to be presented on the XR device. *
-ref: https://immersive-web.github.io/webxr/#xrwebgllayer-interface
Optional
layerInit: XRWebGLLayerInitReadonly
antialiasReadonly
ignoreOptional
fixedReadonly
framebufferReadonly
framebufferReadonly
framebufferStatic
getAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
-The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
-When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
-When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
-When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
-If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
-The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
- -Optional
options: boolean | AddEventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
- -Optional
options: boolean | EventListenerOptionsAbstract
This class stores data for an attribute (such as vertex positions, face indices, normals, colors, UVs, and any custom attributes )
-associated with a THREE.BufferGeometry | BufferGeometry, which allows for more efficient passing of data to the GPU
When working with vector-like data, the .fromBufferAttribute( attribute, index )
helper methods on
-THREE.Vector2.fromBufferAttribute | Vector2,
-THREE.Vector3.fromBufferAttribute | Vector3,
-THREE.Vector4.fromBufferAttribute | Vector4, and
-THREE.Color.fromBufferAttribute | Color classes may be helpful.
Readonly
isOptional name for this attribute instance.
-The TypedArray holding data stored in the buffer.
-The length of vectors that are being stored in the array.
-Defines the intended usage pattern of the data store for optimization purposes.
-Corresponds to the usage parameter of
-WebGLRenderingContext.bufferData.
After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render.
-Configures the bound GPU type for use in shaders. Either FloatType or IntType, default is FloatType.
-Note: this only has an effect for integer arrays and is not configurable for float arrays. For lower precision
-float types, see https://threejs.org/docs/#api/en/core/bufferAttributeTypes/BufferAttributeTypes.
This can be used to only update some components of stored vectors (for example, just the component related to
-color). Use the .addUpdateRange function to add ranges to this array.
Position at which to start update.
-The number of components to update.
-A version number, incremented every time the needsUpdate property is set to true.
-Indicates how the underlying data in the buffer maps to the values in the GLSL shader code.
-Readonly
countReadonly
isRead-only flag to check if a given object is of type BufferAttribute.
-A callback function that is executed after the Renderer has transferred the attribute array data to the GPU.
-Flag to indicate that this attribute has changed and should be re-sent to the GPU.
-Set this to true when you modify the value of the array.
Setting this to true also increments the version.
-Sets the value of the onUploadCallback property.
-function that is executed after the Renderer has transferred the attribute array data to the GPU.
-Set usage
-After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render.
-a copy of this BufferAttribute.
-Copies another BufferAttribute to this BufferAttribute.
-Copy a vector from bufferAttribute[index2] to array[index1].
-Copy the array given here (which can be a normal array or TypedArray
) into array.
TypedArray.set for notes on requirements if copying a TypedArray
.
Applies matrix m to every Vector3 element of this BufferAttribute.
-Applies matrix m to every Vector3 element of this BufferAttribute.
-Applies normal matrix m to every Vector3 element of this BufferAttribute.
-Applies matrix m to every Vector3 element of this BufferAttribute, interpreting the elements as a direction vectors.
-Calls TypedArray.set( value, offset )
-on the array.
Array | Array or TypedArray
from which to copy values.
Optional
offset: numberindex of the array at which to start copying. Expects a Integer
. Default 0
.
RangeError
When offset is negative or is too large.
Convert this object to three.js to the data.attributes
part of JSON Geometry format v4,
Default
- -