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

Method setTextureSwizzleRGBA

src/effects/TextureEffect.js:192–206  ·  view source on GitHub ↗

* Sets the swizzles that will be applied to the components of a texel before it is written to the output color. * * @param {ColorChannel} r - The swizzle for the `r` component. * @param {ColorChannel} [g=r] - The swizzle for the `g` component. * @param {ColorChannel} [b=r] - The swizzle for

(r, g = r, b = r, a = r)

Source from the content-addressed store, hash-verified

190 */
191
192 setTextureSwizzleRGBA(r, g = r, b = r, a = r) {
193
194 const rgba = "rgba";
195 let swizzle = "";
196
197 if(r !== ColorChannel.RED || g !== ColorChannel.GREEN || b !== ColorChannel.BLUE || a !== ColorChannel.ALPHA) {
198
199 swizzle = [".", rgba[r], rgba[g], rgba[b], rgba[a]].join("");
200
201 }
202
203 this.defines.set("TEXEL", "texel" + swizzle);
204 this.setChanged();
205
206 }
207
208 /**
209 * Updates this effect.

Callers 1

toggleRenderModeMethod · 0.80

Calls 2

setMethod · 0.80
setChangedMethod · 0.80

Tested by

no test coverage detected