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

Method initialize

demo/src/demos/ShockWaveDemo.js:202–293  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

200 }
201
202 initialize() {
203
204 const scene = this.scene;
205 const assets = this.assets;
206 const composer = this.composer;
207 const renderer = composer.getRenderer();
208 const domElement = renderer.domElement;
209
210 // Camera
211
212 const aspect = window.innerWidth / window.innerHeight;
213 const vFoV = calculateVerticalFoV(90, Math.max(aspect, 16 / 9));
214 const camera = new PerspectiveCamera(vFoV, aspect, 0.3, 2000);
215 this.camera = camera;
216
217 // Controls
218
219 const target = new Vector3(-0.5, 3, -0.25);
220 const { position, quaternion } = camera;
221 const controls = new SpatialControls(position, quaternion, domElement);
222 const settings = controls.settings;
223 settings.rotation.sensitivity = 2.2;
224 settings.rotation.damping = 0.05;
225 settings.translation.sensitivity = 3.0;
226 settings.translation.damping = 0.1;
227 controls.position.set(-8, 1, -0.25);
228 controls.lookAt(target);
229 this.controls = controls;
230
231 // Sky
232
233 scene.background = new Color(0xeeeeee);
234
235 // Lights
236
237 scene.add(...Sponza.createLights());
238
239 // Objects
240
241 scene.add(assets.get(Sponza.tag));
242
243 const mesh = new Mesh(
244 new SphereGeometry(0.2, 32, 32),
245 new MeshBasicMaterial({
246 color: 0x666666,
247 transparent: true,
248 depthWrite: false,
249 opacity: 0.3
250 })
251 );
252
253 mesh.position.copy(target);
254 this.cursor = mesh;
255 scene.add(mesh);
256
257 // Passes
258
259 const smaaEffect = new SMAAEffect(

Callers

nothing calls this directly

Calls 7

calculateVerticalFoVFunction · 0.85
getRendererMethod · 0.80
setMethod · 0.80
addMethod · 0.80
copyMethod · 0.80
addPassMethod · 0.80

Tested by

no test coverage detected