Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions types/three/src/cameras/Camera.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Matrix4 } from './../math/Matrix4';
import { Vector3 } from './../math/Vector3';
import { Object3D } from './../core/Object3D';
import { Layers } from '../Three';
import { Matrix4 } from '../math/Matrix4';
import { Vector3 } from '../math/Vector3';
import { Object3D } from '../core/Object3D';
import { Layers } from '../core/Layers';
import { CoordinateSystem } from '../constants';

/**
* Abstract base class for cameras
Expand Down Expand Up @@ -59,6 +60,8 @@ export abstract class Camera extends Object3D {
*/
projectionMatrixInverse: Matrix4;

coordinateSystem: CoordinateSystem;

/**
* Returns a {@link THREE.Vector3 | Vector3} representing the world space direction in which the {@link Camera} is looking.
* @remarks Note: A {@link Camera} looks down its local, negative z-axis.
Expand Down
5 changes: 5 additions & 0 deletions types/three/src/cameras/CubeCamera.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { WebGLCubeRenderTarget } from './../renderers/WebGLCubeRenderTarget';
import { Scene } from './../scenes/Scene';
import { WebGLRenderer } from './../renderers/WebGLRenderer';
import { Object3D } from './../core/Object3D';
import { CoordinateSystem } from '../constants';

/**
* Creates **6** {@link THREE.PerspectiveCamera | cameras} that render to a {@link THREE.WebGLCubeRenderTarget | WebGLCubeRenderTarget}.
Expand Down Expand Up @@ -53,6 +54,10 @@ export class CubeCamera extends Object3D {
*/
renderTarget: WebGLCubeRenderTarget;

coordinateSystem: CoordinateSystem;

updateCoordinateSystem(): void;

/**
* Call this to update the {@link CubeCamera.renderTarget | renderTarget}.
* @param renderer The current WebGL renderer
Expand Down
4 changes: 4 additions & 0 deletions types/three/src/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,10 @@ export const GLSL1: '100';
export const GLSL3: '300 es';
export type GLSLVersion = typeof GLSL1 | typeof GLSL3;

export const WebGLCoordinateSystem: 2000;
export const WebGPUCoordinateSystem: 2001;
export type CoordinateSystem = typeof WebGLCoordinateSystem | typeof WebGPUCoordinateSystem;

///////////////////////////////////////////////////////////////////////////////
// Texture - Internal Pixel Formats

Expand Down
3 changes: 2 additions & 1 deletion types/three/src/math/Frustum.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Sprite } from './../objects/Sprite';
import { Sphere } from './Sphere';
import { Box3 } from './Box3';
import { Vector3 } from './Vector3';
import { CoordinateSystem } from '../constants';

/**
* Frustums are used to determine what is inside the camera's field of view. They help speed up the rendering process.
Expand All @@ -20,7 +21,7 @@ export class Frustum {
set(p0: Plane, p1: Plane, p2: Plane, p3: Plane, p4: Plane, p5: Plane): Frustum;
clone(): this;
copy(frustum: Frustum): this;
setFromProjectionMatrix(m: Matrix4): this;
setFromProjectionMatrix(m: Matrix4, coordinateSystem?: CoordinateSystem): this;
intersectsObject(object: Object3D): boolean;
intersectsSprite(sprite: Sprite): boolean;
intersectsSphere(sphere: Sphere): boolean;
Expand Down
21 changes: 19 additions & 2 deletions types/three/src/math/Matrix4.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Vector3 } from './Vector3';
import { Euler } from './Euler';
import { Quaternion } from './Quaternion';
import { Matrix, Matrix3 } from './Matrix3';
import { CoordinateSystem } from '../constants';

export type Matrix4Tuple = [
number,
Expand Down Expand Up @@ -203,12 +204,28 @@ export class Matrix4 implements Matrix {
/**
* Creates a perspective projection matrix.
*/
makePerspective(left: number, right: number, top: number, bottom: number, near: number, far: number): Matrix4;
makePerspective(
left: number,
right: number,
top: number,
bottom: number,
near: number,
far: number,
coordinateSystem?: CoordinateSystem,
): Matrix4;

/**
* Creates an orthographic projection matrix.
*/
makeOrthographic(left: number, right: number, top: number, bottom: number, near: number, far: number): Matrix4;
makeOrthographic(
left: number,
right: number,
top: number,
bottom: number,
near: number,
far: number,
coordinateSystem?: CoordinateSystem,
): Matrix4;
equals(matrix: Matrix4): boolean;

/**
Expand Down
4 changes: 3 additions & 1 deletion types/three/src/renderers/WebGLRenderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { WebGLRenderTarget } from './WebGLRenderTarget';
import { WebGLMultipleRenderTargets } from './WebGLMultipleRenderTargets';
import { Object3D } from './../core/Object3D';
import { Material } from './../materials/Material';
import { ToneMapping, ShadowMapType, CullFace, TextureEncoding, ColorSpace } from '../constants';
import { ToneMapping, ShadowMapType, CullFace, TextureEncoding, ColorSpace, WebGLCoordinateSystem } from '../constants';
import { WebXRManager } from '../renderers/webxr/WebXRManager';
import { BufferGeometry } from './../core/BufferGeometry';
import { OffscreenCanvas, Texture } from '../textures/Texture';
Expand Down Expand Up @@ -200,6 +200,8 @@ export class WebGLRenderer implements Renderer {
*/
outputColorSpace: ColorSpace;

get coordinateSystem(): typeof WebGLCoordinateSystem;

/**
* @default true
*/
Expand Down