📄 Camera.js
¶
📊 Analysis Summary¶
Metric | Count |
---|---|
🔧 Functions | 5 |
🧱 Classes | 1 |
📦 Imports | 3 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 src/cameras/Camera.js
📦 Imports¶
Name | Source |
---|---|
WebGLCoordinateSystem |
../constants.js |
Matrix4 |
../math/Matrix4.js |
Object3D |
../core/Object3D.js |
Functions¶
Camera.copy(source: any, recursive: any): this
¶
Parameters:
source
any
recursive
any
Returns: this
Calls:
super.copy
this.matrixWorldInverse.copy
this.projectionMatrix.copy
this.projectionMatrixInverse.copy
Code
copy( source, recursive ) {
super.copy( source, recursive );
this.matrixWorldInverse.copy( source.matrixWorldInverse );
this.projectionMatrix.copy( source.projectionMatrix );
this.projectionMatrixInverse.copy( source.projectionMatrixInverse );
this.coordinateSystem = source.coordinateSystem;
return this;
}
Camera.getWorldDirection(target: Vector3): Vector3
¶
JSDoc:
/**
* Returns a vector representing the ("look") direction of the 3D object in world space.
*
* This method is overwritten since cameras have a different forward vector compared to other
* 3D objects. A camera looks down its local, negative z-axis by default.
*
* @param {Vector3} target - The target vector the result is stored to.
* @return {Vector3} The 3D object's direction in world space.
*/
Parameters:
target
Vector3
Returns: Vector3
Calls:
super.getWorldDirection( target ).negate
Camera.updateMatrixWorld(force: any): void
¶
Parameters:
force
any
Returns: void
Calls:
super.updateMatrixWorld
this.matrixWorldInverse.copy( this.matrixWorld ).invert
Code
Camera.updateWorldMatrix(updateParents: any, updateChildren: any): void
¶
Parameters:
updateParents
any
updateChildren
any
Returns: void
Calls:
super.updateWorldMatrix
this.matrixWorldInverse.copy( this.matrixWorld ).invert
Code
Camera.clone(): any
¶
Returns: any
Calls:
new this.constructor().copy
Classes¶
Camera
¶
Class Code
class Camera extends Object3D {
/**
* Constructs a new camera.
*/
constructor() {
super();
/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
this.isCamera = true;
this.type = 'Camera';
/**
* The inverse of the camera's world matrix.
*
* @type {Matrix4}
*/
this.matrixWorldInverse = new Matrix4();
/**
* The camera's projection matrix.
*
* @type {Matrix4}
*/
this.projectionMatrix = new Matrix4();
/**
* The inverse of the camera's projection matrix.
*
* @type {Matrix4}
*/
this.projectionMatrixInverse = new Matrix4();
/**
* The coordinate system in which the camera is used.
*
* @type {(WebGLCoordinateSystem|WebGPUCoordinateSystem)}
*/
this.coordinateSystem = WebGLCoordinateSystem;
this._reversedDepth = false;
}
/**
* The flag that indicates whether the camera uses a reversed depth buffer.
*
* @type {boolean}
* @default false
*/
get reversedDepth() {
return this._reversedDepth;
}
copy( source, recursive ) {
super.copy( source, recursive );
this.matrixWorldInverse.copy( source.matrixWorldInverse );
this.projectionMatrix.copy( source.projectionMatrix );
this.projectionMatrixInverse.copy( source.projectionMatrixInverse );
this.coordinateSystem = source.coordinateSystem;
return this;
}
/**
* Returns a vector representing the ("look") direction of the 3D object in world space.
*
* This method is overwritten since cameras have a different forward vector compared to other
* 3D objects. A camera looks down its local, negative z-axis by default.
*
* @param {Vector3} target - The target vector the result is stored to.
* @return {Vector3} The 3D object's direction in world space.
*/
getWorldDirection( target ) {
return super.getWorldDirection( target ).negate();
}
updateMatrixWorld( force ) {
super.updateMatrixWorld( force );
this.matrixWorldInverse.copy( this.matrixWorld ).invert();
}
updateWorldMatrix( updateParents, updateChildren ) {
super.updateWorldMatrix( updateParents, updateChildren );
this.matrixWorldInverse.copy( this.matrixWorld ).invert();
}
clone() {
return new this.constructor().copy( this );
}
}
Methods¶
copy(source: any, recursive: any): this
¶
Code
copy( source, recursive ) {
super.copy( source, recursive );
this.matrixWorldInverse.copy( source.matrixWorldInverse );
this.projectionMatrix.copy( source.projectionMatrix );
this.projectionMatrixInverse.copy( source.projectionMatrixInverse );
this.coordinateSystem = source.coordinateSystem;
return this;
}