Skip to content

Commit

Permalink
Core: WebGLRenderTarget extends RenderTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 committed Jul 28, 2023
1 parent 91176c1 commit e415d19
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 73 deletions.
1 change: 1 addition & 0 deletions types/three/src/Three.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export * from './cameras/Camera.js';
/**
* Core
*/
export * from './core/RenderTarget.js';
export * from './core/Uniform.js';
export * from './core/UniformsGroup.js';
export * from './core/InstancedBufferGeometry.js';
Expand Down
78 changes: 78 additions & 0 deletions types/three/src/core/RenderTarget.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { Vector4 } from '../math/Vector4.js';
import { Texture } from '../textures/Texture.js';
import { DepthTexture } from '../textures/DepthTexture.js';
import { EventDispatcher } from './EventDispatcher.js';
import {
Wrapping,
TextureDataType,
TextureEncoding,
MinificationTextureFilter,
MagnificationTextureFilter,
ColorSpace,
} from '../constants.js';

export interface RenderTargetOptions {
wrapS?: Wrapping | undefined;
wrapT?: Wrapping | undefined;
magFilter?: MagnificationTextureFilter | undefined;
minFilter?: MinificationTextureFilter | undefined;
generateMipmaps?: boolean | undefined; // true;
format?: number | undefined; // RGBAFormat;
type?: TextureDataType | undefined; // UnsignedByteType;
anisotropy?: number | undefined; // 1;
colorSpace?: ColorSpace | undefined;
depthBuffer?: boolean | undefined; // true;
stencilBuffer?: boolean | undefined; // false;
depthTexture?: DepthTexture | undefined;
/**
* Defines the count of MSAA samples. Can only be used with WebGL 2. Default is **0**.
* @default 0
*/
samples?: number;
/** @deprecated Use 'colorSpace' in three.js r152+. */
encoding?: TextureEncoding | undefined;
}

export class RenderTarget<TTexture extends Texture | Texture[] = Texture> extends EventDispatcher {
constructor(width?: number, height?: number, options?: RenderTargetOptions);

readonly isRenderTarget: true;

width: number;
height: number;
depth: number;

scissor: Vector4;
/**
* @default false
*/
scissorTest: boolean;
viewport: Vector4;
texture: TTexture;

/**
* @default true
*/
depthBuffer: boolean;

/**
* @default true
*/
stencilBuffer: boolean;

/**
* @default null
*/
depthTexture: DepthTexture;

/**
* Defines the count of MSAA samples. Can only be used with WebGL 2. Default is **0**.
* @default 0
*/
samples: number;

setSize(width: number, height: number, depth?: number): void;
clone(): this;
copy(source: RenderTarget): this;
dispose(): void;
}
76 changes: 3 additions & 73 deletions types/three/src/renderers/WebGLRenderTarget.d.ts
Original file line number Diff line number Diff line change
@@ -1,78 +1,8 @@
import { Vector4 } from '../math/Vector4.js';
import { Texture } from '../textures/Texture.js';
import { DepthTexture } from '../textures/DepthTexture.js';
import { EventDispatcher } from '../core/EventDispatcher.js';
import {
Wrapping,
TextureDataType,
TextureEncoding,
MinificationTextureFilter,
MagnificationTextureFilter,
ColorSpace,
} from '../constants.js';
import { RenderTarget, RenderTargetOptions } from '../core/RenderTarget.js';

export interface WebGLRenderTargetOptions {
wrapS?: Wrapping | undefined;
wrapT?: Wrapping | undefined;
magFilter?: MagnificationTextureFilter | undefined;
minFilter?: MinificationTextureFilter | undefined;
generateMipmaps?: boolean | undefined; // true;
format?: number | undefined; // RGBAFormat;
type?: TextureDataType | undefined; // UnsignedByteType;
anisotropy?: number | undefined; // 1;
colorSpace?: ColorSpace | undefined;
depthBuffer?: boolean | undefined; // true;
stencilBuffer?: boolean | undefined; // false;
depthTexture?: DepthTexture | undefined;
/**
* Defines the count of MSAA samples. Can only be used with WebGL 2. Default is **0**.
* @default 0
*/
samples?: number;
/** @deprecated Use 'colorSpace' in three.js r152+. */
encoding?: TextureEncoding | undefined;
}

export class WebGLRenderTarget<TTexture extends Texture | Texture[] = Texture> extends EventDispatcher {
constructor(width?: number, height?: number, options?: WebGLRenderTargetOptions);
export class WebGLRenderTarget<TTexture extends Texture | Texture[] = Texture> extends RenderTarget<TTexture> {
constructor(width?: number, height?: number, options?: RenderTargetOptions);

readonly isWebGLRenderTarget: true;

width: number;
height: number;
depth: number;

scissor: Vector4;
/**
* @default false
*/
scissorTest: boolean;
viewport: Vector4;
texture: TTexture;

/**
* @default true
*/
depthBuffer: boolean;

/**
* @default true
*/
stencilBuffer: boolean;

/**
* @default null
*/
depthTexture: DepthTexture;

/**
* Defines the count of MSAA samples. Can only be used with WebGL 2. Default is **0**.
* @default 0
*/
samples: number;

setSize(width: number, height: number, depth?: number): void;
clone(): this;
copy(source: WebGLRenderTarget): this;
dispose(): void;
}

0 comments on commit e415d19

Please sign in to comment.