()
| 96 | } |
| 97 | |
| 98 | initialize() { |
| 99 | |
| 100 | const scene = this.scene; |
| 101 | const assets = this.assets; |
| 102 | const composer = this.composer; |
| 103 | const renderer = composer.getRenderer(); |
| 104 | const domElement = renderer.domElement; |
| 105 | |
| 106 | // Camera |
| 107 | |
| 108 | const aspect = window.innerWidth / window.innerHeight; |
| 109 | const vFoV = calculateVerticalFoV(90, Math.max(aspect, 16 / 9)); |
| 110 | const camera = new PerspectiveCamera(vFoV, aspect, 0.3, 2000); |
| 111 | this.camera = camera; |
| 112 | |
| 113 | // Controls |
| 114 | |
| 115 | const { position, quaternion } = camera; |
| 116 | const controls = new SpatialControls(position, quaternion, domElement); |
| 117 | const settings = controls.settings; |
| 118 | settings.rotation.sensitivity = 2.2; |
| 119 | settings.rotation.damping = 0.05; |
| 120 | settings.translation.sensitivity = 3.0; |
| 121 | settings.translation.damping = 0.1; |
| 122 | controls.position.set(-9, 0.5, 0); |
| 123 | controls.lookAt(0, 3, -3.5); |
| 124 | this.controls = controls; |
| 125 | |
| 126 | // Sky |
| 127 | |
| 128 | scene.background = new Color(0xeeeeee); |
| 129 | |
| 130 | // Lights |
| 131 | |
| 132 | scene.add(...Sponza.createLights()); |
| 133 | |
| 134 | // Objects |
| 135 | |
| 136 | scene.add(assets.get(Sponza.tag)); |
| 137 | |
| 138 | // Passes |
| 139 | |
| 140 | const smaaEffect = new SMAAEffect( |
| 141 | assets.get("smaa-search"), |
| 142 | assets.get("smaa-area"), |
| 143 | SMAAPreset.HIGH, |
| 144 | EdgeDetectionMode.DEPTH |
| 145 | ); |
| 146 | |
| 147 | smaaEffect.edgeDetectionMaterial.setEdgeDetectionThreshold(0.01); |
| 148 | |
| 149 | const textureEffect = new TextureEffect({ |
| 150 | blendFunction: BlendFunction.COLOR_DODGE, |
| 151 | texture: assets.get("scratches-color") |
| 152 | }); |
| 153 | |
| 154 | const pass = new EffectPass(camera, smaaEffect, textureEffect); |
| 155 |
nothing calls this directly
no test coverage detected