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

Method initialize

demo/src/demos/AntialiasingDemo.js:140–235  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

138 }
139
140 initialize() {
141
142 const scene = this.scene;
143 const assets = this.assets;
144 const composer = this.composer;
145 const renderer = composer.getRenderer();
146 const domElement = renderer.domElement;
147
148 // Camera
149
150 const aspect = window.innerWidth / window.innerHeight;
151 const vFoV = calculateVerticalFoV(90, Math.max(aspect, 16 / 9));
152 const camera = new PerspectiveCamera(vFoV, aspect, 0.3, 2000);
153 this.camera = camera;
154
155 // Controls
156
157 const { position, quaternion } = camera;
158 const controls = new SpatialControls(position, quaternion, domElement);
159 const settings = controls.settings;
160 settings.rotation.sensitivity = 2.2;
161 settings.rotation.damping = 0.05;
162 settings.translation.sensitivity = 3.0;
163 settings.translation.damping = 0.1;
164 controls.position.set(4, 8, 0.75);
165 controls.lookAt(-0.5, 6.5, -0.25);
166 this.controls = controls;
167
168 // Sky
169
170 scene.background = new Color(0xeeeeee);
171
172 // Lights
173
174 scene.add(...Sponza.createLights());
175
176 // Objects
177
178 scene.add(assets.get(Sponza.tag));
179
180 const cage = Cage.create(0x000000, 1.25, 0.025);
181 cage.position.set(-0.5, 6.5, -0.25);
182
183 cage.rotation.x += Math.PI * 0.1;
184 cage.rotation.y += Math.PI * 0.3;
185
186 this.object = cage;
187 scene.add(cage);
188
189 // Passes
190
191 const smaaEffect = new SMAAEffect(
192 assets.get("smaa-search"),
193 assets.get("smaa-area"),
194 SMAAPreset.HIGH,
195 EdgeDetectionMode.COLOR
196 );
197

Callers

nothing calls this directly

Calls 10

calculateVerticalFoVFunction · 0.85
getRendererMethod · 0.80
setMethod · 0.80
addMethod · 0.80
setPredicationModeMethod · 0.80
setPredicationScaleMethod · 0.80
setEnabledMethod · 0.80
addPassMethod · 0.80

Tested by

no test coverage detected