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

Method initialize

demo/src/demos/ColorGradingDemo.js:210–317  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

208 }
209
210 initialize() {
211
212 const scene = this.scene;
213 const assets = this.assets;
214 const composer = this.composer;
215 const renderer = composer.getRenderer();
216 const domElement = renderer.domElement;
217 const capabilities = renderer.capabilities;
218
219 // Camera
220
221 const aspect = window.innerWidth / window.innerHeight;
222 const vFoV = calculateVerticalFoV(90, Math.max(aspect, 16 / 9));
223 const camera = new PerspectiveCamera(vFoV, aspect, 0.3, 2000);
224 this.camera = camera;
225
226 // Controls
227
228 const { position, quaternion } = camera;
229 const controls = new SpatialControls(position, quaternion, domElement);
230 const settings = controls.settings;
231 settings.rotation.sensitivity = 2.2;
232 settings.rotation.damping = 0.05;
233 settings.translation.sensitivity = 3.0;
234 settings.translation.damping = 0.1;
235 controls.position.set(-9, 0.5, 0);
236 controls.lookAt(0, 3, -3.5);
237 this.controls = controls;
238
239 // Sky
240
241 scene.background = new Color(0xeeeeee);
242
243 // Lights
244
245 scene.add(...Sponza.createLights());
246
247 // Objects
248
249 scene.add(assets.get(Sponza.tag));
250
251 // LUT Preview
252
253 const img = document.createElement("img");
254 img.title = "This is a compressed preview image";
255 img.classList.add("lut", "hidden");
256 document.body.append(img);
257
258 // Passes
259
260 const smaaEffect = new SMAAEffect(
261 assets.get("smaa-search"),
262 assets.get("smaa-area"),
263 SMAAPreset.HIGH,
264 EdgeDetectionMode.DEPTH
265 );
266
267 smaaEffect.edgeDetectionMaterial.setEdgeDetectionThreshold(0.01);

Callers

nothing calls this directly

Calls 10

calculateVerticalFoVFunction · 0.85
getRendererMethod · 0.80
setMethod · 0.80
addMethod · 0.80
createNeutralMethod · 0.80
toDataTextureMethod · 0.80
convertToUint8Method · 0.80
addPassMethod · 0.80
fromMethod · 0.45

Tested by

no test coverage detected