forked from funwithtriangles/instatrip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postprocessing.d.ts
2844 lines (2665 loc) · 99.5 KB
/
postprocessing.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
declare module 'postprocessing' {
import {
Vector2,
WebGLRenderer,
Camera,
PerspectiveCamera,
Texture,
Material,
WebGLRenderTarget,
Scene,
DepthTexture,
Uniform,
Object3D,
Vector3,
ShaderMaterial,
DataTexture,
Mesh,
Points,
LoadingManager,
TextureDataType,
Loader,
} from 'three'
/**
* A color channel enumeration.
* @property RED - Red.
* @property GREEN - Green.
* @property BLUE - Blue.
* @property ALPHA - Alpha.
*/
export const ColorChannel: {
RED: number
GREEN: number
BLUE: number
ALPHA: number
}
/**
* The Disposable contract.
Implemented by objects that can free internal resources.
*/
export interface Disposable {
/**
* Frees internal resources.
*/
dispose(): void
}
/**
* The initializable contract.
Implemented by objects that can be initialized.
*/
export interface Initializable {
/**
* Performs initialization tasks.
* @param renderer - A renderer.
* @param alpha - Whether the renderer uses the alpha channel.
* @param frameBufferType - The type of the main frame buffers.
*/
initialize(renderer: WebGLRenderer, alpha: boolean, frameBufferType: number): void
}
/**
* Constructs a new adaptive luminance material.
*/
export class AdaptiveLuminanceMaterial {}
/**
* Constructs a new bokeh material.
* @param [fill = false] - Enables or disables the bokeh highlight fill mode.
* @param [foreground = false] - Determines whether this material will be applied to foreground colors.
*/
export class BokehMaterial {
constructor(fill?: boolean = false, foreground?: boolean = false)
/**
* Sets the texel size.
* @param x - The texel width.
* @param y - The texel height.
*/
setTexelSize(x: number, y: number): void
}
/**
* Constructs a new CoC material.
* @param camera - A camera.
*/
export class CircleOfConfusionMaterial {
constructor(camera: Camera)
/**
* The current depth packing.
*/
depthPacking: number
/**
* Adopts the settings of the given camera.
* @param [camera = null] - A camera.
*/
adoptCameraSettings(camera?: Camera = null): void
}
/**
* Constructs a new color edges material.
* @param [texelSize] - The absolute screen texel size.
*/
export class ColorEdgesMaterial {
constructor(texelSize?: Vector2)
/**
* Sets the local contrast adaptation factor.
If there is a neighbor edge that has _factor_ times bigger contrast than
the current edge, the edge will be discarded.
This allows to eliminate spurious crossing edges and is based on the fact
that if there is too much contrast in a direction, the perceptual contrast
in the other neighbors will be hidden.
* @param factor - The local contrast adaptation factor. Default is 2.0.
*/
setLocalContrastAdaptationFactor(factor: number): void
/**
* Sets the edge detection sensitivity.
A lower value results in more edges being detected at the expense of
performance.
0.1 is a reasonable value, and allows to catch most visible edges.
0.05 is a rather overkill value, that allows to catch 'em all.
If temporal supersampling is used, 0.2 could be a reasonable value, as low
contrast edges are properly filtered by just 2x.
* @param threshold - The edge detection sensitivity. Range: [0.05, 0.5].
*/
setEdgeDetectionThreshold(threshold: number): void
}
/**
* Constructs a new convolution material.
* @param [texelSize] - The absolute screen texel size.
*/
export class ConvolutionMaterial {
constructor(texelSize?: Vector2)
/**
* The current kernel size.
*/
kernelSize: KernelSize
/**
* Returns the kernel.
* @returns The kernel.
*/
getKernel(): Float32Array
/**
* Sets the texel size.
* @param x - The texel width.
* @param y - The texel height.
*/
setTexelSize(x: number, y: number): void
}
/**
* A kernel size enumeration.
* @property VERY_SMALL - A very small kernel that matches a 7x7 Gauss blur kernel.
* @property SMALL - A small kernel that matches a 15x15 Gauss blur kernel.
* @property MEDIUM - A medium sized kernel that matches a 23x23 Gauss blur kernel.
* @property LARGE - A large kernel that matches a 35x35 Gauss blur kernel.
* @property VERY_LARGE - A very large kernel that matches a 63x63 Gauss blur kernel.
* @property HUGE - A huge kernel that matches a 127x127 Gauss blur kernel.
*/
export const KernelSize: {
VERY_SMALL: number
SMALL: number
MEDIUM: number
LARGE: number
VERY_LARGE: number
HUGE: number
}
/**
* Constructs a new copy material.
*/
export class CopyMaterial {}
/**
* Constructs a new depth comparison material.
* @param [depthTexture = null] - A depth texture.
* @param [camera] - A camera.
*/
export class DepthComparisonMaterial {
constructor(depthTexture?: Texture, camera?: PerspectiveCamera)
/**
* Adopts the settings of the given camera.
* @param [camera = null] - A camera.
*/
adoptCameraSettings(camera?: Camera): void
}
/**
* Constructs a new depth mask material.
*/
export class DepthMaskMaterial {}
/**
* Constructs a new edge detection material.
* @param [texelSize] - The screen texel size.
* @param [mode = EdgeDetectionMode.COLOR] - The edge detection mode.
*/
export class EdgeDetectionMaterial {
constructor(texelSize?: Vector2, mode?: EdgeDetectionMode)
/**
* The current depth packing.
*/
depthPacking: number
/**
* Sets the edge detection mode.
Warning: If you intend to change the edge detection mode at runtime, make
sure that {@link EffectPass.needsDepthTexture} is set to `true` _before_
the EffectPass is added to the composer.
* @param mode - The edge detection mode.
*/
setEdgeDetectionMode(mode: EdgeDetectionMode): void
/**
* Sets the local contrast adaptation factor. Has no effect if the edge
detection mode is set to DEPTH.
If there is a neighbor edge that has _factor_ times bigger contrast than
the current edge, the edge will be discarded.
This allows to eliminate spurious crossing edges and is based on the fact
that if there is too much contrast in a direction, the perceptual contrast
in the other neighbors will be hidden.
* @param factor - The local contrast adaptation factor. Default is 2.0.
*/
setLocalContrastAdaptationFactor(factor: number): void
/**
* Sets the edge detection sensitivity.
A lower value results in more edges being detected at the expense of
performance.
0.1 is a reasonable value, and allows to catch most visible edges.
0.05 is a rather overkill value, that allows to catch 'em all.
If temporal supersampling is used, 0.2 could be a reasonable value, as low
contrast edges are properly filtered by just 2x.
* @param threshold - The edge detection sensitivity. Range: [0.05, 0.5].
*/
setEdgeDetectionThreshold(threshold: number): void
}
/**
* An enumeration of edge detection modes.
* @property DEPTH - Depth-based edge detection.
* @property LUMA - Luminance-based edge detection.
* @property COLOR - Chroma-based edge detection.
*/
export const EdgeDetectionMode: {
DEPTH: number
LUMA: number
COLOR: number
}
/**
* Constructs a new effect material.
* @param [shaderParts = null] - A collection of shader snippets. See {@link Section}.
* @param [defines = null] - A collection of preprocessor macro definitions.
* @param [uniforms = null] - A collection of uniforms.
* @param [camera = null] - A camera.
* @param [dithering = false] - Whether dithering should be enabled.
*/
export class EffectMaterial implements Resizable {
constructor(
shaderParts?: Map<string, string>,
defines?: Map<string, string>,
uniforms?: Map<string, Uniform>,
camera?: Camera,
dithering?: boolean
)
/**
* The current depth packing.
*/
depthPacking: number
/**
* Sets the shader parts.
* @param shaderParts - A collection of shader snippets. See {@link Section}.
* @returns This material.
*/
setShaderParts(shaderParts: Map<string, string>): EffectMaterial
/**
* Sets the shader macros.
* @param defines - A collection of preprocessor macro definitions.
* @returns This material.
*/
setDefines(defines: Map<string, string>): EffectMaterial
/**
* Sets the shader uniforms.
* @param uniforms - A collection of uniforms.
* @returns This material.
*/
setUniforms(uniforms: Map<string, Uniform>): EffectMaterial
/**
* Adopts the settings of the given camera.
* @param [camera = null] - A camera.
*/
adoptCameraSettings(camera?: Camera): void
/**
* Sets the resolution.
* @param width - The width.
* @param height - The height.
*/
setSize(width: number, height: number): void
}
/**
* An enumeration of shader code placeholders used by the {@link EffectPass}.
* @property FRAGMENT_HEAD - A placeholder for function and variable declarations inside the fragment shader.
* @property FRAGMENT_MAIN_UV - A placeholder for UV transformations inside the fragment shader.
* @property FRAGMENT_MAIN_IMAGE - A placeholder for color calculations inside the fragment shader.
* @property VERTEX_HEAD - A placeholder for function and variable declarations inside the vertex shader.
* @property VERTEX_MAIN_SUPPORT - A placeholder for supporting calculations inside the vertex shader.
*/
export const Section: {
FRAGMENT_HEAD: string
FRAGMENT_MAIN_UV: string
FRAGMENT_MAIN_IMAGE: string
VERTEX_HEAD: string
VERTEX_MAIN_SUPPORT: string
}
/**
* Constructs a new god rays material.
* @param lightPosition - The light position in screen space.
*/
export class GodRaysMaterial {
constructor(lightPosition: Vector2)
/**
* The amount of samples per pixel.
*/
samples: number
}
/**
* Constructs a new luminance material.
* @param [colorOutput = false] - Defines whether the shader should output colors scaled with their luminance value.
* @param [luminanceRange = null] - If provided, the shader will mask out texels that aren't in the specified luminance range.
*/
export class LuminanceMaterial {
constructor(colorOutput?: boolean, luminanceRange?: Vector2)
/**
* The luminance threshold.
*/
threshold: number
/**
* The luminance threshold smoothing.
*/
smoothing: number
/**
* Indicates whether the luminance threshold is enabled.
*/
useThreshold: boolean
/**
* Indicates whether color output is enabled.
*/
colorOutput: boolean
/**
* Enables or disables color output.
* @param enabled - Whether color output should be enabled.
*/
setColorOutputEnabled(enabled: boolean): void
/**
* Indicates whether luminance masking is enabled.
*/
useRange: boolean
/**
* Indicates whether luminance masking is enabled.
*/
luminanceRange: boolean
/**
* Enables or disables the luminance mask.
* @param enabled - Whether the luminance mask should be enabled.
*/
setLuminanceRangeEnabled(enabled: boolean): void
}
/**
* Constructs a new mask material.
* @param [maskTexture = null] - The mask texture.
*/
export class MaskMaterial {
constructor(maskTexture?: Texture)
/**
* Sets the mask texture.
*/
maskTexture: Texture
/**
* Sets the color channel to use for masking.
The default channel is `RED`.
*/
colorChannel: ColorChannel
/**
* Sets the masking technique.
The default function is `DISCARD`.
*/
maskFunction: MaskFunction
/**
* Indicates whether the masking is inverted.
*/
inverted: boolean
/**
* The current mask strength.
Individual mask values will be clamped to [0.0, 1.0].
*/
strength: number
}
/**
* A mask function enumeration.
* @property DISCARD - Discards elements when the respective mask value is zero.
* @property MULTIPLY - Multiplies the input buffer with the mask texture.
* @property MULTIPLY_RGB_SET_ALPHA - Multiplies the input RGB values with the mask and sets alpha to the mask value.
*/
export const MaskFunction: {
DISCARD: number
MULTIPLY: number
MULTIPLY_RGB_SET_ALPHA: number
}
/**
* Constructs a new outline material.
* @param [texelSize] - The screen texel size.
*/
export class OutlineMaterial {
constructor(texelSize?: Vector2)
/**
* Sets the texel size.
* @param x - The texel width.
* @param y - The texel height.
*/
setTexelSize(x: number, y: number): void
}
/**
* An outline shader material.
*/
export type OutlineEdgesMaterial = any
/**
* Constructs a new SMAA weights material.
* @param [texelSize] - The absolute screen texel size.
* @param [resolution] - The resolution.
*/
export class SMAAWeightsMaterial {
constructor(texelSize?: Vector2, resolution?: Vector2)
/**
* Sets the maximum amount of steps performed in the horizontal/vertical
pattern searches, at each side of the pixel.
In number of pixels, it's actually the double. So the maximum line length
perfectly handled by, for example 16, is 64 (perfectly means that longer
lines won't look as good, but are still antialiased).
* @param steps - The search steps. Range: [0, 112].
*/
setOrthogonalSearchSteps(steps: number): void
/**
* Specifies the maximum steps performed in the diagonal pattern searches, at
each side of the pixel. This search jumps one pixel at time.
On high-end machines this search is cheap (between 0.8x and 0.9x slower for
16 steps), but it can have a significant impact on older machines.
* @param steps - The search steps. Range: [0, 20].
*/
setDiagonalSearchSteps(steps: number): void
/**
* Specifies how much sharp corners will be rounded.
* @param rounding - The corner rounding amount. Range: [0, 100].
*/
setCornerRounding(rounding: number): void
/**
* Indicates whether diagonal pattern detection is enabled.
*/
diagonalDetection: boolean
/**
* Indicates whether corner rounding is enabled.
*/
cornerRounding: boolean
}
/**
* Constructs a new resizer.
* @param resizeable - A resizable object.
* @param [width = Resizer.AUTO_SIZE] - The width.
* @param [height = Resizer.AUTO_SIZE] - The height.
*/
export class Resizer {
constructor(resizeable: Resizable, width?: number, height?: number)
/**
* A resizable object.
*/
resizable: Resizable
/**
* The base size.
This size will be passed to the resizable object every time the width or
height is changed.
*/
base: Vector2
/**
* A scale.
If both the width and the height are set to {@link Resizer.AUTO_SIZE},
they will be scaled uniformly using this scalar.
*/
scale: number
/**
* The calculated width.
If both the width and the height are set to {@link Resizer.AUTO_SIZE}, the
base width will be returned.
*/
width: number
/**
* The calculated height.
If both the width and the height are set to {@link Resizer.AUTO_SIZE}, the
base height will be returned.
*/
height: number
/**
* An auto sizing constant.
Can be used to automatically calculate the width or height based on the
original aspect ratio.
*/
static AUTO_SIZE: number
}
export interface Pass extends Initializable, Resizable, Disposable {}
/**
* Constructs a new pass.
* @param [name = Pass] - The name of this pass. Does not have to be unique.
* @param [scene] - The scene to render. The default scene contains a single mesh that fills the screen.
* @param [camera] - A camera. Fullscreen effect passes don't require a camera.
*/
export class Pass implements Initializable, Resizable, Disposable {
constructor(name?: string, scene?: Scene, camera?: Camera)
/**
* The name of this pass.
*/
name: string
/**
* The scene to render.
*/
protected scene: Scene
/**
* The camera.
*/
protected camera: Camera
/**
* Only relevant for subclassing.
Indicates whether the {@link EffectComposer} should swap the frame
buffers after this pass has finished rendering.
Set this to `false` if this pass doesn't render to the output buffer or
the screen. Otherwise, the contents of the input buffer will be lost.
*/
needsSwap: boolean
/**
* Indicates whether the {@link EffectComposer} should prepare a depth
texture for this pass.
Set this to `true` if this pass relies on depth information from a
preceding {@link RenderPass}.
*/
needsDepthTexture: boolean
/**
* Indicates whether this pass should be executed.
*/
enabled: boolean
/**
* Indicates whether this pass should render to screen.
*/
renderToScreen: boolean
/**
* Returns the current fullscreen material.
* @returns The current fullscreen material, or null if there is none.
*/
getFullscreenMaterial(): Material
/**
* Sets the fullscreen material.
The material will be assigned to a mesh that fills the screen. The mesh
will be created once a material is assigned via this method.
* @param material - A fullscreen material.
*/
protected setFullscreenMaterial(material: Material): void
/**
* Returns the current depth texture.
* @returns The current depth texture, or null if there is none.
*/
getDepthTexture(): Texture
/**
* Sets the depth texture.
You may override this method if your pass relies on the depth information
of a preceding {@link RenderPass}.
* @param depthTexture - A depth texture.
* @param [depthPacking = 0] - The depth packing.
*/
setDepthTexture(depthTexture: Texture, depthPacking?: number): void
/**
* Renders the effect.
This is an abstract method that must be overridden.
* @param renderer - The renderer.
* @param inputBuffer - A frame buffer that contains the result of the previous pass.
* @param outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen.
* @param [deltaTime] - The time between the last frame and the current one in seconds.
* @param [stencilTest] - Indicates whether a stencil mask is active.
*/
render(
renderer: WebGLRenderer,
inputBuffer: WebGLRenderTarget,
outputBuffer: WebGLRenderTarget,
deltaTime?: number,
stencilTest?: boolean
): void
/**
* Updates this pass with the renderer's size.
You may override this method in case you want to be informed about the size
of the main frame buffer.
The {@link EffectComposer} calls this method before this pass is
initialized and every time its own size is updated.
* @example
* this.myRenderTarget.setSize(width, height);
* @param width - The renderer's width.
* @param height - The renderer's height.
*/
setSize(width: number, height: number): void
/**
* Performs initialization tasks.
By overriding this method you gain access to the renderer. You'll also be
able to configure your custom render targets to use the appropriate format
(RGB or RGBA).
The provided renderer can be used to warm up special off-screen render
targets by performing a preliminary render operation.
The {@link EffectComposer} calls this method when this pass is added to its
queue, but not before its size has been set.
* @example
* if(!alpha && frameBufferType === UnsignedByteType) { this.myRenderTarget.texture.format = RGBFormat; }
* @param renderer - The renderer.
* @param alpha - Whether the renderer uses the alpha channel or not.
* @param frameBufferType - The type of the main frame buffers.
*/
initialize(renderer: WebGLRenderer, alpha: boolean, frameBufferType: number): void
/**
* Performs a shallow search for disposable properties and deletes them. The
pass will be inoperative after this method was called!
Disposable objects:
- WebGLRenderTarget
- Material
- Texture
The {@link EffectComposer} calls this method when it is being destroyed.
You may, however, use it independently to free memory when you are certain
that you don't need this pass anymore.
*/
dispose(): void
}
/**
* Constructs a new blur pass.
* @param [options] - The options.
* @param [options.width = Resizer.AUTO_SIZE] - The blur render width.
* @param [options.height = Resizer.AUTO_SIZE] - The blur render height.
* @param [options.kernelSize = KernelSize.LARGE] - The blur kernel size.
*/
export class BlurPass {
constructor(
options?: Partial<{
width?: number
height?: number
kernelSize?: KernelSize
}>
)
/**
* The desired render resolution.
It's recommended to set the height or the width to an absolute value for
consistent results across different devices and resolutions.
Use {@link Resizer.AUTO_SIZE} for the width or height to automatically
calculate it based on its counterpart and the original aspect ratio.
*/
resolution: Resizer
/**
* Whether the blurred result should also be dithered using noise.
*/
dithering: boolean
/**
* The current width of the internal render targets.
*/
width: number
/**
* The current height of the internal render targets.
*/
height: number
/**
* The current blur scale.
*/
scale: number
/**
* The kernel size.
*/
kernelSize: KernelSize
/**
* Returns the current resolution scale.
* @returns The resolution scale.
*/
getResolutionScale(): number
/**
* Sets the resolution scale.
* @param scale - The new resolution scale.
*/
setResolutionScale(scale: number): void
/**
* Blurs the input buffer and writes the result to the output buffer. The
input buffer remains intact, unless it's also the output buffer.
* @param renderer - The renderer.
* @param inputBuffer - A frame buffer that contains the result of the previous pass.
* @param outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen.
* @param [deltaTime] - The time between the last frame and the current one in seconds.
* @param [stencilTest] - Indicates whether a stencil mask is active.
*/
render(
renderer: WebGLRenderer,
inputBuffer: WebGLRenderTarget,
outputBuffer: WebGLRenderTarget,
deltaTime?: number,
stencilTest?: boolean
): void
/**
* Updates the size of this pass.
* @param width - The width.
* @param height - The height.
*/
setSize(width: number, height: number): void
/**
* Performs initialization tasks.
* @param renderer - The renderer.
* @param alpha - Whether the renderer uses the alpha channel or not.
* @param frameBufferType - The type of the main frame buffers.
*/
initialize(renderer: WebGLRenderer, alpha: boolean, frameBufferType: number): void
/**
* An auto sizing flag.
*/
static AUTO_SIZE: number
}
/**
* Constructs a new clear mask pass.
*/
export class ClearMaskPass {
/**
* Disables the global stencil test.
* @param renderer - The renderer.
* @param inputBuffer - A frame buffer that contains the result of the previous pass.
* @param outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen.
* @param [deltaTime] - The time between the last frame and the current one in seconds.
* @param [stencilTest] - Indicates whether a stencil mask is active.
*/
render(
renderer: WebGLRenderer,
inputBuffer: WebGLRenderTarget,
outputBuffer: WebGLRenderTarget,
deltaTime?: number,
stencilTest?: boolean
): void
}
/**
* Constructs a new clear pass.
* @param [color = true] - Determines whether the color buffer should be cleared.
* @param [depth = true] - Determines whether the depth buffer should be cleared.
* @param [stencil = false] - Determines whether the stencil buffer should be cleared.
*/
export class ClearPass {
constructor(color?: boolean, depth?: boolean, stencil?: boolean)
/**
* Indicates whether the color buffer should be cleared.
*/
color: boolean
/**
* Indicates whether the depth buffer should be cleared.
*/
depth: boolean
/**
* Indicates whether the stencil buffer should be cleared.
*/
stencil: boolean
/**
* An override clear alpha.
The default value is -1.
*/
overrideClearAlpha: number
/**
* Clears the input buffer or the screen.
* @param renderer - The renderer.
* @param inputBuffer - A frame buffer that contains the result of the previous pass.
* @param outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen.
* @param [deltaTime] - The time between the last frame and the current one in seconds.
* @param [stencilTest] - Indicates whether a stencil mask is active.
*/
render(
renderer: WebGLRenderer,
inputBuffer: WebGLRenderTarget,
outputBuffer: WebGLRenderTarget,
deltaTime?: number,
stencilTest?: boolean
): void
}
/**
* Constructs a new render pass.
* @param scene - The scene to render.
* @param camera - The camera to use to render the scene.
* @param [overrideMaterial = null] - An override material for the scene.
*/
export class RenderPass extends Pass {
constructor(scene: Scene, camera: Camera, overrideMaterial?: Material)
/**
* An override material.
*/
overrideMaterial: Material
/**
* Indicates whether the target buffer should be cleared before rendering.
*/
clear: boolean
/**
* Returns the clear pass.
* @returns The clear pass.
*/
getClearPass(): ClearPass
/**
* Returns the current depth texture.
* @returns The current depth texture, or null if there is none.
*/
getDepthTexture(): Texture
/**
* Sets the depth texture.
The provided texture will be attached to the input buffer unless this pass
renders to screen.
* @param depthTexture - A depth texture.
* @param [depthPacking = 0] - The depth packing.
*/
setDepthTexture(depthTexture: DepthTexture, depthPacking?: number): void
/**
* Renders the scene.
* @param renderer - The renderer.
* @param inputBuffer - A frame buffer that contains the result of the previous pass.
* @param outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen.
* @param [deltaTime] - The time between the last frame and the current one in seconds.
* @param [stencilTest] - Indicates whether a stencil mask is active.
*/
render(
renderer: WebGLRenderer,
inputBuffer: WebGLRenderTarget,
outputBuffer: WebGLRenderTarget,
deltaTime?: number,
stencilTest?: boolean
): void
}
/**
* Constructs a new depth pass.
* @param scene - The scene to render.
* @param camera - The camera to use to render the scene.
* @param [options] - The options.
* @param [options.width = Resizer.AUTO_SIZE] - The render width.
* @param [options.height = Resizer.AUTO_SIZE] - The render height.
* @param [options.renderTarget] - A custom render target.
*/
export class DepthPass {
constructor(
scene: Scene,
camera: Camera,
options?: Partial<{
width?: number
height?: number
renderTarget?: WebGLRenderTarget
}>
)
/**
* A render target that contains the scene depth.
*/
renderTarget: WebGLRenderTarget
/**
* The desired render resolution.
Use {@link Resizer.AUTO_SIZE} for the width or height to automatically
calculate it based on its counterpart and the original aspect ratio.
*/
resolution: Resizer
/**
* Returns the current resolution scale.
* @returns The resolution scale.
*/
getResolutionScale(): number
/**
* Sets the resolution scale.
* @param scale - The new resolution scale.
*/
setResolutionScale(scale: number): void
/**
* Renders the scene depth.
* @param renderer - The renderer.
* @param inputBuffer - A frame buffer that contains the result of the previous pass.
* @param outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen.
* @param [deltaTime] - The time between the last frame and the current one in seconds.
* @param [stencilTest] - Indicates whether a stencil mask is active.
*/
render(
renderer: WebGLRenderer,
inputBuffer: WebGLRenderTarget,
outputBuffer: WebGLRenderTarget,
deltaTime?: number,
stencilTest?: boolean
): void
/**
* Updates the size of this pass.
* @param width - The width.
* @param height - The height.
*/
setSize(width: number, height: number): void
}
/**
* A blend function enumeration.
* @property SKIP - No blending. The effect will not be included in the final shader.
* @property ADD - Additive blending. Fast, but may produce washed out results.
* @property ALPHA - Alpha blending. Blends based on the alpha value of the new color.
* @property AVERAGE - Average blending.
* @property COLOR_BURN - Color burn.
* @property COLOR_DODGE - Color dodge.
* @property DARKEN - Prioritize darker colors.
* @property DIFFERENCE - Color difference.
* @property EXCLUSION - Color exclusion.
* @property LIGHTEN - Prioritize lighter colors.
* @property MULTIPLY - Color multiplication.
* @property DIVIDE - Color division.
* @property NEGATION - Color negation.
* @property NORMAL - Normal blending. The new color overwrites the old one.
* @property OVERLAY - Color overlay.
* @property REFLECT - Color reflection.
* @property SCREEN - Screen blending. The two colors are effectively projected on a white screen simultaneously.
* @property SOFT_LIGHT - Soft light blending.
* @property SUBTRACT - Color subtraction.
*/
export enum BlendFunction {
'SKIP',
'ADD',
'ALPHA',
'AVERAGE',
'COLOR_BURN',
'COLOR_DODGE',
'DARKEN',
'DIFFERENCE',
'EXCLUSION',
'LIGHTEN',
'MULTIPLY',
'DIVIDE',
'NEGATION',
'NORMAL',
'OVERLAY',
'REFLECT',
'SCREEN',
'SOFT_LIGHT',
'SUBTRACT',
}
/**
* Constructs a new blend mode.
* @param blendFunction - The blend function to use.
* @param opacity - The opacity of the color that will be blended with the base color.