()
| 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); |
nothing calls this directly
no test coverage detected