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

Method initialize

demo/src/demos/BloomDemo.js:201–282  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

199 }
200
201 initialize() {
202
203 const scene = this.scene;
204 const assets = this.assets;
205 const composer = this.composer;
206 const renderer = composer.getRenderer();
207 const domElement = renderer.domElement;
208
209 // Camera
210
211 const aspect = window.innerWidth / window.innerHeight;
212 const vFoV = calculateVerticalFoV(90, Math.max(aspect, 16 / 9));
213 const camera = new PerspectiveCamera(vFoV, aspect, 0.3, 2000);
214 this.camera = camera;
215
216 // Controls
217
218 const { position, quaternion } = camera;
219 const controls = new SpatialControls(position, quaternion, domElement);
220 const settings = controls.settings;
221 settings.general.mode = ControlMode.THIRD_PERSON;
222 settings.rotation.sensitivity = 2.2;
223 settings.rotation.damping = 0.05;
224 settings.translation.enabled = false;
225 settings.zoom.sensitivity = 1.0;
226 controls.position.set(-10, 6, 15);
227 this.controls = controls;
228
229 // Sky
230
231 scene.background = assets.get("sky");
232
233 // Lights
234
235 const ambientLight = new AmbientLight(0xb8b8b8);
236 const mainLight = new DirectionalLight(0xffffff, 3);
237 mainLight.position.set(-1, 1, 1);
238
239 scene.add(ambientLight, mainLight);
240
241 // Objects
242
243 const cloud = ObjectCloud.create();
244 cloud.scale.setScalar(0.4);
245 this.object = cloud;
246 scene.add(cloud);
247
248 scene.add(Cage.create());
249
250 // Raycaster
251
252 this.raycaster = new Raycaster();
253
254 // Passes
255
256 const smaaEffect = new SMAAEffect(
257 assets.get("smaa-search"),
258 assets.get("smaa-area"),

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected