()
| 1903 | } |
| 1904 | |
| 1905 | initThreeScene() { |
| 1906 | this.scene = new THREE.Scene(); |
| 1907 | this.scene.background = null; |
| 1908 | |
| 1909 | this.renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); |
| 1910 | this.renderer.setPixelRatio(window.devicePixelRatio); |
| 1911 | this.renderer.setSize(window.innerWidth, window.innerHeight); |
| 1912 | document.body.appendChild(this.renderer.domElement); |
| 1913 | this.fpsMonitor = this.options.showFpsOverlay ? new FpsMonitor() : null; |
| 1914 | |
| 1915 | this.labelGroup = new THREE.Group(); |
| 1916 | this.scene.add(this.labelGroup); |
| 1917 | |
| 1918 | this.camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 200); |
| 1919 | this.camera.position.set(-15, 0, 15); |
| 1920 | |
| 1921 | this.controls = new THREE.OrbitControls(this.camera, this.renderer.domElement); |
| 1922 | this.controls.enableDamping = true; |
| 1923 | this.controls.dampingFactor = 0.08; |
| 1924 | this.controls.minDistance = 8; |
| 1925 | this.controls.maxDistance = 52; |
| 1926 | this.controls.target.set(0, 0, 0); |
| 1927 | |
| 1928 | const ambient = new THREE.AmbientLight(0xffffff, 1.2); |
| 1929 | this.scene.add(ambient); |
| 1930 | const hemisphere = new THREE.HemisphereLight(0xffffff, 0x1a1d2e, 0.9); |
| 1931 | hemisphere.position.set(0, 20, 0); |
| 1932 | this.scene.add(hemisphere); |
| 1933 | const directional = new THREE.DirectionalLight(0xffffff, 1.4); |
| 1934 | directional.position.set(18, 26, 24); |
| 1935 | directional.castShadow = true; |
| 1936 | this.scene.add(directional); |
| 1937 | const fillLight = new THREE.DirectionalLight(0xa8c5ff, 0.8); |
| 1938 | fillLight.position.set(-20, 18, -18); |
| 1939 | this.scene.add(fillLight); |
| 1940 | const rimLight = new THREE.PointLight(0x88a4ff, 0.6, 60, 1.6); |
| 1941 | rimLight.position.set(0, 12, -24); |
| 1942 | this.scene.add(rimLight); |
| 1943 | |
| 1944 | this.renderer.domElement.addEventListener("pointerdown", (event) => this.handleScenePointerDown(event)); |
| 1945 | this.renderer.domElement.addEventListener("pointerup", (event) => this.handleScenePointerUp(event)); |
| 1946 | window.addEventListener("resize", () => this.handleResize()); |
| 1947 | window.addEventListener("keydown", (event) => { |
| 1948 | if (event.defaultPrevented) return; |
| 1949 | if (event.key === "Escape") { |
| 1950 | this.clearSelection(); |
| 1951 | } |
| 1952 | }); |
| 1953 | } |
| 1954 | |
| 1955 | handleScenePointerDown(event) { |
| 1956 | if (!event.isPrimary && event.isPrimary !== undefined) return; |
no test coverage detected