MCPcopy Create free account
hub / github.com/pmndrs/postprocessing / OutlineEffect

Class OutlineEffect

src/effects/OutlineEffect.js:22–827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 */
21
22export class OutlineEffect extends Effect {
23
24 /**
25 * Constructs a new outline effect.
26 *
27 * @param {Scene} scene - The main scene.
28 * @param {Camera} camera - The main camera.
29 * @param {Object} [options] - The options.
30 * @param {BlendFunction} [options.blendFunction=BlendFunction.SCREEN] - The blend function. Use `BlendFunction.ALPHA` for dark outlines.
31 * @param {Texture} [options.patternTexture=null] - A pattern texture.
32 * @param {Number} [options.patternScale=1.0] - The pattern scale.
33 * @param {Number} [options.edgeStrength=1.0] - The edge strength.
34 * @param {Number} [options.pulseSpeed=0.0] - The pulse speed. A value of zero disables the pulse effect.
35 * @param {Number} [options.visibleEdgeColor=0xffffff] - The color of visible edges.
36 * @param {Number} [options.hiddenEdgeColor=0x22090a] - The color of hidden edges.
37 * @param {KernelSize} [options.kernelSize=KernelSize.VERY_SMALL] - The blur kernel size.
38 * @param {Boolean} [options.blur=false] - Whether the outline should be blurred.
39 * @param {Boolean} [options.xRay=true] - Whether occluded parts of selected objects should be visible.
40 * @param {Number} [options.multisampling=0] - The number of samples used for multisample antialiasing. Requires WebGL 2.
41 * @param {Number} [options.resolutionScale=0.5] - The resolution scale.
42 * @param {Number} [options.resolutionX=Resolution.AUTO_SIZE] - The horizontal resolution.
43 * @param {Number} [options.resolutionY=Resolution.AUTO_SIZE] - The vertical resolution.
44 * @param {Number} [options.width=Resolution.AUTO_SIZE] - Deprecated. Use resolutionX instead.
45 * @param {Number} [options.height=Resolution.AUTO_SIZE] - Deprecated. Use resolutionY instead.
46 */
47
48 constructor(scene, camera, {
49 blendFunction = BlendFunction.SCREEN,
50 patternTexture = null,
51 patternScale = 1.0,
52 edgeStrength = 1.0,
53 pulseSpeed = 0.0,
54 visibleEdgeColor = 0xffffff,
55 hiddenEdgeColor = 0x22090a,
56 kernelSize = KernelSize.VERY_SMALL,
57 blur = false,
58 xRay = true,
59 multisampling = 0,
60 resolutionScale = 0.5,
61 width = Resolution.AUTO_SIZE,
62 height = Resolution.AUTO_SIZE,
63 resolutionX = width,
64 resolutionY = height
65 } = {}) {
66
67 super("OutlineEffect", fragmentShader, {
68 uniforms: new Map([
69 ["maskTexture", new Uniform(null)],
70 ["edgeTexture", new Uniform(null)],
71 ["edgeStrength", new Uniform(edgeStrength)],
72 ["visibleEdgeColor", new Uniform(new Color(visibleEdgeColor))],
73 ["hiddenEdgeColor", new Uniform(new Color(hiddenEdgeColor))],
74 ["pulse", new Uniform(1.0)],
75 ["patternScale", new Uniform(patternScale)],
76 ["patternTexture", new Uniform(null)]
77 ])
78 });
79

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…