UNPKG

2.17 kBTypeScriptView Raw
1import { MagnificationTextureFilter, MinificationTextureFilter } from "../constants.js";
2import { Texture } from "./Texture.js";
3
4/**
5 * This class can only be used in combination with {@link THREE.WebGLRenderer.copyFramebufferToTexture | WebGLRenderer.copyFramebufferToTexture()}.
6 * @example
7 * ```typescript
8 * const pixelRatio = window.devicePixelRatio;
9 * const textureSize = 128 * pixelRatio;
10 *
11 * // instantiate a framebuffer texture
12 * const frameTexture = new FramebufferTexture( textureSize, textureSize, RGBAFormat );
13 *
14 * // calculate start position for copying part of the frame data
15 * const vector = new Vector2();
16 * vector.x = ( window.innerWidth * pixelRatio / 2 ) - ( textureSize / 2 );
17 * vector.y = ( window.innerHeight * pixelRatio / 2 ) - ( textureSize / 2 );
18 *
19 * // render the scene
20 * renderer.clear();
21 * renderer.render( scene, camera );
22 *
23 * // copy part of the rendered frame into the framebuffer texture
24 * renderer.copyFramebufferToTexture( frameTexture, vector );
25 * ```
26 * @see Example: {@link https://threejs.org/examples/#webgl_framebuffer_texture | webgl_framebuffer_texture}
27 * @see {@link https://threejs.org/docs/index.html#api/en/textures/FramebufferTexture | Official Documentation}
28 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/FramebufferTexture.js | Source}
29 */
30export class FramebufferTexture extends Texture {
31 /**
32 * Create a new instance of {@link FramebufferTexture}
33 * @param width The width of the texture.
34 * @param height The height of the texture.
35 */
36 constructor(width: number, height: number);
37
38 /**
39 * Read-only flag to check if a given object is of type {@link FramebufferTexture}.
40 * @remarks This is a _constant_ value
41 * @defaultValue `true`
42 */
43 readonly isFramebufferTexture: true;
44
45 /**
46 * @override
47 * @defaultValue {@link THREE.NearestFilter}
48 */
49 magFilter: MagnificationTextureFilter;
50
51 /**
52 * @override
53 * @defaultValue {@link THREE.NearestFilter}
54 */
55 minFilter: MinificationTextureFilter;
56
57 /**
58 * @override
59 * @defaultValue `false`
60 */
61 generateMipmaps: boolean;
62}