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

Method registerOptions

demo/src/demos/SSAODemo.js:225–431  ·  view source on GitHub ↗
(menu)

Source from the content-addressed store, hash-verified

223 }
224
225 registerOptions(menu) {
226
227 const color = new Color();
228 const capabilities = this.composer.getRenderer().capabilities;
229
230 const effectPass = this.effectPass;
231 const depthDownsamplingPass = this.depthDownsamplingPass;
232
233 const ssaoEffect = this.ssaoEffect;
234 const textureEffect = this.textureEffect;
235 const blendMode = ssaoEffect.blendMode;
236 const uniforms = ssaoEffect.ssaoMaterial.uniforms;
237
238 const RenderMode = {
239 DEFAULT: 0,
240 NORMALS: 1,
241 DEPTH: 2
242 };
243
244 const params = {
245 "distance": {
246 "threshold": uniforms.distanceCutoff.value.x,
247 "falloff": (uniforms.distanceCutoff.value.y -
248 uniforms.distanceCutoff.value.x)
249 },
250 "proximity": {
251 "threshold": uniforms.proximityCutoff.value.x,
252 "falloff": (uniforms.proximityCutoff.value.y -
253 uniforms.proximityCutoff.value.x)
254 },
255 "upsampling": {
256 "enabled": ssaoEffect.defines.has("DEPTH_AWARE_UPSAMPLING"),
257 "threshold": Number(ssaoEffect.defines.get("THRESHOLD"))
258 },
259 "distanceScaling": {
260 "enabled": ssaoEffect.distanceScaling,
261 "min scale": uniforms.minRadiusScale.value
262 },
263 "lum influence": ssaoEffect.uniforms.get("luminanceInfluence").value,
264 "intensity": uniforms.intensity.value,
265 "bias": uniforms.bias.value,
266 "fade": uniforms.fade.value,
267 "render mode": RenderMode.DEFAULT,
268 "resolution": ssaoEffect.resolution.scale,
269 "color": 0x000000,
270 "opacity": blendMode.opacity.value,
271 "blend mode": blendMode.blendFunction
272 };
273
274 function toggleRenderMode() {
275
276 const mode = Number(params["render mode"]);
277
278 if(mode === RenderMode.DEPTH) {
279
280 textureEffect.setTextureSwizzleRGBA(ColorChannel.ALPHA);
281
282 } else if(mode === RenderMode.NORMALS) {

Callers

nothing calls this directly

Calls 8

getRendererMethod · 0.80
addMethod · 0.80
setMethod · 0.80
recompileMethod · 0.80
convertSRGBToLinearMethod · 0.80
setBlendFunctionMethod · 0.80
setDistanceCutoffMethod · 0.45
setProximityCutoffMethod · 0.45

Tested by

no test coverage detected