From fbdda4c2323c5ba2c3816db85175b015060076e8 Mon Sep 17 00:00:00 2001 From: DPH888 <109276020+DPH888@users.noreply.github.com> Date: Wed, 15 May 2024 00:37:22 +0300 Subject: [PATCH 1/8] Added max camera zoom --- src/game.mjs | 78 ++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/game.mjs b/src/game.mjs index 49cd9b6..8c29077 100644 --- a/src/game.mjs +++ b/src/game.mjs @@ -1,26 +1,27 @@ import { engine } from "./engine.mjs"; import * as THREE from "three"; import * as CANNON from "cannon-es"; -import OrbitControls_ from 'three-orbit-controls'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import Stats from 'three/examples/jsm/libs/stats.module.js'; import { Ramp } from "./BuildingBlocks/Ramp.mjs"; import { BuildingBlock } from "./BuildingBlocks/BuildingBlock.mjs"; import { MovingPlatform } from "./BuildingBlocks/MovingPlatform.mjs"; import { Cylinder } from "./BuildingBlocks/Cylinder.mjs"; import { GolfHole } from "./BuildingBlocks/GolfHole.mjs"; -//Visuals for the game +// Visuals for the game import { Skybox, skybox_texture } from "./asset_loading/assets_3d.mjs"; import { firingTheBall } from "./firingTheBall.mjs"; -import { initSoundEvents,playRandomSoundEffectFall } from "./Sounds.mjs" +import { initSoundEvents, playRandomSoundEffectFall } from "./Sounds.mjs"; import { createPineTree } from "./BuildingBlock_no_collision/pine.mjs"; -import { createBall, ballMesh, ballBody,deleteBall } from "./ball.mjs"; +import { createBall, ballMesh, ballBody, deleteBall } from "./ball.mjs"; import { createNewEmitter, updateEmitters } from "./BuildingBlocks/Particle.mjs"; import { Menu, initMenu, menuConfig } from "./menu.mjs"; -import { areColliding } from "./utils.mjs"; -import { createHillsBufferGeometry } from "./Terrain/Hills.mjs"; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { forEach } from "lodash"; -const orbitControls = true; +import { areColliding } from './utils.mjs'; +import { createHillsBufferGeometry } from './Terrain/Hills.mjs'; +import { forEach } from 'lodash'; +const orbitControls = true; +let controls = null; let oldBallPosition = { x: 0, y: 0, z: 0 }; function createGround() { @@ -44,16 +45,17 @@ function initCamera() { engine.camera.position.set(0, 20, 80); engine.camera.lookAt(0, 10, 0); - //change far frustum plane to account for skybox + // Change far frustum plane to account for skybox engine.camera.far = 10000; + engine.camera.updateProjectionMatrix(); } function initLights() { - //Ambient light is now the skybox + // Ambient light is now the skybox const ambientLight = new THREE.AmbientLight(skybox_texture, 1); engine.scene.add(ambientLight); - //directional light is white to not tint the phong material too much + // Directional light is white to not tint the Phong material too much const directionalLight = new THREE.DirectionalLight(0xffffff, 1); directionalLight.position.set(10, 20, 10); directionalLight.lookAt(0, 0, 0); @@ -73,7 +75,7 @@ function initLevel() { new MovingPlatform(15, 20, 20, 30, 30, 30, 20, 1, 15); new Cylinder(25, 0, 2, 5, 5); - new GolfHole(51.2, -6, 0, 1.8, 1, 2.1, 64, 12, 51.2, -5.9, 0, 1, 2, 2) + new GolfHole(51.2, -6, 0, 1.8, 1, 2.1, 64, 12, 51.2, -5.9, 0, 1, 2, 2); createPineTree(0, 20, 0); } @@ -81,18 +83,18 @@ let ballDirectionMesh = []; function initBallDirectionArrows() { let colors = [0xffd000, 0xff9900, 0xff0000]; for (let i = 0; i < 3; i++) { - const ballDirectionGeometry = new THREE.ConeGeometry(.5, 5, 5); + const ballDirectionGeometry = new THREE.ConeGeometry(0.5, 5, 5); const ballDirectionMaterial = new THREE.MeshPhongMaterial({ color: colors[i], flatShading: true }); ballDirectionMesh.push(new THREE.Mesh(ballDirectionGeometry, ballDirectionMaterial)); - ballDirectionMesh[i].position.set(5, 30 + 4 * i, 0) + ballDirectionMesh[i].position.set(5, 30 + 4 * i, 0); engine.scene.add(ballDirectionMesh[i]); } } + let time = 0, obx = 0, oby = 0, obz = 0; -let controls = null; function initGame() { - //initSoundEvents(); + // initSoundEvents(); if (menuConfig.showMenu) { initMenu(initLevel); } else { @@ -107,15 +109,17 @@ function initGame() { // Init slider and buttons for firing the ball firingTheBall.initUI(); + // Setup camera position + initCamera(); + // Init orbit controls if (orbitControls) { controls = new OrbitControls(engine.camera, engine.canvas2d); controls.target = ballMesh.position; + controls.maxDistance = 150 + controls.enableDamping = true + controls.dampingFactor = .1 } - - // Setup camera position - initCamera(); - initLights(); initBallDirectionArrows(); @@ -123,18 +127,17 @@ function initGame() { // Init skybox const skybox = new Skybox(); - //DEBUG spawn test emitter + // DEBUG spawn test emitter let lastDX, lastDY, lastDZ; // Set custom update function engine.update = () => { - time++; - controls.update(); + if (controls) controls.update(); - //update all particle systems - updateEmitters() + // Update all particle systems + updateEmitters(); // Update ball mesh position ballMesh.position.copy(ballBody.position); @@ -151,7 +154,7 @@ function initGame() { if (checkBounce({ x: lastDX, y: lastDY, z: lastDZ }, currentVelocities)) { console.log("TUP"); - createNewEmitter(ballBody.position.x, ballBody.position.y, ballBody.position.z, "burst", {particle_cnt: 50, particle_lifetime: {min:0.2, max:0.5}, power: 0.05, fired: false}) + createNewEmitter(ballBody.position.x, ballBody.position.y, ballBody.position.z, "burst", { particle_cnt: 50, particle_lifetime: { min: 0.2, max: 0.5 }, power: 0.05, fired: false }); playRandomSoundEffectFall(); } lastDX = currentVelocities.x; @@ -163,17 +166,16 @@ function initGame() { show_the_ball_direction(); - if(ballBody.position.y < -50){ //respawns the ball if it has fallen beneath the map + if (ballBody.position.y < -50) { // Respawns the ball if it has fallen beneath the map ballBody.position.set(firingTheBall.shotFromWhere.x, firingTheBall.shotFromWhere.y, firingTheBall.shotFromWhere.z); - ballBody.type = CANNON.Body.STATIC + ballBody.type = CANNON.Body.STATIC; firingTheBall.isBallShot = false; } }; } - function make_the_ball_static_when_is_not_moving() { - if (time % 100 == 0) { + if (time % 100 === 0) { let error = 0, bx = Math.abs(ballMesh.position.x), by = Math.abs(ballMesh.position.y), bz = Math.abs(ballMesh.position.z); if (bx - obx >= 0) { @@ -212,9 +214,8 @@ function adjust_the_ball_direction() { function show_the_ball_direction() { for (let i = 0; i < 3; i++) { - if(firingTheBall.isBallShot){ + if (firingTheBall.isBallShot) { ballDirectionMesh[i].visible = false; - continue; } if (ballDirectionMesh[i] !== undefined) { @@ -228,20 +229,19 @@ function show_the_ball_direction() { ballMesh.position.z + Math.sin(firingTheBall.direction) * 3.5 * (i + 1) ); - - ballDirectionMesh[i].rotation.x = Math.PI/2; + ballDirectionMesh[i].rotation.x = Math.PI / 2; ballDirectionMesh[i].rotation.y = 0; - ballDirectionMesh[i].rotation.z = firingTheBall.direction - Math.PI/2; + ballDirectionMesh[i].rotation.z = firingTheBall.direction - Math.PI / 2; } else { ballDirectionMesh[i].visible = false; } } } -}; +} let game = { init: initGame -} +}; -export { game }; \ No newline at end of file +export { game }; From c671d104d5f798fd212db8c09a8a4b5e4b9e29f7 Mon Sep 17 00:00:00 2001 From: DPH888 <109276020+DPH888@users.noreply.github.com> Date: Wed, 15 May 2024 21:50:41 +0300 Subject: [PATCH 2/8] Added rotation around the ball at the start menu There is a small problem that you can still interact with the game right from the start menu --- src/game.mjs | 427 ++++++++++++++++++++++++++------------------------- 1 file changed, 215 insertions(+), 212 deletions(-) diff --git a/src/game.mjs b/src/game.mjs index 8c29077..b53b1fb 100644 --- a/src/game.mjs +++ b/src/game.mjs @@ -1,247 +1,250 @@ -import { engine } from "./engine.mjs"; -import * as THREE from "three"; -import * as CANNON from "cannon-es"; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import Stats from 'three/examples/jsm/libs/stats.module.js'; -import { Ramp } from "./BuildingBlocks/Ramp.mjs"; -import { BuildingBlock } from "./BuildingBlocks/BuildingBlock.mjs"; -import { MovingPlatform } from "./BuildingBlocks/MovingPlatform.mjs"; -import { Cylinder } from "./BuildingBlocks/Cylinder.mjs"; -import { GolfHole } from "./BuildingBlocks/GolfHole.mjs"; -// Visuals for the game -import { Skybox, skybox_texture } from "./asset_loading/assets_3d.mjs"; -import { firingTheBall } from "./firingTheBall.mjs"; -import { initSoundEvents, playRandomSoundEffectFall } from "./Sounds.mjs"; -import { createPineTree } from "./BuildingBlock_no_collision/pine.mjs"; -import { createBall, ballMesh, ballBody, deleteBall } from "./ball.mjs"; -import { createNewEmitter, updateEmitters } from "./BuildingBlocks/Particle.mjs"; -import { Menu, initMenu, menuConfig } from "./menu.mjs"; -import { areColliding } from './utils.mjs'; -import { createHillsBufferGeometry } from './Terrain/Hills.mjs'; -import { forEach } from 'lodash'; - -const orbitControls = true; -let controls = null; -let oldBallPosition = { x: 0, y: 0, z: 0 }; - -function createGround() { - // Create ground plane - const groundShape = new CANNON.Plane(); - const groundBody = new CANNON.Body({ mass: 2, shape: groundShape }); - groundBody.quaternion.setFromAxisAngle(new CANNON.Vec3(1, 0, 0), -Math.PI / 2); // Set rotation to align with Cannon.js - groundBody.position.set(0, 0, 0); // Set position - engine.cannonjs_world.addBody(groundBody); - - // Create visual representation of ground (in Three.js) - const groundGeometry = new THREE.PlaneGeometry(100, 100); - const groundMaterial = new THREE.MeshPhongMaterial({ color: 0x00ff00, side: THREE.DoubleSide }); - const groundMesh = new THREE.Mesh(groundGeometry, groundMaterial); - groundMesh.rotation.x = -Math.PI / 2; // Rotate to align with Cannon.js - engine.scene.add(groundMesh); -} - -function initCamera() { - // Init camera - engine.camera.position.set(0, 20, 80); - engine.camera.lookAt(0, 10, 0); - - // Change far frustum plane to account for skybox - engine.camera.far = 10000; - engine.camera.updateProjectionMatrix(); -} - -function initLights() { - // Ambient light is now the skybox - const ambientLight = new THREE.AmbientLight(skybox_texture, 1); - engine.scene.add(ambientLight); - - // Directional light is white to not tint the Phong material too much - const directionalLight = new THREE.DirectionalLight(0xffffff, 1); - directionalLight.position.set(10, 20, 10); - directionalLight.lookAt(0, 0, 0); - engine.scene.add(directionalLight); -} - -function initLevel() { - // createGround(); - const block1 = new BuildingBlock(0, 5, 0, 20, 10, 20); - // const block2 = new BuildingBlock(20, 0, 0, 50, 10, 20); - - // new BuildingBlock(0, 5, 0, 20, 10, 20); - new Ramp(16.5, 2.5, 0, 20, Math.PI, Math.PI / 4); - new Ramp(33, -5.2, 0, 20, 0, 0); - - new BuildingBlock(30, -10, 0, 40, 10, 20); - - new MovingPlatform(15, 20, 20, 30, 30, 30, 20, 1, 15); - new Cylinder(25, 0, 2, 5, 5); - new GolfHole(51.2, -6, 0, 1.8, 1, 2.1, 64, 12, 51.2, -5.9, 0, 1, 2, 2); - createPineTree(0, 20, 0); -} - -let ballDirectionMesh = []; -function initBallDirectionArrows() { - let colors = [0xffd000, 0xff9900, 0xff0000]; - for (let i = 0; i < 3; i++) { - const ballDirectionGeometry = new THREE.ConeGeometry(0.5, 5, 5); - const ballDirectionMaterial = new THREE.MeshPhongMaterial({ color: colors[i], flatShading: true }); - ballDirectionMesh.push(new THREE.Mesh(ballDirectionGeometry, ballDirectionMaterial)); - ballDirectionMesh[i].position.set(5, 30 + 4 * i, 0); - - engine.scene.add(ballDirectionMesh[i]); + import { engine } from "./engine.mjs"; + import * as THREE from "three"; + import * as CANNON from "cannon-es"; + import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + import Stats from 'three/examples/jsm/libs/stats.module.js'; + import { Ramp } from "./BuildingBlocks/Ramp.mjs"; + import { BuildingBlock } from "./BuildingBlocks/BuildingBlock.mjs"; + import { MovingPlatform } from "./BuildingBlocks/MovingPlatform.mjs"; + import { Cylinder } from "./BuildingBlocks/Cylinder.mjs"; + import { GolfHole } from "./BuildingBlocks/GolfHole.mjs"; + // Visuals for the game + import { Skybox, skybox_texture } from "./asset_loading/assets_3d.mjs"; + import { firingTheBall } from "./firingTheBall.mjs"; + import { initSoundEvents, playRandomSoundEffectFall } from "./Sounds.mjs"; + import { createPineTree } from "./BuildingBlock_no_collision/pine.mjs"; + import { createBall, ballMesh, ballBody, deleteBall } from "./ball.mjs"; + import { createNewEmitter, updateEmitters } from "./BuildingBlocks/Particle.mjs"; + import { Menu, initMenu, menuConfig } from "./menu.mjs"; + import { areColliding } from './utils.mjs'; + import { createHillsBufferGeometry } from './Terrain/Hills.mjs'; + + const orbitControls = true; + let controls = null; + let oldBallPosition = { x: 0, y: 0, z: 0 }; + + function createGround() { + // Create ground plane + const groundShape = new CANNON.Plane(); + const groundBody = new CANNON.Body({ mass: 2, shape: groundShape }); + groundBody.quaternion.setFromAxisAngle(new CANNON.Vec3(1, 0, 0), -Math.PI / 2); // Set rotation to align with Cannon.js + groundBody.position.set(0, 0, 0); // Set position + engine.cannonjs_world.addBody(groundBody); + + // Create visual representation of ground (in Three.js) + const groundGeometry = new THREE.PlaneGeometry(100, 100); + const groundMaterial = new THREE.MeshPhongMaterial({ color: 0x00ff00, side: THREE.DoubleSide }); + const groundMesh = new THREE.Mesh(groundGeometry, groundMaterial); + groundMesh.rotation.x = -Math.PI / 2; // Rotate to align with Cannon.js + engine.scene.add(groundMesh); } -} - -let time = 0, obx = 0, oby = 0, obz = 0; -function initGame() { - // initSoundEvents(); - if (menuConfig.showMenu) { - initMenu(initLevel); - } else { - menuConfig.gameStarted = true; - initSoundEvents(); - initLevel(); - } - // Create ball and attach to window - createBall(11, 30, 0); - - createHillsBufferGeometry(10, 10, 100, 5, 20); - // Init slider and buttons for firing the ball - firingTheBall.initUI(); - - // Setup camera position - initCamera(); - - // Init orbit controls - if (orbitControls) { - controls = new OrbitControls(engine.camera, engine.canvas2d); - controls.target = ballMesh.position; - controls.maxDistance = 150 - controls.enableDamping = true - controls.dampingFactor = .1 + + function initCamera() { + // Init camera + engine.camera.position.set(0, 20, 80); + engine.camera.lookAt(0, 10, 0); + + // Change far frustum plane to account for skybox + engine.camera.far = 10000; + engine.camera.updateProjectionMatrix(); } - initLights(); - initBallDirectionArrows(); + function initLights() { + // Ambient light is now the skybox + const ambientLight = new THREE.AmbientLight(skybox_texture, 1); + engine.scene.add(ambientLight); - // Init skybox - const skybox = new Skybox(); + // Directional light is white to not tint the Phong material too much + const directionalLight = new THREE.DirectionalLight(0xffffff, 1); + directionalLight.position.set(10, 20, 10); + directionalLight.lookAt(0, 0, 0); + engine.scene.add(directionalLight); + } - // DEBUG spawn test emitter + function initLevel() { + // createGround(); + const block1 = new BuildingBlock(0, 5, 0, 20, 10, 20); + // const block2 = new BuildingBlock(20, 0, 0, 50, 10, 20); - let lastDX, lastDY, lastDZ; + // new BuildingBlock(0, 5, 0, 20, 10, 20); + new Ramp(16.5, 2.5, 0, 20, Math.PI, Math.PI / 4); + new Ramp(33, -5.2, 0, 20, 0, 0); - // Set custom update function - engine.update = () => { - time++; - if (controls) controls.update(); + new BuildingBlock(30, -10, 0, 40, 10, 20); - // Update all particle systems - updateEmitters(); + new MovingPlatform(15, 20, 20, 30, 30, 30, 20, 1, 15); + new Cylinder(25, 0, 2, 5, 5); + new GolfHole(51.2, -6, 0, 1.8, 1, 2.1, 64, 12, 51.2, -5.9, 0, 1, 2, 2); + createPineTree(0, 20, 0); + } - // Update ball mesh position - ballMesh.position.copy(ballBody.position); + let ballDirectionMesh = []; + function initBallDirectionArrows() { + let colors = [0xffd000, 0xff9900, 0xff0000]; + for (let i = 0; i < 3; i++) { + const ballDirectionGeometry = new THREE.ConeGeometry(0.5, 5, 5); + const ballDirectionMaterial = new THREE.MeshPhongMaterial({ color: colors[i], flatShading: true }); + ballDirectionMesh.push(new THREE.Mesh(ballDirectionGeometry, ballDirectionMaterial)); + ballDirectionMesh[i].position.set(5, 30 + 4 * i, 0); - const bounceThreshold = 3; + engine.scene.add(ballDirectionMesh[i]); + } + } - function checkBounce(lastVelocities, currentVelocities) { - return Object.keys(currentVelocities).some(axis => - Math.abs(lastVelocities[axis] - currentVelocities[axis]) > bounceThreshold - ); + let time = 0, obx = 0, oby = 0, obz = 0; + function initGame() { + // initSoundEvents(); + if (menuConfig.showMenu) { + initMenu(initLevel); + } else { + menuConfig.gameStarted = true; + initSoundEvents(); + initLevel(); } + // Create ball and attach to window + createBall(11, 30, 0); + + createHillsBufferGeometry(10, 10, 100, 5, 20); + // Init slider and buttons for firing the ball + firingTheBall.initUI(); + + // Setup camera position + initCamera(); + + // Init orbit controls + if (orbitControls) { + controls = new OrbitControls(engine.camera, engine.canvas2d); + controls.target = ballMesh.position; + controls.maxDistance = 150 + controls.enableDamping = true + controls.dampingFactor = .1 + if (menuConfig.gameStarted == false) { + controls.autoRotate = true + controls.autoRotateSpeed = 0.5 + } + } + initLights(); - const currentVelocities = { x: ballBody.velocity.x, y: ballBody.velocity.y, z: ballBody.velocity.z }; + initBallDirectionArrows(); - if (checkBounce({ x: lastDX, y: lastDY, z: lastDZ }, currentVelocities)) { - console.log("TUP"); - createNewEmitter(ballBody.position.x, ballBody.position.y, ballBody.position.z, "burst", { particle_cnt: 50, particle_lifetime: { min: 0.2, max: 0.5 }, power: 0.05, fired: false }); - playRandomSoundEffectFall(); - } - lastDX = currentVelocities.x; - lastDY = currentVelocities.y; - lastDZ = currentVelocities.z; - make_the_ball_static_when_is_not_moving(); + // Init skybox + const skybox = new Skybox(); - adjust_the_ball_direction(); + // DEBUG spawn test emitter - show_the_ball_direction(); + let lastDX, lastDY, lastDZ; - if (ballBody.position.y < -50) { // Respawns the ball if it has fallen beneath the map - ballBody.position.set(firingTheBall.shotFromWhere.x, firingTheBall.shotFromWhere.y, firingTheBall.shotFromWhere.z); - ballBody.type = CANNON.Body.STATIC; - firingTheBall.isBallShot = false; - } - }; -} + // Set custom update function + engine.update = () => { + time++; + if (controls) controls.update(); -function make_the_ball_static_when_is_not_moving() { - if (time % 100 === 0) { - let error = 0, bx = Math.abs(ballMesh.position.x), by = Math.abs(ballMesh.position.y), bz = Math.abs(ballMesh.position.z); + // Update all particle systems + updateEmitters(); - if (bx - obx >= 0) { - error = bx - obx; - } else { - error = bx + obx; - } + // Update ball mesh position + ballMesh.position.copy(ballBody.position); - if (by - oby >= 0) { - error += by - oby; - } else { - error += by + oby; - } + const bounceThreshold = 3; - if (bz - obz >= 0) { - error += bz - obz; - } else { - error += bz + obz; - } + function checkBounce(lastVelocities, currentVelocities) { + return Object.keys(currentVelocities).some(axis => + Math.abs(lastVelocities[axis] - currentVelocities[axis]) > bounceThreshold + ); + } - if (error < 1) { - ballBody.type = CANNON.Body.STATIC; - oldBallPosition = { x: 0, y: 0, z: 0 }; - firingTheBall.isBallShot = false; - } + const currentVelocities = { x: ballBody.velocity.x, y: ballBody.velocity.y, z: ballBody.velocity.z }; - obx = Math.abs(ballMesh.position.x); - oby = Math.abs(ballMesh.position.y); - obz = Math.abs(ballMesh.position.z); + if (checkBounce({ x: lastDX, y: lastDY, z: lastDZ }, currentVelocities)) { + console.log("TUP"); + createNewEmitter(ballBody.position.x, ballBody.position.y, ballBody.position.z, "burst", { particle_cnt: 50, particle_lifetime: { min: 0.2, max: 0.5 }, power: 0.05, fired: false }); + playRandomSoundEffectFall(); + } + lastDX = currentVelocities.x; + lastDY = currentVelocities.y; + lastDZ = currentVelocities.z; + make_the_ball_static_when_is_not_moving(); + + adjust_the_ball_direction(); + + show_the_ball_direction(); + + if (ballBody.position.y < -50) { // Respawns the ball if it has fallen beneath the map + ballBody.position.set(firingTheBall.shotFromWhere.x, firingTheBall.shotFromWhere.y, firingTheBall.shotFromWhere.z); + ballBody.type = CANNON.Body.STATIC; + firingTheBall.isBallShot = false; + } + }; } -} -function adjust_the_ball_direction() { - firingTheBall.direction = Math.atan2(ballMesh.position.z - engine.camera.position.z, ballMesh.position.x - engine.camera.position.x); -} + function make_the_ball_static_when_is_not_moving() { + if (time % 100 == 0) { + let error = 0, bx = Math.abs(ballMesh.position.x), by = Math.abs(ballMesh.position.y), bz = Math.abs(ballMesh.position.z); -function show_the_ball_direction() { - for (let i = 0; i < 3; i++) { - if (firingTheBall.isBallShot) { - ballDirectionMesh[i].visible = false; - continue; - } - if (ballDirectionMesh[i] !== undefined) { - // Calculates the needed arrows - if (i <= Math.floor(Math.abs((firingTheBall.power + 20) / 100) * 2)) { - ballDirectionMesh[i].visible = true; - - ballDirectionMesh[i].position.set( - ballMesh.position.x + Math.cos(firingTheBall.direction) * 3.5 * (i + 1), - ballMesh.position.y, - ballMesh.position.z + Math.sin(firingTheBall.direction) * 3.5 * (i + 1) - ); + if (bx - obx >= 0) { + error = bx - obx; + } else { + error = bx + obx; + } - ballDirectionMesh[i].rotation.x = Math.PI / 2; - ballDirectionMesh[i].rotation.y = 0; - ballDirectionMesh[i].rotation.z = firingTheBall.direction - Math.PI / 2; + if (by - oby >= 0) { + error += by - oby; + } else { + error += by + oby; + } + if (bz - obz >= 0) { + error += bz - obz; } else { + error += bz + obz; + } + + if (error < 1) { + ballBody.type = CANNON.Body.STATIC; + oldBallPosition = { x: 0, y: 0, z: 0 }; + firingTheBall.isBallShot = false; + } + + obx = Math.abs(ballMesh.position.x); + oby = Math.abs(ballMesh.position.y); + obz = Math.abs(ballMesh.position.z); + } + } + + function adjust_the_ball_direction() { + firingTheBall.direction = Math.atan2(ballMesh.position.z - engine.camera.position.z, ballMesh.position.x - engine.camera.position.x); + } + + function show_the_ball_direction() { + for (let i = 0; i < 3; i++) { + if (firingTheBall.isBallShot) { ballDirectionMesh[i].visible = false; + continue; + } + if (ballDirectionMesh[i] !== undefined) { + // Calculates the needed arrows + if (i <= Math.floor(Math.abs((firingTheBall.power + 20) / 100) * 2)) { + ballDirectionMesh[i].visible = true; + + ballDirectionMesh[i].position.set( + ballMesh.position.x + Math.cos(firingTheBall.direction) * 3.5 * (i + 1), + ballMesh.position.y, + ballMesh.position.z + Math.sin(firingTheBall.direction) * 3.5 * (i + 1) + ); + + ballDirectionMesh[i].rotation.x = Math.PI / 2; + ballDirectionMesh[i].rotation.y = 0; + ballDirectionMesh[i].rotation.z = firingTheBall.direction - Math.PI / 2; + + } else { + ballDirectionMesh[i].visible = false; + } } } } -} -let game = { - init: initGame -}; + let game = { + init: initGame + }; -export { game }; + export { game }; From afdd4c931454f02f410a640651687ce1c04637e1 Mon Sep 17 00:00:00 2001 From: DPH888 <109276020+DPH888@users.noreply.github.com> Date: Thu, 16 May 2024 02:06:38 +0300 Subject: [PATCH 3/8] Added cooldown to the fyring ball usage --- src/BuildingBlocks/Particle.mjs | 2 - src/Sounds.mjs | 1 - src/asset_loading/asset_config.mjs | 74 +++++----- src/asset_loading/asset_loader2d.mjs | 170 +++++++++++----------- src/asset_loading/asset_loader_sounds.mjs | 42 +++--- src/asset_loading/assets_3d.mjs | 88 +++++------ src/ball.mjs | 18 ++- src/firingTheBall.mjs | 21 ++- src/game.mjs | 52 +++---- 9 files changed, 236 insertions(+), 232 deletions(-) diff --git a/src/BuildingBlocks/Particle.mjs b/src/BuildingBlocks/Particle.mjs index cff30d9..b2da5d0 100644 --- a/src/BuildingBlocks/Particle.mjs +++ b/src/BuildingBlocks/Particle.mjs @@ -57,7 +57,6 @@ class Particle { this.isDead = true; engine.scene.remove(this.sprite) this.material.dispose() - console.log("Killed particle") } } @@ -130,7 +129,6 @@ class Emitter { particle.killParticle(); } this.isDead = true; - console.log("Killed emitter i:", this.index) emitters.splice(this.index, 1); } } diff --git a/src/Sounds.mjs b/src/Sounds.mjs index 64280fe..abb8d14 100644 --- a/src/Sounds.mjs +++ b/src/Sounds.mjs @@ -31,7 +31,6 @@ function initSoundEvents() { let isMusicPlayingClick = false; // Flag to track playback document.body.addEventListener('click', (event) => { - console.log("Clicked at X:", event.clientX, "Y:", event.clientY); if (!isMusicPlayingClick) { // Only play if not already playing playBackgroundMusic(); diff --git a/src/asset_loading/asset_config.mjs b/src/asset_loading/asset_config.mjs index 3defbd2..1935944 100644 --- a/src/asset_loading/asset_config.mjs +++ b/src/asset_loading/asset_config.mjs @@ -1,38 +1,38 @@ -let default2dImages = [ - { imageName: 'circle', backupColor: 'black' }, - { imageName: 'backField', backupColor: 'green' } -]; - - -let materials_data = [ - { name: "BrickConcrete", path: './images/LiminalTextureLib/BrickConcrete1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Brick", path: './images/LiminalTextureLib/Brick.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Concrete1", path: './images/LiminalTextureLib/Concrete1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Concrete2", path: './images/LiminalTextureLib/Concrete3.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Grass", path: './images/LiminalTextureLib/Grass1.jpg', tilingx: 2, tilingy: 2, tint: 0xffffff }, - { name: "Metal1", path: './images/LiminalTextureLib/Metal1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.7, roughness: 0.5 }, - { name: "Planks1", path: './images/LiminalTextureLib/Planks1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Sand", path: './images/LiminalTextureLib/Sand.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "TreeBark", path: './images/LiminalTextureLib/TreeBark.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Asphalt", path: './images/LiminalTextureLib/Asphalt.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Wood", path: './images/LiminalTextureLib/Wood2.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0, roughness: 0.5 }, - { name: "Metal2", path: './images/LiminalTextureLib/Metal2.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.7, roughness: 0.5 }, - { name: "Ice", path: './images/LiminalTextureLib/Ice.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.3, roughness: 0.2 }, - { name: "GolfBall", path: './images/LiminalTextureLib/GolfBall.jpg', tilingx: 3, tilingy: 3, tint: 0xffffff, metalness: 0, roughness: 0.8 } -]; - - -const randomSounds = [ - "./music/golf ball hit 1.wav", - "./music/golf ball hit 2.wav", - "./music/golf ball hit 3.wav", - "./music/golf ball hit 4.wav", -]; - -const SoundsFalling = [ - "./music/golf ball fall.mp3", -]; - -const bgMusicFileName = './music/song.mp3'; - +let default2dImages = [ + { imageName: 'circle', backupColor: 'black' }, + { imageName: 'backField', backupColor: 'green' } +]; + + +let materials_data = [ + { name: "BrickConcrete", path: './images/LiminalTextureLib/BrickConcrete1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Brick", path: './images/LiminalTextureLib/Brick.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Concrete1", path: './images/LiminalTextureLib/Concrete1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Concrete2", path: './images/LiminalTextureLib/Concrete3.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Grass", path: './images/LiminalTextureLib/Grass1.jpg', tilingx: 2, tilingy: 2, tint: 0xffffff }, + { name: "Metal1", path: './images/LiminalTextureLib/Metal1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.7, roughness: 0.5 }, + { name: "Planks1", path: './images/LiminalTextureLib/Planks1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Sand", path: './images/LiminalTextureLib/Sand.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "TreeBark", path: './images/LiminalTextureLib/TreeBark.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Asphalt", path: './images/LiminalTextureLib/Asphalt.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Wood", path: './images/LiminalTextureLib/Wood2.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0, roughness: 0.5 }, + { name: "Metal2", path: './images/LiminalTextureLib/Metal2.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.7, roughness: 0.5 }, + { name: "Ice", path: './images/LiminalTextureLib/Ice.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.3, roughness: 0.2 }, + { name: "GolfBall", path: './images/LiminalTextureLib/GolfBall.jpg', tilingx: 3, tilingy: 3, tint: 0xffffff, metalness: 0, roughness: 0.8 } +]; + + +const randomSounds = [ + "./music/golf ball hit 1.wav", + "./music/golf ball hit 2.wav", + "./music/golf ball hit 3.wav", + "./music/golf ball hit 4.wav", +]; + +const SoundsFalling = [ + "./music/golf ball fall.mp3", +]; + +const bgMusicFileName = './music/song.mp3'; + export { default2dImages as images, materials_data, randomSounds, bgMusicFileName,SoundsFalling }; \ No newline at end of file diff --git a/src/asset_loading/asset_loader2d.mjs b/src/asset_loading/asset_loader2d.mjs index 0ecf0c6..74ce5f7 100644 --- a/src/asset_loading/asset_loader2d.mjs +++ b/src/asset_loading/asset_loader2d.mjs @@ -1,86 +1,86 @@ -import { images } from "./asset_config.mjs"; - -// Custom image class - sets imgObj.img.src after imgObj.draw() has been called -class MyImage { - constructor(src_, backupColor_) { - this.src = src_; - this.backupColor = backupColor_; - - // Create image object with no source path - this.img = new Image(); - this.canDraw = false; - this.drawBackup = false; - - this.img.onload = () => { - this.canDraw = true; - } - this.img.onerror = () => { - this.canDraw = false; - this.drawBackup = true; - throw "Unable to load image " + this.src; - } - - } - draw(x, y, xs, ys) { - if (xs == undefined) { - xs = this.img.width | 100; - ys = this.img.height | 100; - } - // If img.src is undefined - set it - if (!this.img.src) { - // Load image - this.img.src = this.src; - } else if (this.canDraw) { - try { - engine.context2d.drawImage(this.img, x, y, xs, ys); - } catch (e) { - this.canDraw = false; - this.drawBackup = true; - throw e; - } - } else if (this.drawBackup) { - engine.context2d.fillStyle = this.backupColor; - engine.context2d.fillRect(x, y, xs, ys); - } - } - preload() { - this.img.src = this.src; - } -} - -// Attach image objects to global scope -function initGlobalImages() { - // Load all images from ./images folder "BY HAND" - const imageObjectList = images; - - // For each element of array - create a global variable - for (let i = 0; i < imageObjectList.length; i++) { - let name = imageObjectList[i].imageName, - backupColor = imageObjectList[i].backupColor; - - // Handle image names like "asdfg[21]" - if (name.indexOf("[") > -1) { - let arrayName = name.slice(0, name.indexOf("[")); - let arrayNumber = name.slice(name.indexOf("[") + 1, name.indexOf("]")); - if (!window[arrayName]) { - window[arrayName] = []; - } - window[arrayName][arrayNumber] = tryToLoad(name, backupColor); - } else { - // Handle image names like "backMountains.png" - window[name] = tryToLoad(name, backupColor); - } - } -}; - - - -function tryToLoad(imageNameWithoutDotPng, backupColor) { - return new MyImage("./images/" + imageNameWithoutDotPng + ".png", backupColor); -} - -function tryToLoadWithFullPath(pathAndImageName, backupColor) { - return new MyImage(pathAndImageName, backupColor); -} - +import { images } from "./asset_config.mjs"; + +// Custom image class - sets imgObj.img.src after imgObj.draw() has been called +class MyImage { + constructor(src_, backupColor_) { + this.src = src_; + this.backupColor = backupColor_; + + // Create image object with no source path + this.img = new Image(); + this.canDraw = false; + this.drawBackup = false; + + this.img.onload = () => { + this.canDraw = true; + } + this.img.onerror = () => { + this.canDraw = false; + this.drawBackup = true; + throw "Unable to load image " + this.src; + } + + } + draw(x, y, xs, ys) { + if (xs == undefined) { + xs = this.img.width | 100; + ys = this.img.height | 100; + } + // If img.src is undefined - set it + if (!this.img.src) { + // Load image + this.img.src = this.src; + } else if (this.canDraw) { + try { + engine.context2d.drawImage(this.img, x, y, xs, ys); + } catch (e) { + this.canDraw = false; + this.drawBackup = true; + throw e; + } + } else if (this.drawBackup) { + engine.context2d.fillStyle = this.backupColor; + engine.context2d.fillRect(x, y, xs, ys); + } + } + preload() { + this.img.src = this.src; + } +} + +// Attach image objects to global scope +function initGlobalImages() { + // Load all images from ./images folder "BY HAND" + const imageObjectList = images; + + // For each element of array - create a global variable + for (let i = 0; i < imageObjectList.length; i++) { + let name = imageObjectList[i].imageName, + backupColor = imageObjectList[i].backupColor; + + // Handle image names like "asdfg[21]" + if (name.indexOf("[") > -1) { + let arrayName = name.slice(0, name.indexOf("[")); + let arrayNumber = name.slice(name.indexOf("[") + 1, name.indexOf("]")); + if (!window[arrayName]) { + window[arrayName] = []; + } + window[arrayName][arrayNumber] = tryToLoad(name, backupColor); + } else { + // Handle image names like "backMountains.png" + window[name] = tryToLoad(name, backupColor); + } + } +}; + + + +function tryToLoad(imageNameWithoutDotPng, backupColor) { + return new MyImage("./images/" + imageNameWithoutDotPng + ".png", backupColor); +} + +function tryToLoadWithFullPath(pathAndImageName, backupColor) { + return new MyImage(pathAndImageName, backupColor); +} + export {MyImage, initGlobalImages, tryToLoad, tryToLoadWithFullPath} \ No newline at end of file diff --git a/src/asset_loading/asset_loader_sounds.mjs b/src/asset_loading/asset_loader_sounds.mjs index 0aa18d8..6373ab3 100644 --- a/src/asset_loading/asset_loader_sounds.mjs +++ b/src/asset_loading/asset_loader_sounds.mjs @@ -1,22 +1,22 @@ -import {randomSounds, bgMusicFileName,SoundsFalling} from "./asset_config.mjs"; - -let preloadedSounds = { - randomSoundsArr: [], - bgMusicSound: null, - bounceAudio: null -}; -function initSounds() { - for(let soundPath of randomSounds) { - const audio = new Audio(soundPath); - preloadedSounds.randomSoundsArr.push(audio); - } - preloadedSounds.bgMusicSound = new Audio(bgMusicFileName); - preloadedSounds.bounceAudio = new Audio(SoundsFalling); -} -function initSoundsFalling() { - for(let soundPath of SoundsFalling) { - const audio = new Audio(soundPath); - preloadedSounds.randomSoundsArr.push(audio); - } -} +import {randomSounds, bgMusicFileName,SoundsFalling} from "./asset_config.mjs"; + +let preloadedSounds = { + randomSoundsArr: [], + bgMusicSound: null, + bounceAudio: null +}; +function initSounds() { + for(let soundPath of randomSounds) { + const audio = new Audio(soundPath); + preloadedSounds.randomSoundsArr.push(audio); + } + preloadedSounds.bgMusicSound = new Audio(bgMusicFileName); + preloadedSounds.bounceAudio = new Audio(SoundsFalling); +} +function initSoundsFalling() { + for(let soundPath of SoundsFalling) { + const audio = new Audio(soundPath); + preloadedSounds.randomSoundsArr.push(audio); + } +} export {preloadedSounds,initSoundsFalling, initSounds}; \ No newline at end of file diff --git a/src/asset_loading/assets_3d.mjs b/src/asset_loading/assets_3d.mjs index 6f72983..d1e4518 100644 --- a/src/asset_loading/assets_3d.mjs +++ b/src/asset_loading/assets_3d.mjs @@ -1,45 +1,45 @@ -import * as THREE from "three"; -import { engine } from "../engine.mjs"; -import { materials_data } from "./asset_config.mjs"; - -let skybox_texture = null; -class Skybox { - constructor() { - this.x = 0 - this.y = 0 - this.z = 0 - - //Load texture - skybox_texture = new THREE.TextureLoader().load('./images/SkyboxTexture.jpg') - - //Threejs setup - this.geometry = new THREE.SphereGeometry(500, 32, 16) - this.material = new THREE.MeshBasicMaterial({map: skybox_texture, side: THREE.BackSide, fog: false, }) - this.mesh = new THREE.Mesh( this.geometry, this.material); - - - //Add to scene - this.mesh.position.set(this.x, this.y, this.z) - engine.scene.add(this.mesh) - } -} - -function RegisterNewMaterial(name, path, tilingx, tilingy, tint, metalness, roughness) { - let _tex = new THREE.TextureLoader().load(path) - _tex.wrapS = THREE.RepeatWrapping - _tex.wrapT = THREE.RepeatWrapping - _tex.repeat.set(tilingx, tilingy) - if(metalness == undefined) metalness = 0; - if(roughness == undefined) roughness = 0.8; - materials[name] = new THREE.MeshStandardMaterial({color: tint, map: _tex, metalness: metalness, roughness: roughness}) -} - -function loadLiminalTextureLib() { - for(let material of materials_data) { - RegisterNewMaterial(material.name, material.path, material.tilingx, material.tilingy, material.tint, material.metalness, material.roughness); - - } -} -//simply use materials.xmaterial or materials["xmaterial"] and it will return a material for a three mesh -let materials = {} +import * as THREE from "three"; +import { engine } from "../engine.mjs"; +import { materials_data } from "./asset_config.mjs"; + +let skybox_texture = null; +class Skybox { + constructor() { + this.x = 0 + this.y = 0 + this.z = 0 + + //Load texture + skybox_texture = new THREE.TextureLoader().load('./images/SkyboxTexture.jpg') + + //Threejs setup + this.geometry = new THREE.SphereGeometry(500, 32, 16) + this.material = new THREE.MeshBasicMaterial({map: skybox_texture, side: THREE.BackSide, fog: false, }) + this.mesh = new THREE.Mesh( this.geometry, this.material); + + + //Add to scene + this.mesh.position.set(this.x, this.y, this.z) + engine.scene.add(this.mesh) + } +} + +function RegisterNewMaterial(name, path, tilingx, tilingy, tint, metalness, roughness) { + let _tex = new THREE.TextureLoader().load(path) + _tex.wrapS = THREE.RepeatWrapping + _tex.wrapT = THREE.RepeatWrapping + _tex.repeat.set(tilingx, tilingy) + if(metalness == undefined) metalness = 0; + if(roughness == undefined) roughness = 0.8; + materials[name] = new THREE.MeshStandardMaterial({color: tint, map: _tex, metalness: metalness, roughness: roughness}) +} + +function loadLiminalTextureLib() { + for(let material of materials_data) { + RegisterNewMaterial(material.name, material.path, material.tilingx, material.tilingy, material.tint, material.metalness, material.roughness); + + } +} +//simply use materials.xmaterial or materials["xmaterial"] and it will return a material for a three mesh +let materials = {} export {Skybox, materials, loadLiminalTextureLib, skybox_texture} \ No newline at end of file diff --git a/src/ball.mjs b/src/ball.mjs index acefe7c..8d548ef 100644 --- a/src/ball.mjs +++ b/src/ball.mjs @@ -32,11 +32,17 @@ function createBall(x, y, z) { ballMesh.position.set(x, y, z); engine.scene.add(ballMesh); } -function deleteBall() { - // Remove mesh from scene - engine.scene.remove(ballMesh); - // Remove body from world - engine.cannonjs_world.removeBody(ballBody); +function moveBall(ballBody) { + // Apply velocity to the ball body + ballBody.velocity.set(11, 30, 0); + + // Update ball position based on velocity (call this in your animation loop) + function updateBallPosition() { + ballMesh.position.copy(ballBody.position); } + + // Add updateBallPosition to the animation loop + engine.animationLoop.push(updateBallPosition); +} - export { createBall, deleteBall, ballMesh, ballBody }; + export { createBall, ballMesh, ballBody, moveBall }; diff --git a/src/firingTheBall.mjs b/src/firingTheBall.mjs index eeee657..63952c1 100644 --- a/src/firingTheBall.mjs +++ b/src/firingTheBall.mjs @@ -3,6 +3,9 @@ import { playRandomSoundEffect, playMusic } from "./Sounds.mjs"; import { ballBody } from "./ball.mjs"; import { menuConfig } from "./menu.mjs"; +let lastShotTime = 0; +const cooldownTime = 10 * 500; // 10 seconds in milliseconds + let firingTheBall = { power: 1, direction: 0, @@ -54,17 +57,26 @@ function initShootingUI() { }); } - function shoot() { + const currentTime = Date.now(); + + // Check if enough time has passed since the last shot + if (currentTime - lastShotTime < cooldownTime) {0 + console.log("Cooldown period active. Ostavat ti owe", (currentTime - lastShotTime)/1000, "sekundi do 5" ); + return; + } + + // Reset last shot time to current time + lastShotTime = currentTime; + firingTheBall.isBallShot = true; - if(menuConfig.sfxEnabled){ //there is no pause menu so this should work for now - playRandomSoundEffect(); + if (menuConfig.sfxEnabled) { + playRandomSoundEffect(); } firingTheBall.shotFromWhere.x = ballBody.position.x; firingTheBall.shotFromWhere.y = ballBody.position.y; firingTheBall.shotFromWhere.z = ballBody.position.z; - // Is STATIC if (ballBody.type == CANNON.Body.STATIC) { ballBody.type = CANNON.Body.DYNAMIC; } @@ -72,7 +84,6 @@ function shoot() { let calPower = firingTheBall.power; let calDirection = firingTheBall.direction; - // let impulse = new CANNON.Vec3(velocityX, velocityY, velocityZ); let impulse = new CANNON.Vec3(Math.cos(calDirection) * calPower, 0, Math.sin(calDirection) * calPower); let relativePoint = new CANNON.Vec3(); ballBody.applyImpulse(impulse, relativePoint); diff --git a/src/game.mjs b/src/game.mjs index b53b1fb..4f75434 100644 --- a/src/game.mjs +++ b/src/game.mjs @@ -13,7 +13,7 @@ import { firingTheBall } from "./firingTheBall.mjs"; import { initSoundEvents, playRandomSoundEffectFall } from "./Sounds.mjs"; import { createPineTree } from "./BuildingBlock_no_collision/pine.mjs"; - import { createBall, ballMesh, ballBody, deleteBall } from "./ball.mjs"; + import { createBall, ballMesh, ballBody, moveBall } from "./ball.mjs"; import { createNewEmitter, updateEmitters } from "./BuildingBlocks/Particle.mjs"; import { Menu, initMenu, menuConfig } from "./menu.mjs"; import { areColliding } from './utils.mjs'; @@ -21,7 +21,6 @@ const orbitControls = true; let controls = null; - let oldBallPosition = { x: 0, y: 0, z: 0 }; function createGround() { // Create ground plane @@ -38,7 +37,14 @@ groundMesh.rotation.x = -Math.PI / 2; // Rotate to align with Cannon.js engine.scene.add(groundMesh); } + engine.onmouseup = ((e) => { + let mouseX = e.clientX; + let mouseY = e.clientY; + if (areColliding(mouseX, mouseY, 1, 1, 275, 200, 250, 100)) { //Play + moveBall(); + } +}) function initCamera() { // Init camera engine.camera.position.set(0, 20, 80); @@ -91,7 +97,7 @@ } } - let time = 0, obx = 0, oby = 0, obz = 0; + let time = 0; function initGame() { // initSoundEvents(); if (menuConfig.showMenu) { @@ -156,7 +162,6 @@ const currentVelocities = { x: ballBody.velocity.x, y: ballBody.velocity.y, z: ballBody.velocity.z }; if (checkBounce({ x: lastDX, y: lastDY, z: lastDZ }, currentVelocities)) { - console.log("TUP"); createNewEmitter(ballBody.position.x, ballBody.position.y, ballBody.position.z, "burst", { particle_cnt: 50, particle_lifetime: { min: 0.2, max: 0.5 }, power: 0.05, fired: false }); playRandomSoundEffectFall(); } @@ -176,38 +181,23 @@ } }; } - function make_the_ball_static_when_is_not_moving() { - if (time % 100 == 0) { - let error = 0, bx = Math.abs(ballMesh.position.x), by = Math.abs(ballMesh.position.y), bz = Math.abs(ballMesh.position.z); - - if (bx - obx >= 0) { - error = bx - obx; - } else { - error = bx + obx; - } - - if (by - oby >= 0) { - error += by - oby; - } else { - error += by + oby; - } - - if (bz - obz >= 0) { - error += bz - obz; - } else { - error += bz + obz; - } - - if (error < 1) { + const velocityThreshold = 0; + const timeInterval = 10; + + if (time % timeInterval === 0 && ballBody.velocity.length() < velocityThreshold) { + const groundRay = new CANNON.Ray( + new CANNON.Vec3(ballBody.position.x, ballBody.position.y - 1.1, ballBody.position.z), + new CANNON.Vec3(ballBody.position.x, ballBody.position.y - 1.2, ballBody.position.z) + ); + + const intersect = groundRay.intersectWorld(engine.cannonjs_world, {}); + + if (intersect) { ballBody.type = CANNON.Body.STATIC; - oldBallPosition = { x: 0, y: 0, z: 0 }; firingTheBall.isBallShot = false; } - obx = Math.abs(ballMesh.position.x); - oby = Math.abs(ballMesh.position.y); - obz = Math.abs(ballMesh.position.z); } } From 79ac497482f767e58c46a0fe55cd26ac3a5f302f Mon Sep 17 00:00:00 2001 From: DPH888 <109276020+DPH888@users.noreply.github.com> Date: Thu, 16 May 2024 14:55:41 +0300 Subject: [PATCH 4/8] Moved the gold detection point into a different file There is a small bug that makes the gold hole and the detection point not show their colours --- src/BuildingBlocks/GolfHole.mjs | 52 +++++++------------ .../GolfHole_DetectionPoint.mjs | 24 +++++++++ src/Terrain/Hills.mjs | 7 --- src/ball.mjs | 16 +----- src/game.mjs | 25 ++++----- 5 files changed, 53 insertions(+), 71 deletions(-) create mode 100644 src/BuildingBlocks/GolfHole_DetectionPoint.mjs diff --git a/src/BuildingBlocks/GolfHole.mjs b/src/BuildingBlocks/GolfHole.mjs index 4975776..dfc56a5 100644 --- a/src/BuildingBlocks/GolfHole.mjs +++ b/src/BuildingBlocks/GolfHole.mjs @@ -1,39 +1,23 @@ import * as THREE from "three"; import * as CANNON from "cannon-es"; import { engine } from "../engine.mjs"; -class GolfHole { - //dupka - constructor(x, y, z, radiusTop, RadiusBottom,Height,RadialSegments,HightSegments,x2,y2,z2, radiusTop2, RadiusBottom2 ,Height2) { -const holeGeometry = new THREE.CylinderGeometry(radiusTop, RadiusBottom, Height, RadialSegments, HightSegments); -const holeMaterial = new THREE.MeshBasicMaterial({ color: 0x000000 }); -const hole = new THREE.Mesh(holeGeometry, holeMaterial); -hole.position.set(x,y,z); -engine.scene.add(hole); +class GolfHole { + constructor(x, y, z, radiusTop, RadiusBottom, Height, RadialSegments, HightSegments) { + const holeGeometry = new THREE.CylinderGeometry(radiusTop, RadiusBottom, Height, RadialSegments, HightSegments); + const holeMaterial = new THREE.MeshBasicMaterial({ color: 0x000000 }); + const hole = new THREE.Mesh(holeGeometry, holeMaterial); + hole.position.set(x, y, z); + engine.scene.add(hole); -const groundMaterialPhysics = new CANNON.Material(); -groundMaterialPhysics.restitution = 0; -var cylinderShape = new CANNON.Cylinder(radiusTop, RadiusBottom, Height, RadialSegments); -var cylinderBody = new CANNON.Body({ mass: 0, material: groundMaterialPhysics }); -cylinderBody.addShape(cylinderShape); -cylinderBody.position.set(x, y, z); -console.log(cylinderBody.position, hole.position); -cylinderBody.type = CANNON.Body.STATIC; -engine.cannonjs_world.addBody(cylinderBody); - //detection point -var geometry = new THREE.CylinderGeometry(radiusTop2, RadiusBottom2 ,Height2); -var material = new THREE.MeshBasicMaterial({ color: 0xff0000, transparent: true, opacity: 0.5 }); -var ellipse = new THREE.Mesh(geometry, material); -ellipse.position.set(x2,y2,z2); -engine.scene.add(ellipse); - -const groundMaterialPhysics2 = new CANNON.Material(); -groundMaterialPhysics2.restitution = 1; -var cylinderShape = new CANNON.Cylinder(radiusTop2, RadiusBottom2, Height2, 32); -var cylinderBody = new CANNON.Body({ mass: 0, material: groundMaterialPhysics2 }); -cylinderBody.addShape(cylinderShape); -cylinderBody.position.set(x, y, z); -console.log(cylinderBody.position, ellipse.position); -cylinderBody.type = CANNON.Body.STATIC; -engine.cannonjs_world.addBody(cylinderBody); -}} + const groundMaterialPhysics = new CANNON.Material(); + groundMaterialPhysics.restitution = 0; + var cylinderShape = new CANNON.Cylinder(radiusTop, RadiusBottom, Height, RadialSegments); + var cylinderBody = new CANNON.Body({ mass: 0, material: groundMaterialPhysics }); + cylinderBody.addShape(cylinderShape); + cylinderBody.position.set(x, y, z); + console.log(cylinderBody.position, hole.position); + cylinderBody.type = CANNON.Body.STATIC; + engine.cannonjs_world.addBody(cylinderBody); + } +} export { GolfHole }; \ No newline at end of file diff --git a/src/BuildingBlocks/GolfHole_DetectionPoint.mjs b/src/BuildingBlocks/GolfHole_DetectionPoint.mjs new file mode 100644 index 0000000..b26357e --- /dev/null +++ b/src/BuildingBlocks/GolfHole_DetectionPoint.mjs @@ -0,0 +1,24 @@ +import * as THREE from "three"; +import * as CANNON from "cannon-es"; +import { engine } from "../engine.mjs"; + +class GolfHole_Detection{ + constructor_detectionPoint(x,y,z, radiusTop, RadiusBottom ,Height) { + var geometry = new THREE.CylinderGeometry(radiusTop, RadiusBottom ,Height); + var material = new THREE.MeshBasicMaterial({ color: 0xff0000, transparent: true, opacity: 1 }); + var ellipse = new THREE.Mesh(geometry, material); + ellipse.position.set(x,y,z); + engine.scene.add(ellipse); + + const groundMaterialPhysics2 = new CANNON.Material(); + groundMaterialPhysics2.restitution = 1; + var cylinderShape = new CANNON.Cylinder(radiusTop, RadiusBottom, Height, 32); + var cylinderBody = new CANNON.Body({ mass: 0, material: groundMaterialPhysics2 }); + cylinderBody.addShape(cylinderShape); + cylinderBody.position.set(x, y, z); + console.log(cylinderBody.position, ellipse.position); + cylinderBody.type = CANNON.Body.STATIC; + engine.cannonjs_world.addBody(cylinderBody); + } +} +export { GolfHole_Detection }; \ No newline at end of file diff --git a/src/Terrain/Hills.mjs b/src/Terrain/Hills.mjs index af9e754..871042a 100644 --- a/src/Terrain/Hills.mjs +++ b/src/Terrain/Hills.mjs @@ -8,10 +8,8 @@ function createHillsBufferGeometry(sizeX, sizeY, N, noiseScale, scaleZ) { // TODO: refactor and make readable const uvTex = new THREE.TextureLoader().load("./images/LiminalTextureLib/Grass2.jpg"); - console.log(uvTex) const material01 = new THREE.MeshPhongMaterial({ map: uvTex, side: THREE.DoubleSide, }); // uv grid const geometry = new THREE.BufferGeometry(); - console.log(sizeX, sizeY) // const vertices = new Float32Array([ // -1.0, -1.0, 1.0, // v0 // 1.0, -1.0, 1.0, // v1 @@ -45,7 +43,6 @@ function createHillsBufferGeometry(sizeX, sizeY, N, noiseScale, scaleZ) { [x + (y+1)*N+ 1, x + (y+1)*N, x+y*N+ 1] )).reduce((list, curTriangle)=>Array.prototype.concat(list, curTriangle), []) .reduce((list, curTriangle)=>Array.prototype.concat(list, curTriangle), []); - console.log(vertices); // console.log(ind2); // const indices = [ @@ -55,15 +52,12 @@ function createHillsBufferGeometry(sizeX, sizeY, N, noiseScale, scaleZ) { // 2, 3, 0, // ]; let indices = Array.prototype.concat(indices1, indices2); - console.log(indices); let repOn = 2; let uvMap = Array.from({ length: N }, (_, x) => Array.from({ length: N }, (_, y) => [(x%repOn)/repOn, (y%repOn)/repOn] )).reduce((list, curTriangle)=>Array.prototype.concat(list, curTriangle), []) .reduce((list, curTriangle)=>Array.prototype.concat(list, curTriangle), []); - console.log(vertices); - console.log(uvMap); geometry.setIndex(indices); geometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(vertices), 3)); geometry.setAttribute('uv', new THREE.BufferAttribute(new Float32Array(uvMap), 2)); @@ -72,7 +66,6 @@ function createHillsBufferGeometry(sizeX, sizeY, N, noiseScale, scaleZ) { // const material = new THREE.MeshPhongMaterial({ color: "green" }); const mesh = new THREE.Mesh(geometry, material01); - console.log(mesh); mesh.position.set(-sizeX*N/2, -20, -sizeY*N/2); mesh.scale.set(sizeX, scaleZ, sizeY); engine.scene.add(mesh); diff --git a/src/ball.mjs b/src/ball.mjs index 8d548ef..73b77e9 100644 --- a/src/ball.mjs +++ b/src/ball.mjs @@ -5,7 +5,6 @@ import { materials } from "./asset_loading/assets_3d.mjs"; let ballMesh, ballBody; function createBall(x, y, z) { - // Ball const ballMaterialPhysics = new CANNON.Material(); // Create a new material ballMaterialPhysics.friction = 1; ballMaterialPhysics.restitution = 1.3; @@ -32,17 +31,4 @@ function createBall(x, y, z) { ballMesh.position.set(x, y, z); engine.scene.add(ballMesh); } -function moveBall(ballBody) { - // Apply velocity to the ball body - ballBody.velocity.set(11, 30, 0); - - // Update ball position based on velocity (call this in your animation loop) - function updateBallPosition() { - ballMesh.position.copy(ballBody.position); - } - - // Add updateBallPosition to the animation loop - engine.animationLoop.push(updateBallPosition); -} - - export { createBall, ballMesh, ballBody, moveBall }; + export { createBall, ballMesh, ballBody }; diff --git a/src/game.mjs b/src/game.mjs index 4f75434..d5c1504 100644 --- a/src/game.mjs +++ b/src/game.mjs @@ -3,20 +3,21 @@ import * as CANNON from "cannon-es"; import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; import Stats from 'three/examples/jsm/libs/stats.module.js'; + import { areColliding } from './utils.mjs'; + import { firingTheBall } from "./firingTheBall.mjs"; + import { Menu, initMenu, menuConfig } from "./menu.mjs"; + import { initSoundEvents, playRandomSoundEffectFall } from "./Sounds.mjs"; + // Visuals for the game import { Ramp } from "./BuildingBlocks/Ramp.mjs"; import { BuildingBlock } from "./BuildingBlocks/BuildingBlock.mjs"; import { MovingPlatform } from "./BuildingBlocks/MovingPlatform.mjs"; import { Cylinder } from "./BuildingBlocks/Cylinder.mjs"; import { GolfHole } from "./BuildingBlocks/GolfHole.mjs"; - // Visuals for the game + import { GolfHole_Detection } from "./BuildingBlocks/GolfHole_DetectionPoint.mjs"; import { Skybox, skybox_texture } from "./asset_loading/assets_3d.mjs"; - import { firingTheBall } from "./firingTheBall.mjs"; - import { initSoundEvents, playRandomSoundEffectFall } from "./Sounds.mjs"; import { createPineTree } from "./BuildingBlock_no_collision/pine.mjs"; - import { createBall, ballMesh, ballBody, moveBall } from "./ball.mjs"; + import { createBall, ballMesh, ballBody } from "./ball.mjs"; import { createNewEmitter, updateEmitters } from "./BuildingBlocks/Particle.mjs"; - import { Menu, initMenu, menuConfig } from "./menu.mjs"; - import { areColliding } from './utils.mjs'; import { createHillsBufferGeometry } from './Terrain/Hills.mjs'; const orbitControls = true; @@ -37,14 +38,7 @@ groundMesh.rotation.x = -Math.PI / 2; // Rotate to align with Cannon.js engine.scene.add(groundMesh); } - engine.onmouseup = ((e) => { - let mouseX = e.clientX; - let mouseY = e.clientY; - if (areColliding(mouseX, mouseY, 1, 1, 275, 200, 250, 100)) { //Play - moveBall(); - } -}) function initCamera() { // Init camera engine.camera.position.set(0, 20, 80); @@ -80,7 +74,9 @@ new MovingPlatform(15, 20, 20, 30, 30, 30, 20, 1, 15); new Cylinder(25, 0, 2, 5, 5); - new GolfHole(51.2, -6, 0, 1.8, 1, 2.1, 64, 12, 51.2, -5.9, 0, 1, 2, 2); + new GolfHole(51.2, -6, 0, 1.8, 1, 2.1, 64, 12); + new GolfHole_Detection(51.2, -5.9, 0, 1, 2, 2); + createPineTree(0, 20, 0); } @@ -144,7 +140,6 @@ engine.update = () => { time++; if (controls) controls.update(); - // Update all particle systems updateEmitters(); From 43ce72c2652b2fc11965f62df526e31ee13eadff Mon Sep 17 00:00:00 2001 From: DPH888 <109276020+DPH888@users.noreply.github.com> Date: Sat, 18 May 2024 23:39:18 +0300 Subject: [PATCH 5/8] Refactoring --- src/game.mjs | 7 ++++--- src/utils.mjs | 42 ++++++++++++++++++------------------------ 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/src/game.mjs b/src/game.mjs index d5c1504..b71218b 100644 --- a/src/game.mjs +++ b/src/game.mjs @@ -3,7 +3,7 @@ import * as CANNON from "cannon-es"; import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; import Stats from 'three/examples/jsm/libs/stats.module.js'; - import { areColliding } from './utils.mjs'; + import { areColliding, randomInteger, drawLine, drawImage, isFunction, createButton } from './utils.mjs'; import { firingTheBall } from "./firingTheBall.mjs"; import { Menu, initMenu, menuConfig } from "./menu.mjs"; import { initSoundEvents, playRandomSoundEffectFall } from "./Sounds.mjs"; @@ -19,7 +19,6 @@ import { createBall, ballMesh, ballBody } from "./ball.mjs"; import { createNewEmitter, updateEmitters } from "./BuildingBlocks/Particle.mjs"; import { createHillsBufferGeometry } from './Terrain/Hills.mjs'; - const orbitControls = true; let controls = null; @@ -40,6 +39,8 @@ } function initCamera() { + createButton("Play",275,175,250,100,"red",50,"white"); + // Init camera engine.camera.position.set(0, 20, 80); engine.camera.lookAt(0, 10, 0); @@ -123,6 +124,7 @@ if (menuConfig.gameStarted == false) { controls.autoRotate = true controls.autoRotateSpeed = 0.5 + } } initLights(); @@ -138,7 +140,6 @@ // Set custom update function engine.update = () => { - time++; if (controls) controls.update(); // Update all particle systems updateEmitters(); diff --git a/src/utils.mjs b/src/utils.mjs index 05610cd..66a3658 100644 --- a/src/utils.mjs +++ b/src/utils.mjs @@ -1,43 +1,37 @@ function areColliding(Ax, Ay, Awidth, Aheight, Bx, By, Bwidth, Bheight) { - if (Bx <= Ax + Awidth) { - if (Ax <= Bx + Bwidth) { - if (By <= Ay + Aheight) { - if (Ay <= By + Bheight) { - return 1; - } - } - } - } - return 0; -}; + return Bx <= Ax + Awidth && Ax <= Bx + Bwidth && By <= Ay + Aheight && Ay <= By + Bheight; +} function randomInteger(upTo) { return Math.floor(Math.random() * upTo); } function drawLine(startX, startY, endX, endY) { - // For better performance bunch calls to lineTo without beginPath() and stroke() inbetween. - engine.context2d.beginPath(); // resets the current path + engine.context2d.beginPath(); engine.context2d.moveTo(startX, startY); engine.context2d.lineTo(endX, endY); engine.context2d.stroke(); } + function drawImage(myImageObject, x, y, xs, ys) { myImageObject.draw(x, y, xs, ys); } function isFunction(f) { - return typeof (f) == "function"; + return typeof f == "function"; } -function createButton(text,x,y,w,h,buttonCol,fontsize,textCol, font = "Arial"){ - //Create background - engine.context2d.fillStyle = buttonCol; - engine.context2d.fillRect(x,y,w,h); - //Create text - engine.context2d.fillStyle = textCol; - engine.context2d.font = fontsize + "px " + font; - //i do not know why this works, it but it just does - engine.context2d.fillText(text,x + w/2 - (text.length*fontsize)/4, y + h/2 + fontsize/3); +function createButton(text, x, y, w, h, buttonCol, fontsize, textCol, font = "Arial") { + const ctx = engine.context2d; + // Create background + ctx.fillStyle = buttonCol; + ctx.fillRect(x, y, w, h); + // Create text + ctx.fillStyle = textCol; + ctx.font = `${fontsize}px ${font}`; + ctx.textAlign = "center"; + ctx.textBaseline = "middle"; + ctx.fillText(text, x + w / 2, y + h / 2); } -export {areColliding, randomInteger, drawLine, drawImage, isFunction, createButton}; \ No newline at end of file + +export { areColliding, randomInteger, drawLine, drawImage, isFunction, createButton }; From ccecbe4e2e05bd094fc51c3b95f147efb767084c Mon Sep 17 00:00:00 2001 From: DPH888 <109276020+DPH888@users.noreply.github.com> Date: Wed, 22 May 2024 22:49:32 +0300 Subject: [PATCH 6/8] Buttons rounded, new text adding function --- src/resetButton.mjs | 32 ++++++++++++++++++++++++++++++++ src/utils.mjs | 31 +++++++++++++++++++++++++------ 2 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 src/resetButton.mjs diff --git a/src/resetButton.mjs b/src/resetButton.mjs new file mode 100644 index 0000000..f87a629 --- /dev/null +++ b/src/resetButton.mjs @@ -0,0 +1,32 @@ +import { engine } from "./engine.mjs"; +import { createButton, areColliding } from "./utils.mjs"; +import { ballBody } from "./ball.mjs"; +import { firingTheBall } from "./firingTheBall.mjs"; +import { menuConfig } from "./menu.mjs"; + +function resetBallPosition() { + ballBody.position.set(11, 30, 0); + ballBody.velocity.set(0, 0, 0); + ballBody.angularVelocity.set(0, 0, 0); + ballBody.type = CANNON.Body.STATIC; + firingTheBall.isBallShot = false; +} + +function createResetButton() { + engine.draw2d = () => { + engine.context2d.clearRect(0, 0, engine.canvas2d.width, engine.canvas2d.height); + if (menuConfig.gameStarted) { + createButton("Reset", 50, 50, 100, 50, "blue", 20, "white"); + } + }; + + engine.onmouseup = (e) => { + let mouseX = e.clientX; + let mouseY = e.clientY; + if (menuConfig.gameStarted && areColliding(mouseX, mouseY, 1, 1, 50, 50, 100, 50)) { + resetBallPosition(); + } + }; +} + +export { createResetButton }; diff --git a/src/utils.mjs b/src/utils.mjs index 66a3658..761cfe9 100644 --- a/src/utils.mjs +++ b/src/utils.mjs @@ -18,15 +18,34 @@ function drawImage(myImageObject, x, y, xs, ys) { } function isFunction(f) { - return typeof f == "function"; + return typeof (f) == "function"; } -function createButton(text, x, y, w, h, buttonCol, fontsize, textCol, font = "Arial") { +function drawText(text, x, y, fontsize = 16, textCol = "black", font = "Arial") { + const ctx = engine.context2d; + ctx.fillStyle = textCol; + ctx.font = `${fontsize}px ${font}`; + ctx.textAlign = "left"; + ctx.textBaseline = "top"; + ctx.fillText(text, x, y); +} + +function createButton(text, x, y, w, h, buttonCol, fontsize, textCol, borderRadius = 10, font = "Arial") { const ctx = engine.context2d; - // Create background ctx.fillStyle = buttonCol; - ctx.fillRect(x, y, w, h); - // Create text + ctx.beginPath(); + ctx.moveTo(x + borderRadius, y); + ctx.lineTo(x + w - borderRadius, y); + ctx.quadraticCurveTo(x + w, y, x + w, y + borderRadius); + ctx.lineTo(x + w, y + h - borderRadius); + ctx.quadraticCurveTo(x + w, y + h, x + w - borderRadius, y + h); + ctx.lineTo(x + borderRadius, y + h); + ctx.quadraticCurveTo(x, y + h, x, y + h - borderRadius); + ctx.lineTo(x, y + borderRadius); + ctx.quadraticCurveTo(x, y, x + borderRadius, y); + ctx.closePath(); + ctx.fill(); + ctx.fillStyle = textCol; ctx.font = `${fontsize}px ${font}`; ctx.textAlign = "center"; @@ -34,4 +53,4 @@ function createButton(text, x, y, w, h, buttonCol, fontsize, textCol, font = "Ar ctx.fillText(text, x + w / 2, y + h / 2); } -export { areColliding, randomInteger, drawLine, drawImage, isFunction, createButton }; +export { areColliding, randomInteger, drawLine, drawImage, isFunction, createButton, drawText }; From 942a79d0b9037c7c400c84d512aad22312ffe947 Mon Sep 17 00:00:00 2001 From: DPH888 <109276020+DPH888@users.noreply.github.com> Date: Sun, 16 Jun 2024 09:41:10 +0300 Subject: [PATCH 7/8] refactoring --- package-lock.json | 230 +- package.json | 1 + .../LiminalTextureLib/Flag_of_Bulgaria.png | Bin 0 -> 1580 bytes public/images/LiminalTextureLib/Pine.jpg | Bin 0 -> 18877 bytes public/images/add_circle.svg | 1 + public/index_bundle.js | 2417 +++++++++++++++++ public/index_bundle.js.LICENSE.txt | 14 + src/BuildingBlock_no_collision/flag.mjs | 25 + src/BuildingBlock_no_collision/pine.mjs | 3 +- src/BuildingBlocks/BuildingBlock.mjs | 2 +- src/BuildingBlocks/Cylinder.mjs | 1 - src/BuildingBlocks/GolfHole.mjs | 28 +- src/BuildingBlocks/Iceblock.mjs | 27 + src/BuildingBlocks/MovingPlatform.mjs | 5 +- src/BuildingBlocks/Particle.mjs | 4 +- src/BuildingBlocks/Ramp.mjs | 125 +- src/LevelEditor/ObjectAdd.mjs | 143 + src/Sounds.mjs | 1 + src/Terrain/Hills.mjs | 24 +- src/asset_loading/asset_config.mjs | 78 +- src/asset_loading/asset_loader2d.mjs | 170 +- src/asset_loading/asset_loader_sounds.mjs | 42 +- src/asset_loading/assets_3d.mjs | 88 +- src/ball.mjs | 10 +- src/firingTheBall.mjs | 2 + src/game.mjs | 408 +-- src/init.js | 4 +- src/menu.mjs | 41 +- src/utils.mjs | 19 +- 29 files changed, 3466 insertions(+), 447 deletions(-) create mode 100644 public/images/LiminalTextureLib/Flag_of_Bulgaria.png create mode 100644 public/images/LiminalTextureLib/Pine.jpg create mode 100644 public/images/add_circle.svg create mode 100644 public/index_bundle.js create mode 100644 public/index_bundle.js.LICENSE.txt create mode 100644 src/BuildingBlock_no_collision/flag.mjs create mode 100644 src/BuildingBlocks/Iceblock.mjs create mode 100644 src/LevelEditor/ObjectAdd.mjs diff --git a/package-lock.json b/package-lock.json index e4a121c..6adc9d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@supabase/supabase-js": "^2.43.2", "cannon-es": "^0.20.0", "express": "^4.18.2", "lodash": "^4.17.21", @@ -88,6 +89,73 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@supabase/auth-js": { + "version": "2.64.2", + "resolved": "https://registry.npmjs.org/@supabase/auth-js/-/auth-js-2.64.2.tgz", + "integrity": "sha512-s+lkHEdGiczDrzXJ1YWt2y3bxRi+qIUnXcgkpLSrId7yjBeaXBFygNjTaoZLG02KNcYwbuZ9qkEIqmj2hF7svw==", + "dependencies": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "node_modules/@supabase/functions-js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@supabase/functions-js/-/functions-js-2.3.1.tgz", + "integrity": "sha512-QyzNle/rVzlOi4BbVqxLSH828VdGY1RElqGFAj+XeVypj6+PVtMlD21G8SDnsPQDtlqqTtoGRgdMlQZih5hTuw==", + "dependencies": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "node_modules/@supabase/node-fetch": { + "version": "2.6.15", + "resolved": "https://registry.npmjs.org/@supabase/node-fetch/-/node-fetch-2.6.15.tgz", + "integrity": "sha512-1ibVeYUacxWYi9i0cf5efil6adJ9WRyZBLivgjs+AUpewx1F3xPi7gLgaASI2SmIQxPoCEjAsLAzKPgMJVgOUQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/@supabase/postgrest-js": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.15.2.tgz", + "integrity": "sha512-9/7pUmXExvGuEK1yZhVYXPZnLEkDTwxgMQHXLrN5BwPZZm4iUCL1YEyep/Z2lIZah8d8M433mVAUEGsihUj5KQ==", + "dependencies": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "node_modules/@supabase/realtime-js": { + "version": "2.9.5", + "resolved": "https://registry.npmjs.org/@supabase/realtime-js/-/realtime-js-2.9.5.tgz", + "integrity": "sha512-TEHlGwNGGmKPdeMtca1lFTYCedrhTAv3nZVoSjrKQ+wkMmaERuCe57zkC5KSWFzLYkb5FVHW8Hrr+PX1DDwplQ==", + "dependencies": { + "@supabase/node-fetch": "^2.6.14", + "@types/phoenix": "^1.5.4", + "@types/ws": "^8.5.10", + "ws": "^8.14.2" + } + }, + "node_modules/@supabase/storage-js": { + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/@supabase/storage-js/-/storage-js-2.5.5.tgz", + "integrity": "sha512-OpLoDRjFwClwc2cjTJZG8XviTiQH4Ik8sCiMK5v7et0MDu2QlXjCAW3ljxJB5+z/KazdMOTnySi+hysxWUPu3w==", + "dependencies": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "node_modules/@supabase/supabase-js": { + "version": "2.43.2", + "resolved": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.43.2.tgz", + "integrity": "sha512-F9CljeJBo5aPucNhrLoMnpEHi5yqNZ0vH0/CL4mGy+/Ggr7FUrYErVJisa1NptViqyhs1HGNzzwjOYG6626h8g==", + "dependencies": { + "@supabase/auth-js": "2.64.2", + "@supabase/functions-js": "2.3.1", + "@supabase/node-fetch": "2.6.15", + "@supabase/postgrest-js": "1.15.2", + "@supabase/realtime-js": "2.9.5", + "@supabase/storage-js": "2.5.5" + } + }, "node_modules/@types/eslint": { "version": "8.44.2", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.2.tgz", @@ -124,11 +192,23 @@ "version": "20.11.28", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.28.tgz", "integrity": "sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==", - "dev": true, "dependencies": { "undici-types": "~5.26.4" } }, + "node_modules/@types/phoenix": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/@types/phoenix/-/phoenix-1.6.4.tgz", + "integrity": "sha512-B34A7uot1Cv0XtaHRYDATltAdKx0BvVKNgYNqE4WjtPUa4VQJM7kxeXcVKaH+KS+kCmZ+6w+QaUdcljiheiBJA==" + }, + "node_modules/@types/ws": { + "version": "8.5.10", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz", + "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", @@ -1770,6 +1850,11 @@ "node": ">=0.6" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -1785,8 +1870,7 @@ "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "node_modules/unpipe": { "version": "1.0.0", @@ -1864,6 +1948,11 @@ "node": ">=10.13.0" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, "node_modules/webpack": { "version": "5.90.3", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.3.tgz", @@ -1987,6 +2076,15 @@ "node": ">=10.13.0" } }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -2007,6 +2105,26 @@ "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", "dev": true + }, + "node_modules/ws": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", + "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } } }, "dependencies": { @@ -2065,6 +2183,70 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "@supabase/auth-js": { + "version": "2.64.2", + "resolved": "https://registry.npmjs.org/@supabase/auth-js/-/auth-js-2.64.2.tgz", + "integrity": "sha512-s+lkHEdGiczDrzXJ1YWt2y3bxRi+qIUnXcgkpLSrId7yjBeaXBFygNjTaoZLG02KNcYwbuZ9qkEIqmj2hF7svw==", + "requires": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "@supabase/functions-js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@supabase/functions-js/-/functions-js-2.3.1.tgz", + "integrity": "sha512-QyzNle/rVzlOi4BbVqxLSH828VdGY1RElqGFAj+XeVypj6+PVtMlD21G8SDnsPQDtlqqTtoGRgdMlQZih5hTuw==", + "requires": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "@supabase/node-fetch": { + "version": "2.6.15", + "resolved": "https://registry.npmjs.org/@supabase/node-fetch/-/node-fetch-2.6.15.tgz", + "integrity": "sha512-1ibVeYUacxWYi9i0cf5efil6adJ9WRyZBLivgjs+AUpewx1F3xPi7gLgaASI2SmIQxPoCEjAsLAzKPgMJVgOUQ==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, + "@supabase/postgrest-js": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.15.2.tgz", + "integrity": "sha512-9/7pUmXExvGuEK1yZhVYXPZnLEkDTwxgMQHXLrN5BwPZZm4iUCL1YEyep/Z2lIZah8d8M433mVAUEGsihUj5KQ==", + "requires": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "@supabase/realtime-js": { + "version": "2.9.5", + "resolved": "https://registry.npmjs.org/@supabase/realtime-js/-/realtime-js-2.9.5.tgz", + "integrity": "sha512-TEHlGwNGGmKPdeMtca1lFTYCedrhTAv3nZVoSjrKQ+wkMmaERuCe57zkC5KSWFzLYkb5FVHW8Hrr+PX1DDwplQ==", + "requires": { + "@supabase/node-fetch": "^2.6.14", + "@types/phoenix": "^1.5.4", + "@types/ws": "^8.5.10", + "ws": "^8.14.2" + } + }, + "@supabase/storage-js": { + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/@supabase/storage-js/-/storage-js-2.5.5.tgz", + "integrity": "sha512-OpLoDRjFwClwc2cjTJZG8XviTiQH4Ik8sCiMK5v7et0MDu2QlXjCAW3ljxJB5+z/KazdMOTnySi+hysxWUPu3w==", + "requires": { + "@supabase/node-fetch": "^2.6.14" + } + }, + "@supabase/supabase-js": { + "version": "2.43.2", + "resolved": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.43.2.tgz", + "integrity": "sha512-F9CljeJBo5aPucNhrLoMnpEHi5yqNZ0vH0/CL4mGy+/Ggr7FUrYErVJisa1NptViqyhs1HGNzzwjOYG6626h8g==", + "requires": { + "@supabase/auth-js": "2.64.2", + "@supabase/functions-js": "2.3.1", + "@supabase/node-fetch": "2.6.15", + "@supabase/postgrest-js": "1.15.2", + "@supabase/realtime-js": "2.9.5", + "@supabase/storage-js": "2.5.5" + } + }, "@types/eslint": { "version": "8.44.2", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.2.tgz", @@ -2101,11 +2283,23 @@ "version": "20.11.28", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.28.tgz", "integrity": "sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==", - "dev": true, "requires": { "undici-types": "~5.26.4" } }, + "@types/phoenix": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/@types/phoenix/-/phoenix-1.6.4.tgz", + "integrity": "sha512-B34A7uot1Cv0XtaHRYDATltAdKx0BvVKNgYNqE4WjtPUa4VQJM7kxeXcVKaH+KS+kCmZ+6w+QaUdcljiheiBJA==" + }, + "@types/ws": { + "version": "8.5.10", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz", + "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", + "requires": { + "@types/node": "*" + } + }, "@webassemblyjs/ast": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", @@ -3318,6 +3512,11 @@ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -3330,8 +3529,7 @@ "undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "unpipe": { "version": "1.0.0", @@ -3377,6 +3575,11 @@ "graceful-fs": "^4.1.2" } }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, "webpack": { "version": "5.90.3", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.3.tgz", @@ -3454,6 +3657,15 @@ "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", "dev": true }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -3468,6 +3680,12 @@ "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", "dev": true + }, + "ws": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", + "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", + "requires": {} } } } diff --git a/package.json b/package.json index 8fa6541..cd5863c 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "webpack-cli": "^5.1.4" }, "dependencies": { + "@supabase/supabase-js": "^2.43.2", "cannon-es": "^0.20.0", "express": "^4.18.2", "lodash": "^4.17.21", diff --git a/public/images/LiminalTextureLib/Flag_of_Bulgaria.png b/public/images/LiminalTextureLib/Flag_of_Bulgaria.png new file mode 100644 index 0000000000000000000000000000000000000000..e5a4ede5c18bbc0980ff9dabae0d7521e58e23ea GIT binary patch literal 1580 zcmeAS@N?(olHy`uVBq!ia0y~yV86h?z_Njf87Okk%TgCev7|ftIx;Y9?C1WI$O_~u zBzpw;GB8xBF)%c=FfjZA3N^f7U???UV0e|lz+g3lfkC`r&aOZkpaf@tPl)UP|Nj}L zp1!W^FBrwer38xRX-#HeU{&yRaSW-r_4Xno zBhYqc1J$Whg824@Mu-BH4{dOu&{yW=rHOqdOO$0_dbnF5GnZltffRb9s)FgAj@68b zdKkt+H6YsrGXrSysHKA}ct7jbb|}Z9Bn)_T?ZTF9fU@W*iL59ewRETi@4U#Za}&au zze^tn7KW-Nt`Q|Ei6yC4$wjF^iowXh$VAt`P}j&f#K_pn$jr*nOxwV~%D~`GJL^3Z d4Y~O#nQ4`{HLSh0HwjeSdb;|#taD0e0syPcLyiCd literal 0 HcmV?d00001 diff --git a/public/images/LiminalTextureLib/Pine.jpg b/public/images/LiminalTextureLib/Pine.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b95c4063dae6fe5728d3a6479ef0aa9a5c20cf7c GIT binary patch literal 18877 zcmY&j!So=lysN0a1o>%q(PbsC?G8&-O?o>(jAf_^3%s> zo_YUx&;GF|X3jagv$H#MK4<@~{M`hIG*pqQ00;yCpnn7Sy9T@ha4@k*NlC~_Nl7Uv z$SJ9qXs9WvsF`SJsOg#L8L1c<7-(1+I9V8J*l1}Om<3tbxcK?`_~;phCBzZpoCrQ1 z5H2n*0X_jO5fLqdjfowBK=APMBZLI_1rU7y1O$Trp9aCh^MBm`^8d^IQwsf?{t5hl zdjVo>U<=rSfLH)9F$h8o`a1~F0st5S`rlOlA3-s|5KI7s_0On61b{&hFcb=bVqrqC zA^+9`CWeqO1A1*&lw*TOvwEnPngP=P1fA z|GA+C0snu9e{LX90OOxYh!_BafqxOPpb+4n|9|v+zs~?VZ$SD$Zf7JB*@-w?(fH9u4D(#g; z!;Acj$y1IUHZ8Cdd{n^6gK{uPbfK;yO%cp@pUXu~yZ-pB@2K`(H>MUpIul{LXCt-p zPV1oYy9ecVp`xhfM82-pSO=MGUqN6&)h39*2}`fAw*J#!pghAaP$S^0(bcC~d%~jb zR(K$<#TFJ8HNCMpy& z4COo>&Bnu&Fc|Ej9;r=rxmy|;xW_frs*AvZTkYaH#aja#2E*w z1kJ)2+^}f@nYKF#cJblv$Ez@9-YrN_EyEfZa4rgwyw?P4d z&|RDL4`;N;NOclS5ZsTNXH{4H=G4ExQZ%M<9Y##*=)j-Q{N`MO%bLNdTM{YKlqh8Z0Ox6eBD zse3XNx);q;K_UomnHsSmkmLb(@5YmGn-T2DoRB7;nH9w^muw4` z=c$U&*hDb)Aw(=|DI>{<^&}u24uv9PunIbl_n@-EmZkVYf#*i{w=Lxd<$#kNLBmc* zmmk6>2xU;7jVb>rPCT6CgrsfsK)N>bH=EW1N7@g9Z0b8evLF z@F9(wMjJA=k~?dg9A^vbCgdpNcxHGoRk7+jfY4>~-Q zVuTdH3Rmr-Uo97w-w(EX6=|f9>&*5Eobu2uH0P|#y{hU&G!sjuY3V-xt$g6);~vFij4ijdG>{u^;)jG`9Vc*+OB6uW=gNZSJh z9wQ@8&XtOrV6I028EPjGvqkPiqFObjo8rlw2ye82rUM?hfg#zezAMlws zgQ|!iL`lag->x7OEb@ATJJ(CYZ(!NAmLHk`RRmp1;-P!U%kB~D_`Mf1&easTF+4_2 zHf1F_+Cyfo<@J05(2J8_A3X`$-}s`lSj=*WSR(=kU*xj3MeU%;{A=&~cuk>cOIFeh z=E0zovW&f zgj3!yZY0&b-#)!+Bj-U)?9F2f*%lfQpNh=*d2V0yj7UByO&$L7Jl|mfX7iSL)Hco3 z?n&gZ6DfLxRA)`0!-HHJncb~SECI#7EkZs@73Q-41rnhjb+!+|^Gi5b-LAz#wJhA2 zezeV4azjkh7veoFbN(s877J`azeosk4lv0?ReSfk3rV4Npv=y`m3!7wTfbR8CN4Td z$`x#GDsYH0!LOpQuGVsYcGcch`@evZlXlQkNlNBQOQ{z0bc%AjT!M@gN$>Tty zR@Lj|ZK4L1dX~Iw&Kjfk9-Q=bhHF-uX#xp~#)bUn)Ht$wb+F0*HgiAL|4z0ZxL>qL z6uT(JT;mWQUpJs#j|TBj1+!unApsy zuZh7nA${y2nTYRJ-O>}K<48oZL4%l%1^4M-Y)v0{^*w~o9gout5W`E3=kE{Veqym< z;5zVA(fA#L}{dl6_ zxOhvbTS@eht=4xmZ-YpkI$MvepBpUzB_~o=7PJA^K!hvQhHJUVNiv^~zt?Mmws}@H zq*w$Nz3s{D?pgQWyGwq(cQXqY_bXE5qi})Io zi|CV(sD^BMviI7rbUANljcPv@pkisEOi3Ooe}SQL?ynw$i%|anSa{V@{4LEIuX2lg zR+?9i9QI$}i|);`3;$8e@Ag0M|E!)l-C4cgO?f6?l^+?0fKZK1HnF<&?$JY?8XgG~ zg(MC5Sel8DeXWBLp0y>5*1>%yEybTKS>Wj#^0}vkotmZ$ zF*XGuB`Q%yGb23U^85ST$04?vTM3$U)iUfF92f_$UN$_Uu|?vXI(0lC`-dmuaDixW z<@oOLZO%4Y2RV_Bw-MszbU>4;I?PO#VxY40g;hKC1Xxs#{@&wjx7i^p_Gcs!IcIAm zVPU0Vv}^8@hR10qoc4+WR5}P2#}q|f3hIL>nH5ki=wDH+7&fiP(m5nf^OpJR>Q!I% z)+VuSzVmQ3rHJ8$IQ=l581>_tydp!F_^`N$_GOxNGLmG)g8Ll?oGw`2(Pn|{CgN7#+(}>ls)3vOsC=Kp6 zCR8B%tZX$n9Of1tAkAW*!cb_<&CX&iel%WPT}$3WU9kH*^TJc)1C(muQ_~{WceFJtiN;{DXm|1H<{YPfzVL ztmou(4g7Kct*kfQ>#I{lrMHY+&mHJ)%wFfmErKswT(dh$pSO8FHDJ;rav{Canu+ zY;yrvw)PFi*qGhKY5?UnkAuGl+7A7Pgp66;(O2VpWFnlk+Z~MMa>7IF@*?$Ky)oF0 z>>7ZjOHI3!GQeM zT|1HgX2C1&Lu0HRTV6t}n;MU2h?*JEw!u7%If`3V%2WEA5bKQFd@GYx5j@H$5$-sqaBdlzGDM`-RD@%Ma+lZTU0*9C;h6t^ zMU%}CDBe0emY0_UVMJs4telj;CTqb%LTFx1)TBh_A?Dpje=d%9wyffisDf`Nr?gV4 zAC8Tw!&-QvJyZv&1pOJyzWp9B(f7CMMf7eXtK{iRg<5pOO@-9=*A)C~HPTS!%*WWk z@8)S2l)Y4p#_(^tCjIUxC}FlrBT^!h__MZVJYw&Q>K-J^kOT0S88W|8Qydixg;{L^(7pq4~E!%sd0tyxI< zW`-l%bfsNIoYaF4gkCQ4_y)G|a99!srbf5&^< z(To(OrivB9ZDJbnrG4^AS5JiAx_q{@a^qBP>x-1wkc#y}YF5d9y9(hV5 zwy;N5T=+nc8IrbLNUgrllx;T50Zgtd6Fv)C3=@u=XH!=2*bPWu0)13vDObx`1VzQz zst0C9KgQ3;{FaGQ>I}`vc6<)3Poc25jxm%y?Ge%nQU`GvRZArjwnIh1Gpr0vYtsqafxUYWv$S7>nZ$7(W2k9e;ax@J- z(L!OXbV#&=;->v3T7I(iB>V-mEF2uEwnnEMS+Dm5@BM|9aDw>OOYt*+y$wFSe#*+P zldc9Sj=W*3P1RV&-=cZAsVSdqDSxRE@3;+24bCtV$9!)_93)ok+#!=08%o6|1p?@& z{6F^xS-66t3~LbhabrL>R`{6h?Q9rF+^nI+_z~scu@7X~j%Bxa0F6PjNy>owO zV&ObGM6#oi>P@e$^%&j3u}c+^9VElT{nW(bKo=^E%E*O8~77 zr>Fu*iT zs}tJgX7;!f5zKzHz-mnCT6|4olv~&N42OS82$TWDrRX;f{{^O17Pg0^vv{m*`~cx) zxc{0IUoU!mkdw&x1*k%Vlc8gnMW<3X#?)X?6s_KBXSIqQ-AMhtO2GelT-PaiT^qhJ zEZAkriJw@DeoP;be{^sdbWM<<>3xwwI3Ur3ooa(*l=t6g<*2GT2S=-CS5QKue5M}D z_NE+2*Ry+g^l-JtHA&4E>;TRdRXGz5B#zh-#`ukVe@$y)$)}o+_`i^Wf~Vl9<51VG zLW4P9+&yJ3T4fx@!KPcOf17i#O9X9L8@>5CeNcLy=JWlR+BN*dim9R@R`8SNJpnC~jq z9cnT}Py)Bi8;=Mp>}HX{`kfgL^K?ZY;IwdXQg*Mg+xi}t>{rrPjNgK?k;7sc0ffXA zWb{Mm306!`S9jf-7RGR@wj!J-@xWie+3+tw_7b%0ntDdKp!@S?Ils;L>wlktJKd&G zW(A|-Y|8M?rHa(8#lxI6XFLdRAVl(p>G8vYnzrfieW+0|K1mJoVidl%>Yy7uZyBlZ zGwcfhnX;r320ZTN89pArXmu6inZ@Oq>j9_y8V)JkC-V&7dHUm;1&foFVVuJ05XpEu zkM|WM3LYNpUBQ-TwX--7oE3cr+1m1~8urX+_?l(?t1ujPw0_j~;1hR~Oy@y6DFc?n zIhQS^8vF~G$w8G!)lrvh;-(DIwX&bOa%V4o*0ji@aBS2QgEha&x}@P0pPbN?V5prR z3xmAPxe4{ffe-=Qk#)i<7dv{|ghoa}Un)zyCgU3Iq~0;bW$g6UZ<{}tHWo!Zja$C* zH9&i-!CQGO{jWcjYjhA08TrUdbPfpRVmzIZG*gE*A(r>pL$e3;@O1O{RLk}4B@W2G zBG)Z&Yy?Rky1pcfimp_CSKRykJLe+XQF9G_tW$z}w% z*bocSyzDhL)G6b6<=qlv(${Lk#j9&c{(0lLXQ7jT3mvH|O&3{Nfqucim&N-6enT~X zZ)sRLtv`b zo5xiJ9o>%7@+HyT2A%?j>bd;Ar^i@^ZFs0Bx-*olg-I3=G8^3V7{}ZVNG9K!VJm$| zQ*56tU{ZVja8yiZT2Nwu#^wI%w-|aBDsK*gaDmm~7VvMZ@aXiSr}|sAX2Reyct-Wx z)9Mzro}^NP4B7$iqC`pP15iN$xeK{?%jM(xGaJ=`r%QLL!_g4!_aypVw#K&#!tg_V zpNca#ECUu6O41xS)ynT}Z+jE(FtS!-C`6Ji_NRiRFm;YJ>;**GdxH*{BTkz6dxnMZ z?Vk|2SJnF5!a`5?gX#JkBjxQP^qGDW%!p3C2YAK3?jV2k$5JW_)ira*epq8go% zEUza$1Me`yMJ5t{{79nMzuFvtX=o3yhDn%Vv5PSMSR(494)sm^gk+0n*cYuPgquWZ zL%0bB!&y&=+t40ojIFX*W{)50TnTL9cTB2K1%}I1ZPLv!{sPmyY{wS{YbkNi7TABH zPTZy|;n@XpgxeX}BDgr{F*a;NuhZFT?DAVQ_037mpHz!h&3q&zjZ_kDNCg2X@>W#y zxPKf+$F@|K9mvb0kDrhl%;H+5QRK=AO?tcyGDcW*MAmS%vOiCcYkzaANvm*3SSxk8 zCz{vNd5GO$&PcLZueg~Q@2`iYc$23~cz{kq0($^v8fA`v1%-v}at-Ax5Zy`nJG`jTt+ zgb3RIZFRomP*#L31U#p}qyx7gSd*Xn3!KoTzNWBD544%Qdcs6uLy#!=>t=S%XsjV@ z(*B^qnA~azFylNQCVgPs4M5gd2QRJR*0c*qZbnh}_a$9DxFY+%kkge?_9vI}=50J- z3Oze|dqT_$iQ(m&?t{ZJJI3M-&jncv7rJXq_o;)#b6U*mGCef2F>hAXZSrC(POf%5 zV_8xdW5p2)Cd6Y^?Yf9#ay$r0aBj#*Pt0b=&~sN&Wx=@4r13MD_lrFnHN6O)R#W;x z0e$T+v-ai64%8?qa<-9$yM^$=!jkt#Q$kJJhay||lian9OvdVovlRvL#Y>~-j;cGz z;mf2&nf9bOVWQncOM3j?ltDqM$$LAl3YErN>dq!_1J86;crV4ynrl*l+ zGY%HxAbQg*CH~{z$0V<;YIIu2RG^(?3~H4^-opbfa>*6iog@l(sU*vkHKzq%ERq{Z zK~6s!N{NJ!h4dI(@AuntO*1rezvmPsI&*Nqr@k)Axr8ATq8Tg)F`ycTOxuTT`|GP5 zp4(inF{|D@^*cHgUOc8Wj2Fr8A5ttyogjCKMz!;gxL_K;@pjb73a{FRDAVY8-q$YI zTtXT+*fJb8LBu`jdbK7FB!Hz2Sl%i(eth?0p~!q7-P^z<1d}C~p}mE3B)G^e1=HNo ztMGhSqYdZBG`{N~sYa#F9&sF_`r0zh?7i1(1V%`ThC(Xe>QGZ>BiRLzq4rtzDdE;r zYeA#$+HHW5nhBNAlf%ULlGlRl{)CLfMlvm)e3lp7!d6glaD0Igc2PXsi^+|FUAnN) z?&e^W+{@sCq7Gy!vhGZrsd9|{^H#Ap3%Aq*T z^HPPm-uHa#D2ETpwBY6u-Nt8!IhbDM`o~zxLD-73ip=^i5W$V41xyOA8Hdi^Qf6>> z6@GIkG>vt&b4RP2W9D|`coidMW;uSgCD&a(BPSaT<@?O6h0^5K$dh2s+Qg4rQ@VeX zumGNj$*tBN$f-40B>R#}?Pi?lFMEKj{c+3R9IQ-1NkSGnJ+uejw% zF?;AyqoT(odB}>PqH&~Nwu1s0J1Zly=jh{Cf7t zLUTHPGtU!3O}i^aVOCMC`>Z}Xw}fre6Y;lr5-9#&Chi&_FOCV;TNn~BuVF{VJE8=G z)_J?>pwCaem#_yX%Esrjj61l@>sk@CQlu4M-w^cOjvgn`~0 z`xugUa6jHZb! zE}^BFg!vy_(XJ4z_CCsFel}vr!M|%C%x{7bRb;%YmlrQ@j{F9H8#PblC?fZ@E3Ltg z%(xmG)RHEsKY1{jtC>P#A%vN8Dauee1-zCyG9-1*oYdK(4Id?~4Kk1T)%V{8|_%$jDusAV`1fba)yEb$GO-Lg73MZuyT@8wp;rfi^xoQ7Zmm~T?C<#b|De;&V+GSW*}oiQEWw17f&>mDxb>=_MkJ?W~Z6x z#&aPP6XG~=3tKIWmxxHPe5oM$*9|xGD zLJ@X&Yk3q7W8YFuy}P988(j*s*z`U?9OfGH^Tap2kcN^Eptx_~A9um}AQ=nVcw7Kdayr725`K+7GUm1n_y|^>vO(fA>=ZOv z5$ocqC{th_VtRoIJ+G<%Sag-QmI`__Vvo^!{Bk(HFcHp{#g~h{Bu7hFw8ENW#gYuk zv9UYZk}VP^&Ev&-i>4CG6^gTk2NLx@ja`FsS|{TWnC zg#8O!9evdaA#tIXcOR*Yp$5j>@iMb}3EVo{TORY@R@?(JBB=K}t_yDw`BUr(a#<+l zWr8WmL^f7DjtJi>HHFNcnjN0?(x-2^B1^IDhJ48uoneDs07!aQJAzR)&$2GqPC?A@ zjaY_Nel~%)94;&utP{N*)K>Gst?c{WJpP%VAR{j}?Rmc=huMPlvS-*3GD~lVq*@YY zZYu=(5Mj)eVV;C{2def}M`vSKO%4K6p*V0F*B4axafeK&{?h|obIRN-GX?}&A865% zldEN;cl19#C)b+V!e}^pfv)64C+=Ln7&{X zM-A;oT?YXZ$UK6(HJGEUMlICnmaQLotnl#O#?B^ArnV)seU-(cU1SR(C6G40gbr#4`JzWT(o)EE7Q~wJfgn#tFR`*ECu{Y*Q zmHz^yy`Xx#kBYYTT2t6P*hs{ zBS3Tqjy4oufRAj5syt5c0p~C;i6YU`y2_PPR6%Qtn9l zvD6sV0VbUR>2w+`$^EA`oF}#6(SHH*ftSDK=ARx_-x<7&EgAfN@^0oXeGhYM`tXAI zy$)K0XnedgcXS_4B;dep&-AUeBB4VEfdL-0Q2X{iga3J6x^^xGK2~0D`jU3Fdbfzx z8zX2Wpp3E!a8o^tBT+M)H@tizR*q_es#rZ8t!%mo3`LZNBY7J|$4j0*Ha$&2Ju);< z)@K>xnq}iCPM%JCZ13CPh%r+Ecz271y0Oy1&kHjWJ@nz)stIulk3zeUxq*}Vk=RSc zWPLqsOcV9o4!pRHVCq+H&w4NYSBnCJ7@V?R)xuFOX&&Eyx3m7{-_Rj5IyE0vuB+cU9W#uT`%z1reJ3Mq!r-j0647CLg*{-5M{6_{dmBm%x;*EsC^ zVAb8*(Ei1%WHp#KIXC?jnS@8PyvrSaj{@TvC9zh+E=GvbHWXD6Pc)Hj$W-n(FGTh= zt{CDP!smA<)jFdxKvc1cEg?8h%v)_Q41bZT9crD`6eJfA@X2xB`!VMGL|bXMX>L6Z zJf8YND};{GhhDW@`*FxGju(%hQq}VDRmkrXzm%LY%P;O9BC9+|5O@;O(}wi>@Zb2B z=D93u;|ilBK5e$@)6N^vZP25(v`InkzE$Ii-2OkPNWIYc`)L})P{lG?)Gt?`*^G(p52+myZQ+dLfEY1+c(+ zzdI7S6*IE>Hj7qkmFNqATV~) zrbR4!BgpZmhBnpZN4zcP)*GQ^>wO|&mx6lhww!Ewp92geKWq}AXHMRUw8QL8?HAin zjGOz8VQPv`xFOtFRIFdoS2uIO_DT0k^ z0o*Xj8vUJdL*DxJ3hwyeK~!Dg4bA&O8L?VLVv9txxr)TZ%I9UqxekeRB1siI5HiJIzRy*0uT(mUp2ttCg2XB%3-(FBx~>X%sAg_3-Hva|4)7`;!Rg z5)s%dO3sv03Uh|Nm&Grn9J0Q=NfVEP?K2$tiGLLkl7r z;i#9PGe^3N+ZEsTdhxHB^6o-GETMvboGh*-=i+K51sI985#05}o6&k)G4S5Di+;eE zJ%k}rsRZN4U0_K4sQiITh>a64Ey5c`f$|1s<(wY568*>>q2KnwYrJh5jesDofNw5o z)gR^|+T=lv{xaxb`bSL)CMV1}r$%9zm4A0S_jhIDflIRP$_9_i>D{~#RXFO=nh$8gTF1bNThFgp==b9Q>!>8l{_jI zxBNhpyoNkvJ8YB))3RXJ;i%;Gk0}PtZ{GW4X8=;>))n*5Nft&GtT1lwFFHGaUFDz-dE*(|nAr8qMpBRe)eqDsUBTU227A&@gQcq9PaUzG=cBZ6 zpMN|0^)`91m(1(A$beHoMPKB(-*Mt^XQK)XQEm@Wsx*)5xF!%QI9pVJ?3OeGXJ*}r z@~1l;Z5=rR)4T{g_%k+0_SVIA+^`C9qBisSF*^1y0Qw8Oc{pjkdUnR~sAm1{F95v% zQ1aG8YO-$9PtXoHI~2kuB}FuXv9y)q!-Pr@k!HJtBu+LIj#BSEx-{Msm<*cpldOS! zrWBY+pxDAq!?k3=Hk`Pa8hfEg&v$+;e=NSi+8y|ASv5Yelf`A=X0vbFLx@xrevZyQ zGIML>+(%jYSw^z2e3wocbi`hi;fEqR9+P{JW*{3RSed^H`(|;GCvr2+VTFPs>I7?x zgwO!fZ&{l^AeHkDw|v{~!D^48l1z;qF#U(4*W(dOQV10-o$cZ)rEYSY;K{Jou@LWF z(>!;)=z7=O2wQDv6odnq?+3VYEH!9&nT_T`db1qU!UlH*_2^;+Dy!hr*nZ8UsI%jAYYT?TJ_bR-jiAkpWkP~zizqaC7p=?g!bfdj;Wy#qWyDT!_@HM5~eOOx#;t9aH%6>gg12BkM%fQv=bUl11iPEL`S^5j`nc2KtHvyb>jA2fqCdUtJdV!2u0izJOw&p#0!ATM(HWP+ia zJBs7P2^#Z?F{OR5p~g}OO89TQL5~ZoGL$8brD$0xU$ z9oEb5eyee6tXNObAnkCJN<3s((|9<9B>4y5hnDN=M7G2y2f{6jdP={nv!Xny5{x}4 z`Ezf^Nc642&0b%i=b`j0J3;(xwYBc+Fm#+veWG1Fcs)ryLuY`-#R%~}K!A=JghJKV z>!{8LPJYs&qMo@8O8aB2FbPVtu_`Tvs%^v2YUkat<1fC zD}r8%jL+C~)153LT}8A-T7Dg3T(M*$ocm*M*kU&)Nqm6h?SSXm9#NJEDrLbQKV@F zaYI^gQ0S<5x%lGBXSM(3QlC=}k1D7p&Q-_228BNWlbgD^%)zVjR+y|Ni@#LI?75rI zD~;n?borSf-=Y@DIwZwe`3f1U%sowyI4G-Qu_I7G<+}tneL)b}qfP zO)90?uG+ge50`-yXS5WL!S~aUzrYsbmw@wEzo#!>7JoFY*EzZPB`tm4vsL*uxn-*& zO%unEI%n87)FJtj=5uVQjd6`821N{UbWs^Z>}S!d5XC=CHBaq^UhlQL0L48cvhk;r z>-EFqHdccJ;#+!+2-3(Zc6iD+Bt(PxAkLu*e`vJDW&+f>0m7ocQ6n_XYCv+2kdg>9 z6#oY&)aI**%#VrG(~qMK_yeTHNY@ui04iXe^3RG{0;Z-;isEeg$(SIgr{>`bqF#xY{?>I+b zlg-fhN2Txeiy9Z}$tO~jqnN<9TGJ{F%sW}>o@PZVZ(_HeQZ*T7P)$VY&o&9COB|+L3HTmx(?n?0TSJu z57&X5ZExa&HAW}&UFKtzgDE@rKlMek;zM;51e-`o5*M(kRWZ=V1KYMfE;l($46_R^ z?Zi6inr7|U0?$8pyL4F12RQM!ig4G#bJkB7weka~adV~119An6n~o%wCSlF(R*%vA z`pXH6_#Un(gE^C|Nip*3g&4+LDJ9j!MQ>tpJxXawaM^g#rVGmFP%9u6Fp6B+gq01p!FSp+e=$f z_Kz{DGD|me9|8(nHfDR3E1Wm{V88X}$@08o6$V=dm!XNsCXRBigeY@fJ~C<*?|aKr zvXmH<(t@f!BOb|i3+eg-Y+M&k8!OxG+0pp=4pcS& z*5XxPJ5VZ2=YHvOHvO{|w~iFLv85R~I9OVL?TN)y9IbwQ-=OYeB`vB78>&=@<^MeC zkc1rxP%WGM$kej-!)O$PX>B#lL>JGV`g4%?8CC5HBHFall(A2mpdrZ?L<67sIq`T1 zs)t^4W2>71n*KzR3X(~hS~%wc)jw#CaSU1p$6{)f1il|Il4Yo`j6LjjC<=r%>N-*h zCrM?WB;6(*pR?tmQO60dv(f|w6XUx$mR%l~ytViQMXijXHo!GkH2YG^#+nuGvd1NhyJ3t+NrJ&5NFsFXZa@BsS5Q%7rm$atNeHjmd5bvj3|#1{{-{X{kr%wLyK8 zhn<#zhnz6hF35xy1rs?hpKW*JW9QTGl&T-=c2XMkAEUPGO!>My?6E;t3m))yw4E-~ zLBo08WJmR_Kke{>1LpuwpdZQN$%`3yg3f3aNVlpSyef~@568LMO|6}~+5T6VbJe$X z{UDQVoQe0-olJRH*%fKMRCqC+yX+?auk*3nf~hl`TN=z2TOEW)%JdGgSQsE^6ZFQ&h(!0zkpT3n~|Hx;g8yh!xV$x;FcWF|)B zSVw%S58Qs)_ASdYlp&Y3tG;CPFCZ)WqYASm>jSgOpiPEuf1|BS9BOcaQJzwbB*g4$ zg*3U0pJG~>v{0p#>Z0?O!zdweY6lqIm~RqX**yA86?r`gGDGPMUgcr^i1JtSP_Q;z z5XVyzc$$F&2OB{aE@i72C8gR)2uH22j`Qn=Uay@ z>sZEn^_rY!&`1jG!fOSIXb8Q3a|!Oa8wQg&TQ16PALop_@tdTY2jg~_@uP}jN#K=Y zMj(P<`uqbP!)u=!ZT4fCwJXHazHYU6GJkRk*G#<}_XL{{9&*wU=#4(a@4fSnO=64c z-UIA1ZPlcY3u(L;?l`^C97Z1-YS0iOCA``<9fK5o`_7T9xKai2i+@Ci^%dOy)mbT9 z$&rIVL%O^}7JzI9O8Doz{p{jEnfYR!Kij({)U)^62>?YVAEqKMp zaDAjVGS2x!0WsWO!N@ixY^;gmG7|2{hy)#xgq}=vRUi{?B8kR zj$jgKu2k(%8>M0Ov{_5JT=!@YNVUY&T#4NJYW3|S2^BV{88$nXssV#6%zrVvsFcPI zKe9HDSM~6}FBOqGKg#!{>MtD>stvdS5Yu?K9W0(i5L4}4MPbN7hRMo0DE97<)`gb1 z&~^3GuPfqx1>{Z&s%TRvw$(3^b?K|5trtZFo39dz{oLJPlig;}<>>Ezow%Q47`hxoB%=kV? zFen4OZwLBstLf=%M;y=Vij;~P^}=2ta78B^=0&~!Ysk?Y4ePFh>Q+LU*a7I#X`^Y+Mm5=1FW)7kLNyX}-%-k-Dh&16CM1rlf=gTKld9 zNm2sDSgiJCGCuj4@#7@aNR;VYMO7GtbV1=Rhu71Ed54x}v0A_TW3jeH3R`I`h^+SF z!{p|}wg}d%S=BO$kkbE-KXE4w;~I6k8c+s`lEqIsI2mlYMI$lxP+ZUC&7Z2DB&C+l zdwnQVL@4dkr1hc0jIQWaUv_IGy~-1ZPeObo*Tze#uiwuI&d$ChB3m+nTZ|bO`tM&Q z?u)|+f72M=jr20tL~brH7mf9oUh^2E&yM&?BgVdKcO)*|^1zLa)FiXqa+??vh_r5{ zXwUe`+@unbhPd*5=;Z<~UAz8mEcKf_8#`@nzk-x+tT+dsy?*{WX?=M}XL_&n7vT7Z z3WZYd9NkiK->~lZj}$6CifpQ{5R-t8z1VeoS{R?_6c|u)vS|;}Atu-IBq7^;YMgue zJ{|9NejR-j{F*N<0`Z~GlGRk3Z%h0wlq@nUZ|C7)81KVumV0l2H`W`UbO8UhHGjx> zqwthp6+>^3uv<@jFLHSF(R;Ia&dC`h4%D#WVf~7f5K!lstsq`G{MX@B#Z6S3VB28e zjdW(qj|jxPB9LeCYYclv{zcmecso{-E7(H(tBw(Qv+!d*|Cx{FOtMr??59TgmY5vN z0b-s7VAAIV{Zf^^qLZD>3Ujb`@PJ;7-4V0)`in*>NXQXU7?ng2c|&_v7AC_gEt=iH zj$e^sGl4Ccn-f0>Izbzzyw&BtWyHMa^c=tqZrwqLyax5t? z&%qR%4mW3h!6BGC|CFRG(;%r?hCinw?L(|_aXSpMAscY9+NH8~^V*p60&h|6jryp! zDqB&Cl){2QrD64#$TG(cjbCJuX$q9IDy3-=bfYEDZkAh@Tu2#dUwk!In7-tEY}H)! zRmBveu;}?1&w3~tR6a^pkSHw3&{1;KZsq1-_#w}foSkcv#$EX*PT}IBr(Soa$YkKx6SodA64)Yg&)OgE2zXT-g#Ch(OQBNo?ag;HJ2XHEFBY+{{3S zJgy4&=lytLQGarmixa7G-pZ#B*nO!%0=5emazv-91tN~MvGXF)34weQZ1KQCoql{u ze=p{5mfhbwN~V`WPjLeE{%mPo1qocv~ zM}a@`>Y(tSaVcGV1+UX+6d(DveZ3JXSRPG6cH%{{&kuRD$$aF`ZC^U9Mxej%uD*}1 zj@azD*EvaV5nvCGOZv}$|MhFmw0Cs16DaJWq}^2+v4@{Ut)}FPX7Mi^rzK@WR(<7y z#!f|Dy&bZ6apcJGBi9KPoS$vaydFHQMQF$*MiRlNK)px8*CMwk#23Na8uQq}Z?>RL zGlW(dSb7c)_9}Xt<~=vm%{zc6M^*?RpYp>lK*_+XTSeez%;pKn015V*r)^8$;O-mF zPXxM_vg8qWZw)6*a-W~#j6GJ~Tn`ZD=`?VotWB;esA`zagyOSnwHwACO=XfD))I3} z?$zPMj5umZ^LkB5s}skT-DB~i3jqRSX+GsQQAR<99wA$jta`|3JXznrH+ zblZhxUNc?{GqW?KmFuZh%2v@U|7>a1<_%`9h|O3D>2qZI65-AK!>yz-dM~&%#Vzkc zdWRj@M!S5%oYIz%)cZXw?AL8&Uuq6~VU=t|FT=5={&nuI(OWm7U!i+ZHqH2V*9iFUqo$n;^cpmJ-#7Px%t~s!!{K7;fluV_1Vk<3|{cu-EECnivl)TOiXN6OSI11fnVaRFJq3fS8(%NUkzGh{oQ3y*9UoF&=Hz6R8lnzbWM0OoMe zTd*db#GT-P0P4Exzh+7cY&^uxHAksUqxQm(W2iIw+G)f$mV%H#qz$POr37xy)g_zO z2=zM2i;bPqVzro4Rrp}Vk!>Of3wdTS(Cr<`7@dxl)8bjlK3R}JKsli8HkbsAK){%t zX#8IE3NTQqEc-L;0-!K%&&Jzti2#CW3P>dKxO#+-kyI*xJxP&0!S^9GTU!@Mi>cCD zV3I>PB1u0R5kB^bIUPaouS=@5xe`p=CP;?34^H4OPeHEYRSK&)BH{5`ZIbL@kZ=XD zpHBKRx;-?SG~S?{(vO({TeH7e@FO5UY>XA<>k%^^|7<&Y`}0@)Q^ zn2ue@1L?Mu@f8ZPwU!vi-Yr5;W-E-GZIRonPByYYZX@)HL<}|6ML*(2Yfqz72TJ&k zFjnp*A}OOBZ#jwXC9qTNr#?^UGg<;7s?@05zX=wyEl4vF2e(7iAAMWeWDJ4oU?1nLFN3nBIfLdvHD4#o z1OT+vzZ(;l+$z3yBDm0X-<<9Ts81D0u`L4W48({5gsPH?SjoR5+GAb7qy{ znTX%i&e5%ol(suS-Ws|Jb5d+#yr78$Oz$A`ZZYtzXI}9XmFiHfFnqoXJSr}c)Fl+0RhR95#>uv%QB#z94t)D_X5$Ecm+~ooyfqG6kmt) zf&H3{%0qO3N4A}KpM|<8E5k39v8Pd9kWzmI*M)iNtVf~NJviDyhun9f1yV0zC`UK}zw^22#TqmwbuQb-Cd6HQATW3H7{;ta?F z43#P{vkX0cIU-}Gyx_Qpq3$ZW&Cq$kSoi|mq7`8w>qhwHXbF-5QI`@ogCE=bgYlT$`X_=;g-9L_4 z&GlRhZ#fEBC^Uqkd+=0>;)^N+i$`5~2oRZjY;@%@ln%?nJ zpfPA53yT>5nb@h$L9+uIOT>7cGO~QfRYgmcVbnp8absp>cFz5T;yga_P46Sj0I`d{ z1f~Qm<(i>#Hpm?T(y#2oOj4-#0!XUCf`kSlR?(@7X>z<80WFGo;YeXxP*&X@`C0SH+d@w^yh-C+0%5pL~gQIvc<*lu?q+&oM2wQ+B zo22yw=qIaC5LTJ;+8PLq^fQcuJ8$(m9czoFn=%XwiC&NZ0uOBZX_T#Qc2?DgFA~N~ zn8>i45WovSK7nJ@4}Ez4C`buVkW^vHno^J}%*w@32*0WH~GFN&w_f3C0p0J?AZYySW>J$AcO#p&|>is5tYFXI0I z?NvYGAM2oeOZ&s@f6ra6)$sOT1EcS-`d{8Ru>Sy*YtD=Af6HC2)K@-(%X4S;U*Y;| zxL=I^&-tBpyIyp^+|K%mJageb`cq5$x?1gawcz`!;yU+5b$36sf2h%XSI0}+{KmUo zt*hQcli_|Z%laJ-y+3H{wc2=l%n{sg;Cr9=EvIk)0BK*@t^WWcYqi?L;=TU>ll=vj z=<=`qlArt&{{YWSe#3k;zvHj|*w<^dng0Omm&f;G$KF8RKk>i(8lU^Esw!_&_x}L* z4!qZB$DqILciRu{NBih?p71~K=>Gu4Kl1Cf+OLQI0Ox-&Lty6r0Jl~Bll=yhC&WKw zYqi?G2keH#>G1u{Cjy8{Zn3RwKeZ^x+1sdV`;9}YqjNyfB)I$ ClPos? literal 0 HcmV?d00001 diff --git a/public/images/add_circle.svg b/public/images/add_circle.svg new file mode 100644 index 0000000..d33d691 --- /dev/null +++ b/public/images/add_circle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/index_bundle.js b/public/index_bundle.js new file mode 100644 index 0000000..0faa8c3 --- /dev/null +++ b/public/index_bundle.js @@ -0,0 +1,2417 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./node_modules/cannon-es/dist/cannon-es.js": +/*!**************************************************!*\ + !*** ./node_modules/cannon-es/dist/cannon-es.js ***! + \**************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AABB: () => (/* binding */ AABB),\n/* harmony export */ ArrayCollisionMatrix: () => (/* binding */ ArrayCollisionMatrix),\n/* harmony export */ BODY_SLEEP_STATES: () => (/* binding */ BODY_SLEEP_STATES),\n/* harmony export */ BODY_TYPES: () => (/* binding */ BODY_TYPES),\n/* harmony export */ Body: () => (/* binding */ Body),\n/* harmony export */ Box: () => (/* binding */ Box),\n/* harmony export */ Broadphase: () => (/* binding */ Broadphase),\n/* harmony export */ COLLISION_TYPES: () => (/* binding */ COLLISION_TYPES),\n/* harmony export */ ConeTwistConstraint: () => (/* binding */ ConeTwistConstraint),\n/* harmony export */ Constraint: () => (/* binding */ Constraint),\n/* harmony export */ ContactEquation: () => (/* binding */ ContactEquation),\n/* harmony export */ ContactMaterial: () => (/* binding */ ContactMaterial),\n/* harmony export */ ConvexPolyhedron: () => (/* binding */ ConvexPolyhedron),\n/* harmony export */ Cylinder: () => (/* binding */ Cylinder),\n/* harmony export */ DistanceConstraint: () => (/* binding */ DistanceConstraint),\n/* harmony export */ Equation: () => (/* binding */ Equation),\n/* harmony export */ EventTarget: () => (/* binding */ EventTarget),\n/* harmony export */ FrictionEquation: () => (/* binding */ FrictionEquation),\n/* harmony export */ GSSolver: () => (/* binding */ GSSolver),\n/* harmony export */ GridBroadphase: () => (/* binding */ GridBroadphase),\n/* harmony export */ Heightfield: () => (/* binding */ Heightfield),\n/* harmony export */ HingeConstraint: () => (/* binding */ HingeConstraint),\n/* harmony export */ JacobianElement: () => (/* binding */ JacobianElement),\n/* harmony export */ LockConstraint: () => (/* binding */ LockConstraint),\n/* harmony export */ Mat3: () => (/* binding */ Mat3),\n/* harmony export */ Material: () => (/* binding */ Material),\n/* harmony export */ NaiveBroadphase: () => (/* binding */ NaiveBroadphase),\n/* harmony export */ Narrowphase: () => (/* binding */ Narrowphase),\n/* harmony export */ ObjectCollisionMatrix: () => (/* binding */ ObjectCollisionMatrix),\n/* harmony export */ Particle: () => (/* binding */ Particle),\n/* harmony export */ Plane: () => (/* binding */ Plane),\n/* harmony export */ PointToPointConstraint: () => (/* binding */ PointToPointConstraint),\n/* harmony export */ Pool: () => (/* binding */ Pool),\n/* harmony export */ Quaternion: () => (/* binding */ Quaternion),\n/* harmony export */ RAY_MODES: () => (/* binding */ RAY_MODES),\n/* harmony export */ Ray: () => (/* binding */ Ray),\n/* harmony export */ RaycastResult: () => (/* binding */ RaycastResult),\n/* harmony export */ RaycastVehicle: () => (/* binding */ RaycastVehicle),\n/* harmony export */ RigidVehicle: () => (/* binding */ RigidVehicle),\n/* harmony export */ RotationalEquation: () => (/* binding */ RotationalEquation),\n/* harmony export */ RotationalMotorEquation: () => (/* binding */ RotationalMotorEquation),\n/* harmony export */ SAPBroadphase: () => (/* binding */ SAPBroadphase),\n/* harmony export */ SHAPE_TYPES: () => (/* binding */ SHAPE_TYPES),\n/* harmony export */ SPHSystem: () => (/* binding */ SPHSystem),\n/* harmony export */ Shape: () => (/* binding */ Shape),\n/* harmony export */ Solver: () => (/* binding */ Solver),\n/* harmony export */ Sphere: () => (/* binding */ Sphere),\n/* harmony export */ SplitSolver: () => (/* binding */ SplitSolver),\n/* harmony export */ Spring: () => (/* binding */ Spring),\n/* harmony export */ Transform: () => (/* binding */ Transform),\n/* harmony export */ Trimesh: () => (/* binding */ Trimesh),\n/* harmony export */ Vec3: () => (/* binding */ Vec3),\n/* harmony export */ Vec3Pool: () => (/* binding */ Vec3Pool),\n/* harmony export */ WheelInfo: () => (/* binding */ WheelInfo),\n/* harmony export */ World: () => (/* binding */ World)\n/* harmony export */ });\n/**\n * Records what objects are colliding with each other\n */\nclass ObjectCollisionMatrix {\n /**\n * The matrix storage.\n */\n\n /**\n * @todo Remove useless constructor\n */\n constructor() {\n this.matrix = {};\n }\n /**\n * get\n */\n\n\n get(bi, bj) {\n let {\n id: i\n } = bi;\n let {\n id: j\n } = bj;\n\n if (j > i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n return `${i}-${j}` in this.matrix;\n }\n /**\n * set\n */\n\n\n set(bi, bj, value) {\n let {\n id: i\n } = bi;\n let {\n id: j\n } = bj;\n\n if (j > i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n if (value) {\n this.matrix[`${i}-${j}`] = true;\n } else {\n delete this.matrix[`${i}-${j}`];\n }\n }\n /**\n * Empty the matrix\n */\n\n\n reset() {\n this.matrix = {};\n }\n /**\n * Set max number of objects\n */\n\n\n setNumObjects(n) {}\n\n}\n\n/**\n * A 3x3 matrix.\n * Authored by {@link http://github.com/schteppe/ schteppe}\n */\nclass Mat3 {\n /**\n * A vector of length 9, containing all matrix elements.\n */\n\n /**\n * @param elements A vector of length 9, containing all matrix elements.\n */\n constructor(elements) {\n if (elements === void 0) {\n elements = [0, 0, 0, 0, 0, 0, 0, 0, 0];\n }\n\n this.elements = elements;\n }\n /**\n * Sets the matrix to identity\n * @todo Should perhaps be renamed to `setIdentity()` to be more clear.\n * @todo Create another function that immediately creates an identity matrix eg. `eye()`\n */\n\n\n identity() {\n const e = this.elements;\n e[0] = 1;\n e[1] = 0;\n e[2] = 0;\n e[3] = 0;\n e[4] = 1;\n e[5] = 0;\n e[6] = 0;\n e[7] = 0;\n e[8] = 1;\n }\n /**\n * Set all elements to zero\n */\n\n\n setZero() {\n const e = this.elements;\n e[0] = 0;\n e[1] = 0;\n e[2] = 0;\n e[3] = 0;\n e[4] = 0;\n e[5] = 0;\n e[6] = 0;\n e[7] = 0;\n e[8] = 0;\n }\n /**\n * Sets the matrix diagonal elements from a Vec3\n */\n\n\n setTrace(vector) {\n const e = this.elements;\n e[0] = vector.x;\n e[4] = vector.y;\n e[8] = vector.z;\n }\n /**\n * Gets the matrix diagonal elements\n */\n\n\n getTrace(target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const e = this.elements;\n target.x = e[0];\n target.y = e[4];\n target.z = e[8];\n return target;\n }\n /**\n * Matrix-Vector multiplication\n * @param v The vector to multiply with\n * @param target Optional, target to save the result in.\n */\n\n\n vmult(v, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const e = this.elements;\n const x = v.x;\n const y = v.y;\n const z = v.z;\n target.x = e[0] * x + e[1] * y + e[2] * z;\n target.y = e[3] * x + e[4] * y + e[5] * z;\n target.z = e[6] * x + e[7] * y + e[8] * z;\n return target;\n }\n /**\n * Matrix-scalar multiplication\n */\n\n\n smult(s) {\n for (let i = 0; i < this.elements.length; i++) {\n this.elements[i] *= s;\n }\n }\n /**\n * Matrix multiplication\n * @param matrix Matrix to multiply with from left side.\n */\n\n\n mmult(matrix, target) {\n if (target === void 0) {\n target = new Mat3();\n }\n\n const A = this.elements;\n const B = matrix.elements;\n const T = target.elements;\n const a11 = A[0],\n a12 = A[1],\n a13 = A[2],\n a21 = A[3],\n a22 = A[4],\n a23 = A[5],\n a31 = A[6],\n a32 = A[7],\n a33 = A[8];\n const b11 = B[0],\n b12 = B[1],\n b13 = B[2],\n b21 = B[3],\n b22 = B[4],\n b23 = B[5],\n b31 = B[6],\n b32 = B[7],\n b33 = B[8];\n T[0] = a11 * b11 + a12 * b21 + a13 * b31;\n T[1] = a11 * b12 + a12 * b22 + a13 * b32;\n T[2] = a11 * b13 + a12 * b23 + a13 * b33;\n T[3] = a21 * b11 + a22 * b21 + a23 * b31;\n T[4] = a21 * b12 + a22 * b22 + a23 * b32;\n T[5] = a21 * b13 + a22 * b23 + a23 * b33;\n T[6] = a31 * b11 + a32 * b21 + a33 * b31;\n T[7] = a31 * b12 + a32 * b22 + a33 * b32;\n T[8] = a31 * b13 + a32 * b23 + a33 * b33;\n return target;\n }\n /**\n * Scale each column of the matrix\n */\n\n\n scale(vector, target) {\n if (target === void 0) {\n target = new Mat3();\n }\n\n const e = this.elements;\n const t = target.elements;\n\n for (let i = 0; i !== 3; i++) {\n t[3 * i + 0] = vector.x * e[3 * i + 0];\n t[3 * i + 1] = vector.y * e[3 * i + 1];\n t[3 * i + 2] = vector.z * e[3 * i + 2];\n }\n\n return target;\n }\n /**\n * Solve Ax=b\n * @param b The right hand side\n * @param target Optional. Target vector to save in.\n * @return The solution x\n * @todo should reuse arrays\n */\n\n\n solve(b, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n // Construct equations\n const nr = 3; // num rows\n\n const nc = 4; // num cols\n\n const eqns = [];\n let i;\n let j;\n\n for (i = 0; i < nr * nc; i++) {\n eqns.push(0);\n }\n\n for (i = 0; i < 3; i++) {\n for (j = 0; j < 3; j++) {\n eqns[i + nc * j] = this.elements[i + 3 * j];\n }\n }\n\n eqns[3 + 4 * 0] = b.x;\n eqns[3 + 4 * 1] = b.y;\n eqns[3 + 4 * 2] = b.z; // Compute right upper triangular version of the matrix - Gauss elimination\n\n let n = 3;\n const k = n;\n let np;\n const kp = 4; // num rows\n\n let p;\n\n do {\n i = k - n;\n\n if (eqns[i + nc * i] === 0) {\n // the pivot is null, swap lines\n for (j = i + 1; j < k; j++) {\n if (eqns[i + nc * j] !== 0) {\n np = kp;\n\n do {\n // do ligne( i ) = ligne( i ) + ligne( k )\n p = kp - np;\n eqns[p + nc * i] += eqns[p + nc * j];\n } while (--np);\n\n break;\n }\n }\n }\n\n if (eqns[i + nc * i] !== 0) {\n for (j = i + 1; j < k; j++) {\n const multiplier = eqns[i + nc * j] / eqns[i + nc * i];\n np = kp;\n\n do {\n // do ligne( k ) = ligne( k ) - multiplier * ligne( i )\n p = kp - np;\n eqns[p + nc * j] = p <= i ? 0 : eqns[p + nc * j] - eqns[p + nc * i] * multiplier;\n } while (--np);\n }\n }\n } while (--n); // Get the solution\n\n\n target.z = eqns[2 * nc + 3] / eqns[2 * nc + 2];\n target.y = (eqns[1 * nc + 3] - eqns[1 * nc + 2] * target.z) / eqns[1 * nc + 1];\n target.x = (eqns[0 * nc + 3] - eqns[0 * nc + 2] * target.z - eqns[0 * nc + 1] * target.y) / eqns[0 * nc + 0];\n\n if (isNaN(target.x) || isNaN(target.y) || isNaN(target.z) || target.x === Infinity || target.y === Infinity || target.z === Infinity) {\n throw `Could not solve equation! Got x=[${target.toString()}], b=[${b.toString()}], A=[${this.toString()}]`;\n }\n\n return target;\n }\n /**\n * Get an element in the matrix by index. Index starts at 0, not 1!!!\n * @param value If provided, the matrix element will be set to this value.\n */\n\n\n e(row, column, value) {\n if (value === undefined) {\n return this.elements[column + 3 * row];\n } else {\n // Set value\n this.elements[column + 3 * row] = value;\n }\n }\n /**\n * Copy another matrix into this matrix object.\n */\n\n\n copy(matrix) {\n for (let i = 0; i < matrix.elements.length; i++) {\n this.elements[i] = matrix.elements[i];\n }\n\n return this;\n }\n /**\n * Returns a string representation of the matrix.\n */\n\n\n toString() {\n let r = '';\n const sep = ',';\n\n for (let i = 0; i < 9; i++) {\n r += this.elements[i] + sep;\n }\n\n return r;\n }\n /**\n * reverse the matrix\n * @param target Target matrix to save in.\n * @return The solution x\n */\n\n\n reverse(target) {\n if (target === void 0) {\n target = new Mat3();\n }\n\n // Construct equations\n const nr = 3; // num rows\n\n const nc = 6; // num cols\n\n const eqns = reverse_eqns;\n let i;\n let j;\n\n for (i = 0; i < 3; i++) {\n for (j = 0; j < 3; j++) {\n eqns[i + nc * j] = this.elements[i + 3 * j];\n }\n }\n\n eqns[3 + 6 * 0] = 1;\n eqns[3 + 6 * 1] = 0;\n eqns[3 + 6 * 2] = 0;\n eqns[4 + 6 * 0] = 0;\n eqns[4 + 6 * 1] = 1;\n eqns[4 + 6 * 2] = 0;\n eqns[5 + 6 * 0] = 0;\n eqns[5 + 6 * 1] = 0;\n eqns[5 + 6 * 2] = 1; // Compute right upper triangular version of the matrix - Gauss elimination\n\n let n = 3;\n const k = n;\n let np;\n const kp = nc; // num rows\n\n let p;\n\n do {\n i = k - n;\n\n if (eqns[i + nc * i] === 0) {\n // the pivot is null, swap lines\n for (j = i + 1; j < k; j++) {\n if (eqns[i + nc * j] !== 0) {\n np = kp;\n\n do {\n // do line( i ) = line( i ) + line( k )\n p = kp - np;\n eqns[p + nc * i] += eqns[p + nc * j];\n } while (--np);\n\n break;\n }\n }\n }\n\n if (eqns[i + nc * i] !== 0) {\n for (j = i + 1; j < k; j++) {\n const multiplier = eqns[i + nc * j] / eqns[i + nc * i];\n np = kp;\n\n do {\n // do line( k ) = line( k ) - multiplier * line( i )\n p = kp - np;\n eqns[p + nc * j] = p <= i ? 0 : eqns[p + nc * j] - eqns[p + nc * i] * multiplier;\n } while (--np);\n }\n }\n } while (--n); // eliminate the upper left triangle of the matrix\n\n\n i = 2;\n\n do {\n j = i - 1;\n\n do {\n const multiplier = eqns[i + nc * j] / eqns[i + nc * i];\n np = nc;\n\n do {\n p = nc - np;\n eqns[p + nc * j] = eqns[p + nc * j] - eqns[p + nc * i] * multiplier;\n } while (--np);\n } while (j--);\n } while (--i); // operations on the diagonal\n\n\n i = 2;\n\n do {\n const multiplier = 1 / eqns[i + nc * i];\n np = nc;\n\n do {\n p = nc - np;\n eqns[p + nc * i] = eqns[p + nc * i] * multiplier;\n } while (--np);\n } while (i--);\n\n i = 2;\n\n do {\n j = 2;\n\n do {\n p = eqns[nr + j + nc * i];\n\n if (isNaN(p) || p === Infinity) {\n throw `Could not reverse! A=[${this.toString()}]`;\n }\n\n target.e(i, j, p);\n } while (j--);\n } while (i--);\n\n return target;\n }\n /**\n * Set the matrix from a quaterion\n */\n\n\n setRotationFromQuaternion(q) {\n const x = q.x;\n const y = q.y;\n const z = q.z;\n const w = q.w;\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n const e = this.elements;\n e[3 * 0 + 0] = 1 - (yy + zz);\n e[3 * 0 + 1] = xy - wz;\n e[3 * 0 + 2] = xz + wy;\n e[3 * 1 + 0] = xy + wz;\n e[3 * 1 + 1] = 1 - (xx + zz);\n e[3 * 1 + 2] = yz - wx;\n e[3 * 2 + 0] = xz - wy;\n e[3 * 2 + 1] = yz + wx;\n e[3 * 2 + 2] = 1 - (xx + yy);\n return this;\n }\n /**\n * Transpose the matrix\n * @param target Optional. Where to store the result.\n * @return The target Mat3, or a new Mat3 if target was omitted.\n */\n\n\n transpose(target) {\n if (target === void 0) {\n target = new Mat3();\n }\n\n const M = this.elements;\n const T = target.elements;\n let tmp; //Set diagonals\n\n T[0] = M[0];\n T[4] = M[4];\n T[8] = M[8];\n tmp = M[1];\n T[1] = M[3];\n T[3] = tmp;\n tmp = M[2];\n T[2] = M[6];\n T[6] = tmp;\n tmp = M[5];\n T[5] = M[7];\n T[7] = tmp;\n return target;\n }\n\n}\nconst reverse_eqns = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n\n/**\n * 3-dimensional vector\n * @example\n * const v = new Vec3(1, 2, 3)\n * console.log('x=' + v.x) // x=1\n */\n\nclass Vec3 {\n constructor(x, y, z) {\n if (x === void 0) {\n x = 0.0;\n }\n\n if (y === void 0) {\n y = 0.0;\n }\n\n if (z === void 0) {\n z = 0.0;\n }\n\n this.x = x;\n this.y = y;\n this.z = z;\n }\n /**\n * Vector cross product\n * @param target Optional target to save in.\n */\n\n\n cross(vector, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const vx = vector.x;\n const vy = vector.y;\n const vz = vector.z;\n const x = this.x;\n const y = this.y;\n const z = this.z;\n target.x = y * vz - z * vy;\n target.y = z * vx - x * vz;\n target.z = x * vy - y * vx;\n return target;\n }\n /**\n * Set the vectors' 3 elements\n */\n\n\n set(x, y, z) {\n this.x = x;\n this.y = y;\n this.z = z;\n return this;\n }\n /**\n * Set all components of the vector to zero.\n */\n\n\n setZero() {\n this.x = this.y = this.z = 0;\n }\n /**\n * Vector addition\n */\n\n\n vadd(vector, target) {\n if (target) {\n target.x = vector.x + this.x;\n target.y = vector.y + this.y;\n target.z = vector.z + this.z;\n } else {\n return new Vec3(this.x + vector.x, this.y + vector.y, this.z + vector.z);\n }\n }\n /**\n * Vector subtraction\n * @param target Optional target to save in.\n */\n\n\n vsub(vector, target) {\n if (target) {\n target.x = this.x - vector.x;\n target.y = this.y - vector.y;\n target.z = this.z - vector.z;\n } else {\n return new Vec3(this.x - vector.x, this.y - vector.y, this.z - vector.z);\n }\n }\n /**\n * Get the cross product matrix a_cross from a vector, such that a x b = a_cross * b = c\n *\n * See {@link https://www8.cs.umu.se/kurser/TDBD24/VT06/lectures/Lecture6.pdf Umeå University Lecture}\n */\n\n\n crossmat() {\n return new Mat3([0, -this.z, this.y, this.z, 0, -this.x, -this.y, this.x, 0]);\n }\n /**\n * Normalize the vector. Note that this changes the values in the vector.\n * @return Returns the norm of the vector\n */\n\n\n normalize() {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const n = Math.sqrt(x * x + y * y + z * z);\n\n if (n > 0.0) {\n const invN = 1 / n;\n this.x *= invN;\n this.y *= invN;\n this.z *= invN;\n } else {\n // Make something up\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }\n\n return n;\n }\n /**\n * Get the version of this vector that is of length 1.\n * @param target Optional target to save in\n * @return Returns the unit vector\n */\n\n\n unit(target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const x = this.x;\n const y = this.y;\n const z = this.z;\n let ninv = Math.sqrt(x * x + y * y + z * z);\n\n if (ninv > 0.0) {\n ninv = 1.0 / ninv;\n target.x = x * ninv;\n target.y = y * ninv;\n target.z = z * ninv;\n } else {\n target.x = 1;\n target.y = 0;\n target.z = 0;\n }\n\n return target;\n }\n /**\n * Get the length of the vector\n */\n\n\n length() {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n return Math.sqrt(x * x + y * y + z * z);\n }\n /**\n * Get the squared length of the vector.\n */\n\n\n lengthSquared() {\n return this.dot(this);\n }\n /**\n * Get distance from this point to another point\n */\n\n\n distanceTo(p) {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const px = p.x;\n const py = p.y;\n const pz = p.z;\n return Math.sqrt((px - x) * (px - x) + (py - y) * (py - y) + (pz - z) * (pz - z));\n }\n /**\n * Get squared distance from this point to another point\n */\n\n\n distanceSquared(p) {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const px = p.x;\n const py = p.y;\n const pz = p.z;\n return (px - x) * (px - x) + (py - y) * (py - y) + (pz - z) * (pz - z);\n }\n /**\n * Multiply all the components of the vector with a scalar.\n * @param target The vector to save the result in.\n */\n\n\n scale(scalar, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const x = this.x;\n const y = this.y;\n const z = this.z;\n target.x = scalar * x;\n target.y = scalar * y;\n target.z = scalar * z;\n return target;\n }\n /**\n * Multiply the vector with an other vector, component-wise.\n * @param target The vector to save the result in.\n */\n\n\n vmul(vector, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n target.x = vector.x * this.x;\n target.y = vector.y * this.y;\n target.z = vector.z * this.z;\n return target;\n }\n /**\n * Scale a vector and add it to this vector. Save the result in \"target\". (target = this + vector * scalar)\n * @param target The vector to save the result in.\n */\n\n\n addScaledVector(scalar, vector, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n target.x = this.x + scalar * vector.x;\n target.y = this.y + scalar * vector.y;\n target.z = this.z + scalar * vector.z;\n return target;\n }\n /**\n * Calculate dot product\n * @param vector\n */\n\n\n dot(vector) {\n return this.x * vector.x + this.y * vector.y + this.z * vector.z;\n }\n\n isZero() {\n return this.x === 0 && this.y === 0 && this.z === 0;\n }\n /**\n * Make the vector point in the opposite direction.\n * @param target Optional target to save in\n */\n\n\n negate(target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n target.x = -this.x;\n target.y = -this.y;\n target.z = -this.z;\n return target;\n }\n /**\n * Compute two artificial tangents to the vector\n * @param t1 Vector object to save the first tangent in\n * @param t2 Vector object to save the second tangent in\n */\n\n\n tangents(t1, t2) {\n const norm = this.length();\n\n if (norm > 0.0) {\n const n = Vec3_tangents_n;\n const inorm = 1 / norm;\n n.set(this.x * inorm, this.y * inorm, this.z * inorm);\n const randVec = Vec3_tangents_randVec;\n\n if (Math.abs(n.x) < 0.9) {\n randVec.set(1, 0, 0);\n n.cross(randVec, t1);\n } else {\n randVec.set(0, 1, 0);\n n.cross(randVec, t1);\n }\n\n n.cross(t1, t2);\n } else {\n // The normal length is zero, make something up\n t1.set(1, 0, 0);\n t2.set(0, 1, 0);\n }\n }\n /**\n * Converts to a more readable format\n */\n\n\n toString() {\n return `${this.x},${this.y},${this.z}`;\n }\n /**\n * Converts to an array\n */\n\n\n toArray() {\n return [this.x, this.y, this.z];\n }\n /**\n * Copies value of source to this vector.\n */\n\n\n copy(vector) {\n this.x = vector.x;\n this.y = vector.y;\n this.z = vector.z;\n return this;\n }\n /**\n * Do a linear interpolation between two vectors\n * @param t A number between 0 and 1. 0 will make this function return u, and 1 will make it return v. Numbers in between will generate a vector in between them.\n */\n\n\n lerp(vector, t, target) {\n const x = this.x;\n const y = this.y;\n const z = this.z;\n target.x = x + (vector.x - x) * t;\n target.y = y + (vector.y - y) * t;\n target.z = z + (vector.z - z) * t;\n }\n /**\n * Check if a vector equals is almost equal to another one.\n */\n\n\n almostEquals(vector, precision) {\n if (precision === void 0) {\n precision = 1e-6;\n }\n\n if (Math.abs(this.x - vector.x) > precision || Math.abs(this.y - vector.y) > precision || Math.abs(this.z - vector.z) > precision) {\n return false;\n }\n\n return true;\n }\n /**\n * Check if a vector is almost zero\n */\n\n\n almostZero(precision) {\n if (precision === void 0) {\n precision = 1e-6;\n }\n\n if (Math.abs(this.x) > precision || Math.abs(this.y) > precision || Math.abs(this.z) > precision) {\n return false;\n }\n\n return true;\n }\n /**\n * Check if the vector is anti-parallel to another vector.\n * @param precision Set to zero for exact comparisons\n */\n\n\n isAntiparallelTo(vector, precision) {\n this.negate(antip_neg);\n return antip_neg.almostEquals(vector, precision);\n }\n /**\n * Clone the vector\n */\n\n\n clone() {\n return new Vec3(this.x, this.y, this.z);\n }\n\n}\nVec3.ZERO = new Vec3(0, 0, 0);\nVec3.UNIT_X = new Vec3(1, 0, 0);\nVec3.UNIT_Y = new Vec3(0, 1, 0);\nVec3.UNIT_Z = new Vec3(0, 0, 1);\nconst Vec3_tangents_n = new Vec3();\nconst Vec3_tangents_randVec = new Vec3();\nconst antip_neg = new Vec3();\n\n/**\n * Axis aligned bounding box class.\n */\nclass AABB {\n /**\n * The lower bound of the bounding box\n */\n\n /**\n * The upper bound of the bounding box\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.lowerBound = new Vec3();\n this.upperBound = new Vec3();\n\n if (options.lowerBound) {\n this.lowerBound.copy(options.lowerBound);\n }\n\n if (options.upperBound) {\n this.upperBound.copy(options.upperBound);\n }\n }\n /**\n * Set the AABB bounds from a set of points.\n * @param points An array of Vec3's.\n * @return The self object\n */\n\n\n setFromPoints(points, position, quaternion, skinSize) {\n const l = this.lowerBound;\n const u = this.upperBound;\n const q = quaternion; // Set to the first point\n\n l.copy(points[0]);\n\n if (q) {\n q.vmult(l, l);\n }\n\n u.copy(l);\n\n for (let i = 1; i < points.length; i++) {\n let p = points[i];\n\n if (q) {\n q.vmult(p, tmp$1);\n p = tmp$1;\n }\n\n if (p.x > u.x) {\n u.x = p.x;\n }\n\n if (p.x < l.x) {\n l.x = p.x;\n }\n\n if (p.y > u.y) {\n u.y = p.y;\n }\n\n if (p.y < l.y) {\n l.y = p.y;\n }\n\n if (p.z > u.z) {\n u.z = p.z;\n }\n\n if (p.z < l.z) {\n l.z = p.z;\n }\n } // Add offset\n\n\n if (position) {\n position.vadd(l, l);\n position.vadd(u, u);\n }\n\n if (skinSize) {\n l.x -= skinSize;\n l.y -= skinSize;\n l.z -= skinSize;\n u.x += skinSize;\n u.y += skinSize;\n u.z += skinSize;\n }\n\n return this;\n }\n /**\n * Copy bounds from an AABB to this AABB\n * @param aabb Source to copy from\n * @return The this object, for chainability\n */\n\n\n copy(aabb) {\n this.lowerBound.copy(aabb.lowerBound);\n this.upperBound.copy(aabb.upperBound);\n return this;\n }\n /**\n * Clone an AABB\n */\n\n\n clone() {\n return new AABB().copy(this);\n }\n /**\n * Extend this AABB so that it covers the given AABB too.\n */\n\n\n extend(aabb) {\n this.lowerBound.x = Math.min(this.lowerBound.x, aabb.lowerBound.x);\n this.upperBound.x = Math.max(this.upperBound.x, aabb.upperBound.x);\n this.lowerBound.y = Math.min(this.lowerBound.y, aabb.lowerBound.y);\n this.upperBound.y = Math.max(this.upperBound.y, aabb.upperBound.y);\n this.lowerBound.z = Math.min(this.lowerBound.z, aabb.lowerBound.z);\n this.upperBound.z = Math.max(this.upperBound.z, aabb.upperBound.z);\n }\n /**\n * Returns true if the given AABB overlaps this AABB.\n */\n\n\n overlaps(aabb) {\n const l1 = this.lowerBound;\n const u1 = this.upperBound;\n const l2 = aabb.lowerBound;\n const u2 = aabb.upperBound; // l2 u2\n // |---------|\n // |--------|\n // l1 u1\n\n const overlapsX = l2.x <= u1.x && u1.x <= u2.x || l1.x <= u2.x && u2.x <= u1.x;\n const overlapsY = l2.y <= u1.y && u1.y <= u2.y || l1.y <= u2.y && u2.y <= u1.y;\n const overlapsZ = l2.z <= u1.z && u1.z <= u2.z || l1.z <= u2.z && u2.z <= u1.z;\n return overlapsX && overlapsY && overlapsZ;\n } // Mostly for debugging\n\n\n volume() {\n const l = this.lowerBound;\n const u = this.upperBound;\n return (u.x - l.x) * (u.y - l.y) * (u.z - l.z);\n }\n /**\n * Returns true if the given AABB is fully contained in this AABB.\n */\n\n\n contains(aabb) {\n const l1 = this.lowerBound;\n const u1 = this.upperBound;\n const l2 = aabb.lowerBound;\n const u2 = aabb.upperBound; // l2 u2\n // |---------|\n // |---------------|\n // l1 u1\n\n return l1.x <= l2.x && u1.x >= u2.x && l1.y <= l2.y && u1.y >= u2.y && l1.z <= l2.z && u1.z >= u2.z;\n }\n\n getCorners(a, b, c, d, e, f, g, h) {\n const l = this.lowerBound;\n const u = this.upperBound;\n a.copy(l);\n b.set(u.x, l.y, l.z);\n c.set(u.x, u.y, l.z);\n d.set(l.x, u.y, u.z);\n e.set(u.x, l.y, u.z);\n f.set(l.x, u.y, l.z);\n g.set(l.x, l.y, u.z);\n h.copy(u);\n }\n /**\n * Get the representation of an AABB in another frame.\n * @return The \"target\" AABB object.\n */\n\n\n toLocalFrame(frame, target) {\n const corners = transformIntoFrame_corners;\n const a = corners[0];\n const b = corners[1];\n const c = corners[2];\n const d = corners[3];\n const e = corners[4];\n const f = corners[5];\n const g = corners[6];\n const h = corners[7]; // Get corners in current frame\n\n this.getCorners(a, b, c, d, e, f, g, h); // Transform them to new local frame\n\n for (let i = 0; i !== 8; i++) {\n const corner = corners[i];\n frame.pointToLocal(corner, corner);\n }\n\n return target.setFromPoints(corners);\n }\n /**\n * Get the representation of an AABB in the global frame.\n * @return The \"target\" AABB object.\n */\n\n\n toWorldFrame(frame, target) {\n const corners = transformIntoFrame_corners;\n const a = corners[0];\n const b = corners[1];\n const c = corners[2];\n const d = corners[3];\n const e = corners[4];\n const f = corners[5];\n const g = corners[6];\n const h = corners[7]; // Get corners in current frame\n\n this.getCorners(a, b, c, d, e, f, g, h); // Transform them to new local frame\n\n for (let i = 0; i !== 8; i++) {\n const corner = corners[i];\n frame.pointToWorld(corner, corner);\n }\n\n return target.setFromPoints(corners);\n }\n /**\n * Check if the AABB is hit by a ray.\n */\n\n\n overlapsRay(ray) {\n const {\n direction,\n from\n } = ray; // const t = 0\n // ray.direction is unit direction vector of ray\n\n const dirFracX = 1 / direction.x;\n const dirFracY = 1 / direction.y;\n const dirFracZ = 1 / direction.z; // this.lowerBound is the corner of AABB with minimal coordinates - left bottom, rt is maximal corner\n\n const t1 = (this.lowerBound.x - from.x) * dirFracX;\n const t2 = (this.upperBound.x - from.x) * dirFracX;\n const t3 = (this.lowerBound.y - from.y) * dirFracY;\n const t4 = (this.upperBound.y - from.y) * dirFracY;\n const t5 = (this.lowerBound.z - from.z) * dirFracZ;\n const t6 = (this.upperBound.z - from.z) * dirFracZ; // const tmin = Math.max(Math.max(Math.min(t1, t2), Math.min(t3, t4)));\n // const tmax = Math.min(Math.min(Math.max(t1, t2), Math.max(t3, t4)));\n\n const tmin = Math.max(Math.max(Math.min(t1, t2), Math.min(t3, t4)), Math.min(t5, t6));\n const tmax = Math.min(Math.min(Math.max(t1, t2), Math.max(t3, t4)), Math.max(t5, t6)); // if tmax < 0, ray (line) is intersecting AABB, but whole AABB is behing us\n\n if (tmax < 0) {\n //t = tmax;\n return false;\n } // if tmin > tmax, ray doesn't intersect AABB\n\n\n if (tmin > tmax) {\n //t = tmax;\n return false;\n }\n\n return true;\n }\n\n}\nconst tmp$1 = new Vec3();\nconst transformIntoFrame_corners = [new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3()];\n\n/**\n * Collision \"matrix\".\n * It's actually a triangular-shaped array of whether two bodies are touching this step, for reference next step\n */\nclass ArrayCollisionMatrix {\n /**\n * The matrix storage.\n */\n constructor() {\n this.matrix = [];\n }\n /**\n * Get an element\n */\n\n\n get(bi, bj) {\n let {\n index: i\n } = bi;\n let {\n index: j\n } = bj;\n\n if (j > i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n return this.matrix[(i * (i + 1) >> 1) + j - 1];\n }\n /**\n * Set an element\n */\n\n\n set(bi, bj, value) {\n let {\n index: i\n } = bi;\n let {\n index: j\n } = bj;\n\n if (j > i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n this.matrix[(i * (i + 1) >> 1) + j - 1] = value ? 1 : 0;\n }\n /**\n * Sets all elements to zero\n */\n\n\n reset() {\n for (let i = 0, l = this.matrix.length; i !== l; i++) {\n this.matrix[i] = 0;\n }\n }\n /**\n * Sets the max number of objects\n */\n\n\n setNumObjects(n) {\n this.matrix.length = n * (n - 1) >> 1;\n }\n\n}\n\n/**\n * Base class for objects that dispatches events.\n */\nclass EventTarget {\n /**\n * Add an event listener\n * @return The self object, for chainability.\n */\n addEventListener(type, listener) {\n if (this._listeners === undefined) {\n this._listeners = {};\n }\n\n const listeners = this._listeners;\n\n if (listeners[type] === undefined) {\n listeners[type] = [];\n }\n\n if (!listeners[type].includes(listener)) {\n listeners[type].push(listener);\n }\n\n return this;\n }\n /**\n * Check if an event listener is added\n */\n\n\n hasEventListener(type, listener) {\n if (this._listeners === undefined) {\n return false;\n }\n\n const listeners = this._listeners;\n\n if (listeners[type] !== undefined && listeners[type].includes(listener)) {\n return true;\n }\n\n return false;\n }\n /**\n * Check if any event listener of the given type is added\n */\n\n\n hasAnyEventListener(type) {\n if (this._listeners === undefined) {\n return false;\n }\n\n const listeners = this._listeners;\n return listeners[type] !== undefined;\n }\n /**\n * Remove an event listener\n * @return The self object, for chainability.\n */\n\n\n removeEventListener(type, listener) {\n if (this._listeners === undefined) {\n return this;\n }\n\n const listeners = this._listeners;\n\n if (listeners[type] === undefined) {\n return this;\n }\n\n const index = listeners[type].indexOf(listener);\n\n if (index !== -1) {\n listeners[type].splice(index, 1);\n }\n\n return this;\n }\n /**\n * Emit an event.\n * @return The self object, for chainability.\n */\n\n\n dispatchEvent(event) {\n if (this._listeners === undefined) {\n return this;\n }\n\n const listeners = this._listeners;\n const listenerArray = listeners[event.type];\n\n if (listenerArray !== undefined) {\n event.target = this;\n\n for (let i = 0, l = listenerArray.length; i < l; i++) {\n listenerArray[i].call(this, event);\n }\n }\n\n return this;\n }\n\n}\n\n/**\n * A Quaternion describes a rotation in 3D space. The Quaternion is mathematically defined as Q = x*i + y*j + z*k + w, where (i,j,k) are imaginary basis vectors. (x,y,z) can be seen as a vector related to the axis of rotation, while the real multiplier, w, is related to the amount of rotation.\n * @param x Multiplier of the imaginary basis vector i.\n * @param y Multiplier of the imaginary basis vector j.\n * @param z Multiplier of the imaginary basis vector k.\n * @param w Multiplier of the real part.\n * @see http://en.wikipedia.org/wiki/Quaternion\n */\n\nclass Quaternion {\n constructor(x, y, z, w) {\n if (x === void 0) {\n x = 0;\n }\n\n if (y === void 0) {\n y = 0;\n }\n\n if (z === void 0) {\n z = 0;\n }\n\n if (w === void 0) {\n w = 1;\n }\n\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n }\n /**\n * Set the value of the quaternion.\n */\n\n\n set(x, y, z, w) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n return this;\n }\n /**\n * Convert to a readable format\n * @return \"x,y,z,w\"\n */\n\n\n toString() {\n return `${this.x},${this.y},${this.z},${this.w}`;\n }\n /**\n * Convert to an Array\n * @return [x, y, z, w]\n */\n\n\n toArray() {\n return [this.x, this.y, this.z, this.w];\n }\n /**\n * Set the quaternion components given an axis and an angle in radians.\n */\n\n\n setFromAxisAngle(vector, angle) {\n const s = Math.sin(angle * 0.5);\n this.x = vector.x * s;\n this.y = vector.y * s;\n this.z = vector.z * s;\n this.w = Math.cos(angle * 0.5);\n return this;\n }\n /**\n * Converts the quaternion to [ axis, angle ] representation.\n * @param targetAxis A vector object to reuse for storing the axis.\n * @return An array, first element is the axis and the second is the angle in radians.\n */\n\n\n toAxisAngle(targetAxis) {\n if (targetAxis === void 0) {\n targetAxis = new Vec3();\n }\n\n this.normalize(); // if w>1 acos and sqrt will produce errors, this cant happen if quaternion is normalised\n\n const angle = 2 * Math.acos(this.w);\n const s = Math.sqrt(1 - this.w * this.w); // assuming quaternion normalised then w is less than 1, so term always positive.\n\n if (s < 0.001) {\n // test to avoid divide by zero, s is always positive due to sqrt\n // if s close to zero then direction of axis not important\n targetAxis.x = this.x; // if it is important that axis is normalised then replace with x=1; y=z=0;\n\n targetAxis.y = this.y;\n targetAxis.z = this.z;\n } else {\n targetAxis.x = this.x / s; // normalise axis\n\n targetAxis.y = this.y / s;\n targetAxis.z = this.z / s;\n }\n\n return [targetAxis, angle];\n }\n /**\n * Set the quaternion value given two vectors. The resulting rotation will be the needed rotation to rotate u to v.\n */\n\n\n setFromVectors(u, v) {\n if (u.isAntiparallelTo(v)) {\n const t1 = sfv_t1;\n const t2 = sfv_t2;\n u.tangents(t1, t2);\n this.setFromAxisAngle(t1, Math.PI);\n } else {\n const a = u.cross(v);\n this.x = a.x;\n this.y = a.y;\n this.z = a.z;\n this.w = Math.sqrt(u.length() ** 2 * v.length() ** 2) + u.dot(v);\n this.normalize();\n }\n\n return this;\n }\n /**\n * Multiply the quaternion with an other quaternion.\n */\n\n\n mult(quat, target) {\n if (target === void 0) {\n target = new Quaternion();\n }\n\n const ax = this.x;\n const ay = this.y;\n const az = this.z;\n const aw = this.w;\n const bx = quat.x;\n const by = quat.y;\n const bz = quat.z;\n const bw = quat.w;\n target.x = ax * bw + aw * bx + ay * bz - az * by;\n target.y = ay * bw + aw * by + az * bx - ax * bz;\n target.z = az * bw + aw * bz + ax * by - ay * bx;\n target.w = aw * bw - ax * bx - ay * by - az * bz;\n return target;\n }\n /**\n * Get the inverse quaternion rotation.\n */\n\n\n inverse(target) {\n if (target === void 0) {\n target = new Quaternion();\n }\n\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const w = this.w;\n this.conjugate(target);\n const inorm2 = 1 / (x * x + y * y + z * z + w * w);\n target.x *= inorm2;\n target.y *= inorm2;\n target.z *= inorm2;\n target.w *= inorm2;\n return target;\n }\n /**\n * Get the quaternion conjugate\n */\n\n\n conjugate(target) {\n if (target === void 0) {\n target = new Quaternion();\n }\n\n target.x = -this.x;\n target.y = -this.y;\n target.z = -this.z;\n target.w = this.w;\n return target;\n }\n /**\n * Normalize the quaternion. Note that this changes the values of the quaternion.\n */\n\n\n normalize() {\n let l = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\n\n if (l === 0) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 0;\n } else {\n l = 1 / l;\n this.x *= l;\n this.y *= l;\n this.z *= l;\n this.w *= l;\n }\n\n return this;\n }\n /**\n * Approximation of quaternion normalization. Works best when quat is already almost-normalized.\n * @author unphased, https://github.com/unphased\n */\n\n\n normalizeFast() {\n const f = (3.0 - (this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w)) / 2.0;\n\n if (f === 0) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 0;\n } else {\n this.x *= f;\n this.y *= f;\n this.z *= f;\n this.w *= f;\n }\n\n return this;\n }\n /**\n * Multiply the quaternion by a vector\n */\n\n\n vmult(v, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const x = v.x;\n const y = v.y;\n const z = v.z;\n const qx = this.x;\n const qy = this.y;\n const qz = this.z;\n const qw = this.w; // q*v\n\n const ix = qw * x + qy * z - qz * y;\n const iy = qw * y + qz * x - qx * z;\n const iz = qw * z + qx * y - qy * x;\n const iw = -qx * x - qy * y - qz * z;\n target.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n target.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n target.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return target;\n }\n /**\n * Copies value of source to this quaternion.\n * @return this\n */\n\n\n copy(quat) {\n this.x = quat.x;\n this.y = quat.y;\n this.z = quat.z;\n this.w = quat.w;\n return this;\n }\n /**\n * Convert the quaternion to euler angle representation. Order: YZX, as this page describes: https://www.euclideanspace.com/maths/standards/index.htm\n * @param order Three-character string, defaults to \"YZX\"\n */\n\n\n toEuler(target, order) {\n if (order === void 0) {\n order = 'YZX';\n }\n\n let heading;\n let attitude;\n let bank;\n const x = this.x;\n const y = this.y;\n const z = this.z;\n const w = this.w;\n\n switch (order) {\n case 'YZX':\n const test = x * y + z * w;\n\n if (test > 0.499) {\n // singularity at north pole\n heading = 2 * Math.atan2(x, w);\n attitude = Math.PI / 2;\n bank = 0;\n }\n\n if (test < -0.499) {\n // singularity at south pole\n heading = -2 * Math.atan2(x, w);\n attitude = -Math.PI / 2;\n bank = 0;\n }\n\n if (heading === undefined) {\n const sqx = x * x;\n const sqy = y * y;\n const sqz = z * z;\n heading = Math.atan2(2 * y * w - 2 * x * z, 1 - 2 * sqy - 2 * sqz); // Heading\n\n attitude = Math.asin(2 * test); // attitude\n\n bank = Math.atan2(2 * x * w - 2 * y * z, 1 - 2 * sqx - 2 * sqz); // bank\n }\n\n break;\n\n default:\n throw new Error(`Euler order ${order} not supported yet.`);\n }\n\n target.y = heading;\n target.z = attitude;\n target.x = bank;\n }\n /**\n * Set the quaternion components given Euler angle representation.\n *\n * @param order The order to apply angles: 'XYZ' or 'YXZ' or any other combination.\n *\n * See {@link https://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors MathWorks} reference\n */\n\n\n setFromEuler(x, y, z, order) {\n if (order === void 0) {\n order = 'XYZ';\n }\n\n const c1 = Math.cos(x / 2);\n const c2 = Math.cos(y / 2);\n const c3 = Math.cos(z / 2);\n const s1 = Math.sin(x / 2);\n const s2 = Math.sin(y / 2);\n const s3 = Math.sin(z / 2);\n\n if (order === 'XYZ') {\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n } else if (order === 'YXZ') {\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n } else if (order === 'ZXY') {\n this.x = s1 * c2 * c3 - c1 * s2 * s3;\n this.y = c1 * s2 * c3 + s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n } else if (order === 'ZYX') {\n this.x = s1 * c2 * c3 - c1 * s2 * s3;\n this.y = c1 * s2 * c3 + s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n } else if (order === 'YZX') {\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 + s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n } else if (order === 'XZY') {\n this.x = s1 * c2 * c3 - c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n }\n\n return this;\n }\n\n clone() {\n return new Quaternion(this.x, this.y, this.z, this.w);\n }\n /**\n * Performs a spherical linear interpolation between two quat\n *\n * @param toQuat second operand\n * @param t interpolation amount between the self quaternion and toQuat\n * @param target A quaternion to store the result in. If not provided, a new one will be created.\n * @returns {Quaternion} The \"target\" object\n */\n\n\n slerp(toQuat, t, target) {\n if (target === void 0) {\n target = new Quaternion();\n }\n\n const ax = this.x;\n const ay = this.y;\n const az = this.z;\n const aw = this.w;\n let bx = toQuat.x;\n let by = toQuat.y;\n let bz = toQuat.z;\n let bw = toQuat.w;\n let omega;\n let cosom;\n let sinom;\n let scale0;\n let scale1; // calc cosine\n\n cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)\n\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n } // calculate coefficients\n\n\n if (1.0 - cosom > 0.000001) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n } // calculate final values\n\n\n target.x = scale0 * ax + scale1 * bx;\n target.y = scale0 * ay + scale1 * by;\n target.z = scale0 * az + scale1 * bz;\n target.w = scale0 * aw + scale1 * bw;\n return target;\n }\n /**\n * Rotate an absolute orientation quaternion given an angular velocity and a time step.\n */\n\n\n integrate(angularVelocity, dt, angularFactor, target) {\n if (target === void 0) {\n target = new Quaternion();\n }\n\n const ax = angularVelocity.x * angularFactor.x,\n ay = angularVelocity.y * angularFactor.y,\n az = angularVelocity.z * angularFactor.z,\n bx = this.x,\n by = this.y,\n bz = this.z,\n bw = this.w;\n const half_dt = dt * 0.5;\n target.x += half_dt * (ax * bw + ay * bz - az * by);\n target.y += half_dt * (ay * bw + az * bx - ax * bz);\n target.z += half_dt * (az * bw + ax * by - ay * bx);\n target.w += half_dt * (-ax * bx - ay * by - az * bz);\n return target;\n }\n\n}\nconst sfv_t1 = new Vec3();\nconst sfv_t2 = new Vec3();\n\n/**\n * The available shape types.\n */\nconst SHAPE_TYPES = {\n /** SPHERE */\n SPHERE: 1,\n\n /** PLANE */\n PLANE: 2,\n\n /** BOX */\n BOX: 4,\n\n /** COMPOUND */\n COMPOUND: 8,\n\n /** CONVEXPOLYHEDRON */\n CONVEXPOLYHEDRON: 16,\n\n /** HEIGHTFIELD */\n HEIGHTFIELD: 32,\n\n /** PARTICLE */\n PARTICLE: 64,\n\n /** CYLINDER */\n CYLINDER: 128,\n\n /** TRIMESH */\n TRIMESH: 256\n};\n/**\n * ShapeType\n */\n\n/**\n * Base class for shapes\n */\nclass Shape {\n /**\n * Identifier of the Shape.\n */\n\n /**\n * The type of this shape. Must be set to an int > 0 by subclasses.\n */\n\n /**\n * The local bounding sphere radius of this shape.\n */\n\n /**\n * Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.\n * @default true\n */\n\n /**\n * @default 1\n */\n\n /**\n * @default -1\n */\n\n /**\n * Optional material of the shape that regulates contact properties.\n */\n\n /**\n * The body to which the shape is added to.\n */\n\n /**\n * All the Shape types.\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.id = Shape.idCounter++;\n this.type = options.type || 0;\n this.boundingSphereRadius = 0;\n this.collisionResponse = options.collisionResponse ? options.collisionResponse : true;\n this.collisionFilterGroup = options.collisionFilterGroup !== undefined ? options.collisionFilterGroup : 1;\n this.collisionFilterMask = options.collisionFilterMask !== undefined ? options.collisionFilterMask : -1;\n this.material = options.material ? options.material : null;\n this.body = null;\n }\n /**\n * Computes the bounding sphere radius.\n * The result is stored in the property `.boundingSphereRadius`\n */\n\n\n updateBoundingSphereRadius() {\n throw `computeBoundingSphereRadius() not implemented for shape type ${this.type}`;\n }\n /**\n * Get the volume of this shape\n */\n\n\n volume() {\n throw `volume() not implemented for shape type ${this.type}`;\n }\n /**\n * Calculates the inertia in the local frame for this shape.\n * @see http://en.wikipedia.org/wiki/List_of_moments_of_inertia\n */\n\n\n calculateLocalInertia(mass, target) {\n throw `calculateLocalInertia() not implemented for shape type ${this.type}`;\n }\n /**\n * @todo use abstract for these kind of methods\n */\n\n\n calculateWorldAABB(pos, quat, min, max) {\n throw `calculateWorldAABB() not implemented for shape type ${this.type}`;\n }\n\n}\nShape.idCounter = 0;\nShape.types = SHAPE_TYPES;\n\n/**\n * Transformation utilities.\n */\nclass Transform {\n /**\n * position\n */\n\n /**\n * quaternion\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.position = new Vec3();\n this.quaternion = new Quaternion();\n\n if (options.position) {\n this.position.copy(options.position);\n }\n\n if (options.quaternion) {\n this.quaternion.copy(options.quaternion);\n }\n }\n /**\n * Get a global point in local transform coordinates.\n */\n\n\n pointToLocal(worldPoint, result) {\n return Transform.pointToLocalFrame(this.position, this.quaternion, worldPoint, result);\n }\n /**\n * Get a local point in global transform coordinates.\n */\n\n\n pointToWorld(localPoint, result) {\n return Transform.pointToWorldFrame(this.position, this.quaternion, localPoint, result);\n }\n /**\n * vectorToWorldFrame\n */\n\n\n vectorToWorldFrame(localVector, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n this.quaternion.vmult(localVector, result);\n return result;\n }\n /**\n * pointToLocalFrame\n */\n\n\n static pointToLocalFrame(position, quaternion, worldPoint, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n worldPoint.vsub(position, result);\n quaternion.conjugate(tmpQuat$1);\n tmpQuat$1.vmult(result, result);\n return result;\n }\n /**\n * pointToWorldFrame\n */\n\n\n static pointToWorldFrame(position, quaternion, localPoint, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n quaternion.vmult(localPoint, result);\n result.vadd(position, result);\n return result;\n }\n /**\n * vectorToWorldFrame\n */\n\n\n static vectorToWorldFrame(quaternion, localVector, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n quaternion.vmult(localVector, result);\n return result;\n }\n /**\n * vectorToLocalFrame\n */\n\n\n static vectorToLocalFrame(position, quaternion, worldVector, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n quaternion.w *= -1;\n quaternion.vmult(worldVector, result);\n quaternion.w *= -1;\n return result;\n }\n\n}\nconst tmpQuat$1 = new Quaternion();\n\n/**\n * A set of polygons describing a convex shape.\n *\n * The shape MUST be convex for the code to work properly. No polygons may be coplanar (contained\n * in the same 3D plane), instead these should be merged into one polygon.\n *\n * @author qiao / https://github.com/qiao (original author, see https://github.com/qiao/three.js/commit/85026f0c769e4000148a67d45a9e9b9c5108836f)\n * @author schteppe / https://github.com/schteppe\n * @see https://www.altdevblogaday.com/2011/05/13/contact-generation-between-3d-convex-meshes/\n *\n * @todo Move the clipping functions to ContactGenerator?\n * @todo Automatically merge coplanar polygons in constructor.\n * @example\n * const convexShape = new CANNON.ConvexPolyhedron({ vertices, faces })\n * const convexBody = new CANNON.Body({ mass: 1, shape: convexShape })\n * world.addBody(convexBody)\n */\nclass ConvexPolyhedron extends Shape {\n /** vertices */\n\n /**\n * Array of integer arrays, indicating which vertices each face consists of\n */\n\n /** faceNormals */\n\n /** worldVertices */\n\n /** worldVerticesNeedsUpdate */\n\n /** worldFaceNormals */\n\n /** worldFaceNormalsNeedsUpdate */\n\n /**\n * If given, these locally defined, normalized axes are the only ones being checked when doing separating axis check.\n */\n\n /** uniqueEdges */\n\n /**\n * @param vertices An array of Vec3's\n * @param faces Array of integer arrays, describing which vertices that is included in each face.\n */\n constructor(props) {\n if (props === void 0) {\n props = {};\n }\n\n const {\n vertices = [],\n faces = [],\n normals = [],\n axes,\n boundingSphereRadius\n } = props;\n super({\n type: Shape.types.CONVEXPOLYHEDRON\n });\n this.vertices = vertices;\n this.faces = faces;\n this.faceNormals = normals;\n\n if (this.faceNormals.length === 0) {\n this.computeNormals();\n }\n\n if (!boundingSphereRadius) {\n this.updateBoundingSphereRadius();\n } else {\n this.boundingSphereRadius = boundingSphereRadius;\n }\n\n this.worldVertices = []; // World transformed version of .vertices\n\n this.worldVerticesNeedsUpdate = true;\n this.worldFaceNormals = []; // World transformed version of .faceNormals\n\n this.worldFaceNormalsNeedsUpdate = true;\n this.uniqueAxes = axes ? axes.slice() : null;\n this.uniqueEdges = [];\n this.computeEdges();\n }\n /**\n * Computes uniqueEdges\n */\n\n\n computeEdges() {\n const faces = this.faces;\n const vertices = this.vertices;\n const edges = this.uniqueEdges;\n edges.length = 0;\n const edge = new Vec3();\n\n for (let i = 0; i !== faces.length; i++) {\n const face = faces[i];\n const numVertices = face.length;\n\n for (let j = 0; j !== numVertices; j++) {\n const k = (j + 1) % numVertices;\n vertices[face[j]].vsub(vertices[face[k]], edge);\n edge.normalize();\n let found = false;\n\n for (let p = 0; p !== edges.length; p++) {\n if (edges[p].almostEquals(edge) || edges[p].almostEquals(edge)) {\n found = true;\n break;\n }\n }\n\n if (!found) {\n edges.push(edge.clone());\n }\n }\n }\n }\n /**\n * Compute the normals of the faces.\n * Will reuse existing Vec3 objects in the `faceNormals` array if they exist.\n */\n\n\n computeNormals() {\n this.faceNormals.length = this.faces.length; // Generate normals\n\n for (let i = 0; i < this.faces.length; i++) {\n // Check so all vertices exists for this face\n for (let j = 0; j < this.faces[i].length; j++) {\n if (!this.vertices[this.faces[i][j]]) {\n throw new Error(`Vertex ${this.faces[i][j]} not found!`);\n }\n }\n\n const n = this.faceNormals[i] || new Vec3();\n this.getFaceNormal(i, n);\n n.negate(n);\n this.faceNormals[i] = n;\n const vertex = this.vertices[this.faces[i][0]];\n\n if (n.dot(vertex) < 0) {\n console.error(`.faceNormals[${i}] = Vec3(${n.toString()}) looks like it points into the shape? The vertices follow. Make sure they are ordered CCW around the normal, using the right hand rule.`);\n\n for (let j = 0; j < this.faces[i].length; j++) {\n console.warn(`.vertices[${this.faces[i][j]}] = Vec3(${this.vertices[this.faces[i][j]].toString()})`);\n }\n }\n }\n }\n /**\n * Compute the normal of a face from its vertices\n */\n\n\n getFaceNormal(i, target) {\n const f = this.faces[i];\n const va = this.vertices[f[0]];\n const vb = this.vertices[f[1]];\n const vc = this.vertices[f[2]];\n ConvexPolyhedron.computeNormal(va, vb, vc, target);\n }\n /**\n * Get face normal given 3 vertices\n */\n\n\n static computeNormal(va, vb, vc, target) {\n const cb = new Vec3();\n const ab = new Vec3();\n vb.vsub(va, ab);\n vc.vsub(vb, cb);\n cb.cross(ab, target);\n\n if (!target.isZero()) {\n target.normalize();\n }\n }\n /**\n * @param minDist Clamp distance\n * @param result The an array of contact point objects, see clipFaceAgainstHull\n */\n\n\n clipAgainstHull(posA, quatA, hullB, posB, quatB, separatingNormal, minDist, maxDist, result) {\n const WorldNormal = new Vec3();\n let closestFaceB = -1;\n let dmax = -Number.MAX_VALUE;\n\n for (let face = 0; face < hullB.faces.length; face++) {\n WorldNormal.copy(hullB.faceNormals[face]);\n quatB.vmult(WorldNormal, WorldNormal);\n const d = WorldNormal.dot(separatingNormal);\n\n if (d > dmax) {\n dmax = d;\n closestFaceB = face;\n }\n }\n\n const worldVertsB1 = [];\n\n for (let i = 0; i < hullB.faces[closestFaceB].length; i++) {\n const b = hullB.vertices[hullB.faces[closestFaceB][i]];\n const worldb = new Vec3();\n worldb.copy(b);\n quatB.vmult(worldb, worldb);\n posB.vadd(worldb, worldb);\n worldVertsB1.push(worldb);\n }\n\n if (closestFaceB >= 0) {\n this.clipFaceAgainstHull(separatingNormal, posA, quatA, worldVertsB1, minDist, maxDist, result);\n }\n }\n /**\n * Find the separating axis between this hull and another\n * @param target The target vector to save the axis in\n * @return Returns false if a separation is found, else true\n */\n\n\n findSeparatingAxis(hullB, posA, quatA, posB, quatB, target, faceListA, faceListB) {\n const faceANormalWS3 = new Vec3();\n const Worldnormal1 = new Vec3();\n const deltaC = new Vec3();\n const worldEdge0 = new Vec3();\n const worldEdge1 = new Vec3();\n const Cross = new Vec3();\n let dmin = Number.MAX_VALUE;\n const hullA = this;\n\n if (!hullA.uniqueAxes) {\n const numFacesA = faceListA ? faceListA.length : hullA.faces.length; // Test face normals from hullA\n\n for (let i = 0; i < numFacesA; i++) {\n const fi = faceListA ? faceListA[i] : i; // Get world face normal\n\n faceANormalWS3.copy(hullA.faceNormals[fi]);\n quatA.vmult(faceANormalWS3, faceANormalWS3);\n const d = hullA.testSepAxis(faceANormalWS3, hullB, posA, quatA, posB, quatB);\n\n if (d === false) {\n return false;\n }\n\n if (d < dmin) {\n dmin = d;\n target.copy(faceANormalWS3);\n }\n }\n } else {\n // Test unique axes\n for (let i = 0; i !== hullA.uniqueAxes.length; i++) {\n // Get world axis\n quatA.vmult(hullA.uniqueAxes[i], faceANormalWS3);\n const d = hullA.testSepAxis(faceANormalWS3, hullB, posA, quatA, posB, quatB);\n\n if (d === false) {\n return false;\n }\n\n if (d < dmin) {\n dmin = d;\n target.copy(faceANormalWS3);\n }\n }\n }\n\n if (!hullB.uniqueAxes) {\n // Test face normals from hullB\n const numFacesB = faceListB ? faceListB.length : hullB.faces.length;\n\n for (let i = 0; i < numFacesB; i++) {\n const fi = faceListB ? faceListB[i] : i;\n Worldnormal1.copy(hullB.faceNormals[fi]);\n quatB.vmult(Worldnormal1, Worldnormal1);\n const d = hullA.testSepAxis(Worldnormal1, hullB, posA, quatA, posB, quatB);\n\n if (d === false) {\n return false;\n }\n\n if (d < dmin) {\n dmin = d;\n target.copy(Worldnormal1);\n }\n }\n } else {\n // Test unique axes in B\n for (let i = 0; i !== hullB.uniqueAxes.length; i++) {\n quatB.vmult(hullB.uniqueAxes[i], Worldnormal1);\n const d = hullA.testSepAxis(Worldnormal1, hullB, posA, quatA, posB, quatB);\n\n if (d === false) {\n return false;\n }\n\n if (d < dmin) {\n dmin = d;\n target.copy(Worldnormal1);\n }\n }\n } // Test edges\n\n\n for (let e0 = 0; e0 !== hullA.uniqueEdges.length; e0++) {\n // Get world edge\n quatA.vmult(hullA.uniqueEdges[e0], worldEdge0);\n\n for (let e1 = 0; e1 !== hullB.uniqueEdges.length; e1++) {\n // Get world edge 2\n quatB.vmult(hullB.uniqueEdges[e1], worldEdge1);\n worldEdge0.cross(worldEdge1, Cross);\n\n if (!Cross.almostZero()) {\n Cross.normalize();\n const dist = hullA.testSepAxis(Cross, hullB, posA, quatA, posB, quatB);\n\n if (dist === false) {\n return false;\n }\n\n if (dist < dmin) {\n dmin = dist;\n target.copy(Cross);\n }\n }\n }\n }\n\n posB.vsub(posA, deltaC);\n\n if (deltaC.dot(target) > 0.0) {\n target.negate(target);\n }\n\n return true;\n }\n /**\n * Test separating axis against two hulls. Both hulls are projected onto the axis and the overlap size is returned if there is one.\n * @return The overlap depth, or FALSE if no penetration.\n */\n\n\n testSepAxis(axis, hullB, posA, quatA, posB, quatB) {\n const hullA = this;\n ConvexPolyhedron.project(hullA, axis, posA, quatA, maxminA);\n ConvexPolyhedron.project(hullB, axis, posB, quatB, maxminB);\n const maxA = maxminA[0];\n const minA = maxminA[1];\n const maxB = maxminB[0];\n const minB = maxminB[1];\n\n if (maxA < minB || maxB < minA) {\n return false; // Separated\n }\n\n const d0 = maxA - minB;\n const d1 = maxB - minA;\n const depth = d0 < d1 ? d0 : d1;\n return depth;\n }\n /**\n * calculateLocalInertia\n */\n\n\n calculateLocalInertia(mass, target) {\n // Approximate with box inertia\n // Exact inertia calculation is overkill, but see http://geometrictools.com/Documentation/PolyhedralMassProperties.pdf for the correct way to do it\n const aabbmax = new Vec3();\n const aabbmin = new Vec3();\n this.computeLocalAABB(aabbmin, aabbmax);\n const x = aabbmax.x - aabbmin.x;\n const y = aabbmax.y - aabbmin.y;\n const z = aabbmax.z - aabbmin.z;\n target.x = 1.0 / 12.0 * mass * (2 * y * 2 * y + 2 * z * 2 * z);\n target.y = 1.0 / 12.0 * mass * (2 * x * 2 * x + 2 * z * 2 * z);\n target.z = 1.0 / 12.0 * mass * (2 * y * 2 * y + 2 * x * 2 * x);\n }\n /**\n * @param face_i Index of the face\n */\n\n\n getPlaneConstantOfFace(face_i) {\n const f = this.faces[face_i];\n const n = this.faceNormals[face_i];\n const v = this.vertices[f[0]];\n const c = -n.dot(v);\n return c;\n }\n /**\n * Clip a face against a hull.\n * @param worldVertsB1 An array of Vec3 with vertices in the world frame.\n * @param minDist Distance clamping\n * @param Array result Array to store resulting contact points in. Will be objects with properties: point, depth, normal. These are represented in world coordinates.\n */\n\n\n clipFaceAgainstHull(separatingNormal, posA, quatA, worldVertsB1, minDist, maxDist, result) {\n const faceANormalWS = new Vec3();\n const edge0 = new Vec3();\n const WorldEdge0 = new Vec3();\n const worldPlaneAnormal1 = new Vec3();\n const planeNormalWS1 = new Vec3();\n const worldA1 = new Vec3();\n const localPlaneNormal = new Vec3();\n const planeNormalWS = new Vec3();\n const hullA = this;\n const worldVertsB2 = [];\n const pVtxIn = worldVertsB1;\n const pVtxOut = worldVertsB2;\n let closestFaceA = -1;\n let dmin = Number.MAX_VALUE; // Find the face with normal closest to the separating axis\n\n for (let face = 0; face < hullA.faces.length; face++) {\n faceANormalWS.copy(hullA.faceNormals[face]);\n quatA.vmult(faceANormalWS, faceANormalWS);\n const d = faceANormalWS.dot(separatingNormal);\n\n if (d < dmin) {\n dmin = d;\n closestFaceA = face;\n }\n }\n\n if (closestFaceA < 0) {\n return;\n } // Get the face and construct connected faces\n\n\n const polyA = hullA.faces[closestFaceA];\n polyA.connectedFaces = [];\n\n for (let i = 0; i < hullA.faces.length; i++) {\n for (let j = 0; j < hullA.faces[i].length; j++) {\n if (\n /* Sharing a vertex*/\n polyA.indexOf(hullA.faces[i][j]) !== -1 &&\n /* Not the one we are looking for connections from */\n i !== closestFaceA &&\n /* Not already added */\n polyA.connectedFaces.indexOf(i) === -1) {\n polyA.connectedFaces.push(i);\n }\n }\n } // Clip the polygon to the back of the planes of all faces of hull A,\n // that are adjacent to the witness face\n\n\n const numVerticesA = polyA.length;\n\n for (let i = 0; i < numVerticesA; i++) {\n const a = hullA.vertices[polyA[i]];\n const b = hullA.vertices[polyA[(i + 1) % numVerticesA]];\n a.vsub(b, edge0);\n WorldEdge0.copy(edge0);\n quatA.vmult(WorldEdge0, WorldEdge0);\n posA.vadd(WorldEdge0, WorldEdge0);\n worldPlaneAnormal1.copy(this.faceNormals[closestFaceA]);\n quatA.vmult(worldPlaneAnormal1, worldPlaneAnormal1);\n posA.vadd(worldPlaneAnormal1, worldPlaneAnormal1);\n WorldEdge0.cross(worldPlaneAnormal1, planeNormalWS1);\n planeNormalWS1.negate(planeNormalWS1);\n worldA1.copy(a);\n quatA.vmult(worldA1, worldA1);\n posA.vadd(worldA1, worldA1);\n const otherFace = polyA.connectedFaces[i];\n localPlaneNormal.copy(this.faceNormals[otherFace]);\n const localPlaneEq = this.getPlaneConstantOfFace(otherFace);\n planeNormalWS.copy(localPlaneNormal);\n quatA.vmult(planeNormalWS, planeNormalWS);\n const planeEqWS = localPlaneEq - planeNormalWS.dot(posA); // Clip face against our constructed plane\n\n this.clipFaceAgainstPlane(pVtxIn, pVtxOut, planeNormalWS, planeEqWS); // Throw away all clipped points, but save the remaining until next clip\n\n while (pVtxIn.length) {\n pVtxIn.shift();\n }\n\n while (pVtxOut.length) {\n pVtxIn.push(pVtxOut.shift());\n }\n } // only keep contact points that are behind the witness face\n\n\n localPlaneNormal.copy(this.faceNormals[closestFaceA]);\n const localPlaneEq = this.getPlaneConstantOfFace(closestFaceA);\n planeNormalWS.copy(localPlaneNormal);\n quatA.vmult(planeNormalWS, planeNormalWS);\n const planeEqWS = localPlaneEq - planeNormalWS.dot(posA);\n\n for (let i = 0; i < pVtxIn.length; i++) {\n let depth = planeNormalWS.dot(pVtxIn[i]) + planeEqWS; // ???\n\n if (depth <= minDist) {\n console.log(`clamped: depth=${depth} to minDist=${minDist}`);\n depth = minDist;\n }\n\n if (depth <= maxDist) {\n const point = pVtxIn[i];\n\n if (depth <= 1e-6) {\n const p = {\n point,\n normal: planeNormalWS,\n depth\n };\n result.push(p);\n }\n }\n }\n }\n /**\n * Clip a face in a hull against the back of a plane.\n * @param planeConstant The constant in the mathematical plane equation\n */\n\n\n clipFaceAgainstPlane(inVertices, outVertices, planeNormal, planeConstant) {\n let n_dot_first;\n let n_dot_last;\n const numVerts = inVertices.length;\n\n if (numVerts < 2) {\n return outVertices;\n }\n\n let firstVertex = inVertices[inVertices.length - 1];\n let lastVertex = inVertices[0];\n n_dot_first = planeNormal.dot(firstVertex) + planeConstant;\n\n for (let vi = 0; vi < numVerts; vi++) {\n lastVertex = inVertices[vi];\n n_dot_last = planeNormal.dot(lastVertex) + planeConstant;\n\n if (n_dot_first < 0) {\n if (n_dot_last < 0) {\n // Start < 0, end < 0, so output lastVertex\n const newv = new Vec3();\n newv.copy(lastVertex);\n outVertices.push(newv);\n } else {\n // Start < 0, end >= 0, so output intersection\n const newv = new Vec3();\n firstVertex.lerp(lastVertex, n_dot_first / (n_dot_first - n_dot_last), newv);\n outVertices.push(newv);\n }\n } else {\n if (n_dot_last < 0) {\n // Start >= 0, end < 0 so output intersection and end\n const newv = new Vec3();\n firstVertex.lerp(lastVertex, n_dot_first / (n_dot_first - n_dot_last), newv);\n outVertices.push(newv);\n outVertices.push(lastVertex);\n }\n }\n\n firstVertex = lastVertex;\n n_dot_first = n_dot_last;\n }\n\n return outVertices;\n }\n /**\n * Updates `.worldVertices` and sets `.worldVerticesNeedsUpdate` to false.\n */\n\n\n computeWorldVertices(position, quat) {\n while (this.worldVertices.length < this.vertices.length) {\n this.worldVertices.push(new Vec3());\n }\n\n const verts = this.vertices;\n const worldVerts = this.worldVertices;\n\n for (let i = 0; i !== this.vertices.length; i++) {\n quat.vmult(verts[i], worldVerts[i]);\n position.vadd(worldVerts[i], worldVerts[i]);\n }\n\n this.worldVerticesNeedsUpdate = false;\n }\n\n computeLocalAABB(aabbmin, aabbmax) {\n const vertices = this.vertices;\n aabbmin.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n aabbmax.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n\n for (let i = 0; i < this.vertices.length; i++) {\n const v = vertices[i];\n\n if (v.x < aabbmin.x) {\n aabbmin.x = v.x;\n } else if (v.x > aabbmax.x) {\n aabbmax.x = v.x;\n }\n\n if (v.y < aabbmin.y) {\n aabbmin.y = v.y;\n } else if (v.y > aabbmax.y) {\n aabbmax.y = v.y;\n }\n\n if (v.z < aabbmin.z) {\n aabbmin.z = v.z;\n } else if (v.z > aabbmax.z) {\n aabbmax.z = v.z;\n }\n }\n }\n /**\n * Updates `worldVertices` and sets `worldVerticesNeedsUpdate` to false.\n */\n\n\n computeWorldFaceNormals(quat) {\n const N = this.faceNormals.length;\n\n while (this.worldFaceNormals.length < N) {\n this.worldFaceNormals.push(new Vec3());\n }\n\n const normals = this.faceNormals;\n const worldNormals = this.worldFaceNormals;\n\n for (let i = 0; i !== N; i++) {\n quat.vmult(normals[i], worldNormals[i]);\n }\n\n this.worldFaceNormalsNeedsUpdate = false;\n }\n /**\n * updateBoundingSphereRadius\n */\n\n\n updateBoundingSphereRadius() {\n // Assume points are distributed with local (0,0,0) as center\n let max2 = 0;\n const verts = this.vertices;\n\n for (let i = 0; i !== verts.length; i++) {\n const norm2 = verts[i].lengthSquared();\n\n if (norm2 > max2) {\n max2 = norm2;\n }\n }\n\n this.boundingSphereRadius = Math.sqrt(max2);\n }\n /**\n * calculateWorldAABB\n */\n\n\n calculateWorldAABB(pos, quat, min, max) {\n const verts = this.vertices;\n let minx;\n let miny;\n let minz;\n let maxx;\n let maxy;\n let maxz;\n let tempWorldVertex = new Vec3();\n\n for (let i = 0; i < verts.length; i++) {\n tempWorldVertex.copy(verts[i]);\n quat.vmult(tempWorldVertex, tempWorldVertex);\n pos.vadd(tempWorldVertex, tempWorldVertex);\n const v = tempWorldVertex;\n\n if (minx === undefined || v.x < minx) {\n minx = v.x;\n }\n\n if (maxx === undefined || v.x > maxx) {\n maxx = v.x;\n }\n\n if (miny === undefined || v.y < miny) {\n miny = v.y;\n }\n\n if (maxy === undefined || v.y > maxy) {\n maxy = v.y;\n }\n\n if (minz === undefined || v.z < minz) {\n minz = v.z;\n }\n\n if (maxz === undefined || v.z > maxz) {\n maxz = v.z;\n }\n }\n\n min.set(minx, miny, minz);\n max.set(maxx, maxy, maxz);\n }\n /**\n * Get approximate convex volume\n */\n\n\n volume() {\n return 4.0 * Math.PI * this.boundingSphereRadius / 3.0;\n }\n /**\n * Get an average of all the vertices positions\n */\n\n\n getAveragePointLocal(target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const verts = this.vertices;\n\n for (let i = 0; i < verts.length; i++) {\n target.vadd(verts[i], target);\n }\n\n target.scale(1 / verts.length, target);\n return target;\n }\n /**\n * Transform all local points. Will change the .vertices\n */\n\n\n transformAllPoints(offset, quat) {\n const n = this.vertices.length;\n const verts = this.vertices; // Apply rotation\n\n if (quat) {\n // Rotate vertices\n for (let i = 0; i < n; i++) {\n const v = verts[i];\n quat.vmult(v, v);\n } // Rotate face normals\n\n\n for (let i = 0; i < this.faceNormals.length; i++) {\n const v = this.faceNormals[i];\n quat.vmult(v, v);\n }\n /*\n // Rotate edges\n for(let i=0; i 0 || r1 > 0 && r2 < 0) {\n return false; // Encountered some other sign. Exit.\n }\n } // If we got here, all dot products were of the same sign.\n\n\n return positiveResult ? 1 : -1;\n }\n /**\n * Get max and min dot product of a convex hull at position (pos,quat) projected onto an axis.\n * Results are saved in the array maxmin.\n * @param result result[0] and result[1] will be set to maximum and minimum, respectively.\n */\n\n\n static project(shape, axis, pos, quat, result) {\n const n = shape.vertices.length;\n project_worldVertex;\n const localAxis = project_localAxis;\n let max = 0;\n let min = 0;\n const localOrigin = project_localOrigin;\n const vs = shape.vertices;\n localOrigin.setZero(); // Transform the axis to local\n\n Transform.vectorToLocalFrame(pos, quat, axis, localAxis);\n Transform.pointToLocalFrame(pos, quat, localOrigin, localOrigin);\n const add = localOrigin.dot(localAxis);\n min = max = vs[0].dot(localAxis);\n\n for (let i = 1; i < n; i++) {\n const val = vs[i].dot(localAxis);\n\n if (val > max) {\n max = val;\n }\n\n if (val < min) {\n min = val;\n }\n }\n\n min -= add;\n max -= add;\n\n if (min > max) {\n // Inconsistent - swap\n const temp = min;\n min = max;\n max = temp;\n } // Output\n\n\n result[0] = max;\n result[1] = min;\n }\n\n}\nconst maxminA = [];\nconst maxminB = [];\nconst project_worldVertex = new Vec3();\nconst project_localAxis = new Vec3();\nconst project_localOrigin = new Vec3();\n\n/**\n * A 3d box shape.\n * @example\n * const size = 1\n * const halfExtents = new CANNON.Vec3(size, size, size)\n * const boxShape = new CANNON.Box(halfExtents)\n * const boxBody = new CANNON.Body({ mass: 1, shape: boxShape })\n * world.addBody(boxBody)\n */\nclass Box extends Shape {\n /**\n * The half extents of the box.\n */\n\n /**\n * Used by the contact generator to make contacts with other convex polyhedra for example.\n */\n constructor(halfExtents) {\n super({\n type: Shape.types.BOX\n });\n this.halfExtents = halfExtents;\n this.convexPolyhedronRepresentation = null;\n this.updateConvexPolyhedronRepresentation();\n this.updateBoundingSphereRadius();\n }\n /**\n * Updates the local convex polyhedron representation used for some collisions.\n */\n\n\n updateConvexPolyhedronRepresentation() {\n const sx = this.halfExtents.x;\n const sy = this.halfExtents.y;\n const sz = this.halfExtents.z;\n const V = Vec3;\n const vertices = [new V(-sx, -sy, -sz), new V(sx, -sy, -sz), new V(sx, sy, -sz), new V(-sx, sy, -sz), new V(-sx, -sy, sz), new V(sx, -sy, sz), new V(sx, sy, sz), new V(-sx, sy, sz)];\n const faces = [[3, 2, 1, 0], // -z\n [4, 5, 6, 7], // +z\n [5, 4, 0, 1], // -y\n [2, 3, 7, 6], // +y\n [0, 4, 7, 3], // -x\n [1, 2, 6, 5] // +x\n ];\n const axes = [new V(0, 0, 1), new V(0, 1, 0), new V(1, 0, 0)];\n const h = new ConvexPolyhedron({\n vertices,\n faces,\n axes\n });\n this.convexPolyhedronRepresentation = h;\n h.material = this.material;\n }\n /**\n * Calculate the inertia of the box.\n */\n\n\n calculateLocalInertia(mass, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n Box.calculateInertia(this.halfExtents, mass, target);\n return target;\n }\n\n static calculateInertia(halfExtents, mass, target) {\n const e = halfExtents;\n target.x = 1.0 / 12.0 * mass * (2 * e.y * 2 * e.y + 2 * e.z * 2 * e.z);\n target.y = 1.0 / 12.0 * mass * (2 * e.x * 2 * e.x + 2 * e.z * 2 * e.z);\n target.z = 1.0 / 12.0 * mass * (2 * e.y * 2 * e.y + 2 * e.x * 2 * e.x);\n }\n /**\n * Get the box 6 side normals\n * @param sixTargetVectors An array of 6 vectors, to store the resulting side normals in.\n * @param quat Orientation to apply to the normal vectors. If not provided, the vectors will be in respect to the local frame.\n */\n\n\n getSideNormals(sixTargetVectors, quat) {\n const sides = sixTargetVectors;\n const ex = this.halfExtents;\n sides[0].set(ex.x, 0, 0);\n sides[1].set(0, ex.y, 0);\n sides[2].set(0, 0, ex.z);\n sides[3].set(-ex.x, 0, 0);\n sides[4].set(0, -ex.y, 0);\n sides[5].set(0, 0, -ex.z);\n\n if (quat !== undefined) {\n for (let i = 0; i !== sides.length; i++) {\n quat.vmult(sides[i], sides[i]);\n }\n }\n\n return sides;\n }\n /**\n * Returns the volume of the box.\n */\n\n\n volume() {\n return 8.0 * this.halfExtents.x * this.halfExtents.y * this.halfExtents.z;\n }\n /**\n * updateBoundingSphereRadius\n */\n\n\n updateBoundingSphereRadius() {\n this.boundingSphereRadius = this.halfExtents.length();\n }\n /**\n * forEachWorldCorner\n */\n\n\n forEachWorldCorner(pos, quat, callback) {\n const e = this.halfExtents;\n const corners = [[e.x, e.y, e.z], [-e.x, e.y, e.z], [-e.x, -e.y, e.z], [-e.x, -e.y, -e.z], [e.x, -e.y, -e.z], [e.x, e.y, -e.z], [-e.x, e.y, -e.z], [e.x, -e.y, e.z]];\n\n for (let i = 0; i < corners.length; i++) {\n worldCornerTempPos.set(corners[i][0], corners[i][1], corners[i][2]);\n quat.vmult(worldCornerTempPos, worldCornerTempPos);\n pos.vadd(worldCornerTempPos, worldCornerTempPos);\n callback(worldCornerTempPos.x, worldCornerTempPos.y, worldCornerTempPos.z);\n }\n }\n /**\n * calculateWorldAABB\n */\n\n\n calculateWorldAABB(pos, quat, min, max) {\n const e = this.halfExtents;\n worldCornersTemp[0].set(e.x, e.y, e.z);\n worldCornersTemp[1].set(-e.x, e.y, e.z);\n worldCornersTemp[2].set(-e.x, -e.y, e.z);\n worldCornersTemp[3].set(-e.x, -e.y, -e.z);\n worldCornersTemp[4].set(e.x, -e.y, -e.z);\n worldCornersTemp[5].set(e.x, e.y, -e.z);\n worldCornersTemp[6].set(-e.x, e.y, -e.z);\n worldCornersTemp[7].set(e.x, -e.y, e.z);\n const wc = worldCornersTemp[0];\n quat.vmult(wc, wc);\n pos.vadd(wc, wc);\n max.copy(wc);\n min.copy(wc);\n\n for (let i = 1; i < 8; i++) {\n const wc = worldCornersTemp[i];\n quat.vmult(wc, wc);\n pos.vadd(wc, wc);\n const x = wc.x;\n const y = wc.y;\n const z = wc.z;\n\n if (x > max.x) {\n max.x = x;\n }\n\n if (y > max.y) {\n max.y = y;\n }\n\n if (z > max.z) {\n max.z = z;\n }\n\n if (x < min.x) {\n min.x = x;\n }\n\n if (y < min.y) {\n min.y = y;\n }\n\n if (z < min.z) {\n min.z = z;\n }\n } // Get each axis max\n // min.set(Infinity,Infinity,Infinity);\n // max.set(-Infinity,-Infinity,-Infinity);\n // this.forEachWorldCorner(pos,quat,function(x,y,z){\n // if(x > max.x){\n // max.x = x;\n // }\n // if(y > max.y){\n // max.y = y;\n // }\n // if(z > max.z){\n // max.z = z;\n // }\n // if(x < min.x){\n // min.x = x;\n // }\n // if(y < min.y){\n // min.y = y;\n // }\n // if(z < min.z){\n // min.z = z;\n // }\n // });\n\n }\n\n}\nconst worldCornerTempPos = new Vec3();\nconst worldCornersTemp = [new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3()];\n\n/**\n * BODY_TYPES\n */\nconst BODY_TYPES = {\n /** DYNAMIC */\n DYNAMIC: 1,\n\n /** STATIC */\n STATIC: 2,\n\n /** KINEMATIC */\n KINEMATIC: 4\n};\n/**\n * BodyType\n */\n\n/**\n * BODY_SLEEP_STATES\n */\nconst BODY_SLEEP_STATES = {\n /** AWAKE */\n AWAKE: 0,\n\n /** SLEEPY */\n SLEEPY: 1,\n\n /** SLEEPING */\n SLEEPING: 2\n};\n/**\n * BodySleepState\n */\n\n/**\n * Base class for all body types.\n * @example\n * const shape = new CANNON.Sphere(1)\n * const body = new CANNON.Body({\n * mass: 1,\n * shape,\n * })\n * world.addBody(body)\n */\nclass Body extends EventTarget {\n /**\n * Dispatched after two bodies collide. This event is dispatched on each\n * of the two bodies involved in the collision.\n * @event collide\n * @param body The body that was involved in the collision.\n * @param contact The details of the collision.\n */\n\n /**\n * A dynamic body is fully simulated. Can be moved manually by the user, but normally they move according to forces. A dynamic body can collide with all body types. A dynamic body always has finite, non-zero mass.\n */\n\n /**\n * A static body does not move during simulation and behaves as if it has infinite mass. Static bodies can be moved manually by setting the position of the body. The velocity of a static body is always zero. Static bodies do not collide with other static or kinematic bodies.\n */\n\n /**\n * A kinematic body moves under simulation according to its velocity. They do not respond to forces. They can be moved manually, but normally a kinematic body is moved by setting its velocity. A kinematic body behaves as if it has infinite mass. Kinematic bodies do not collide with other static or kinematic bodies.\n */\n\n /**\n * AWAKE\n */\n\n /**\n * SLEEPY\n */\n\n /**\n * SLEEPING\n */\n\n /**\n * Dispatched after a sleeping body has woken up.\n * @event wakeup\n */\n\n /**\n * Dispatched after a body has gone in to the sleepy state.\n * @event sleepy\n */\n\n /**\n * Dispatched after a body has fallen asleep.\n * @event sleep\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n super();\n this.id = Body.idCounter++;\n this.index = -1;\n this.world = null;\n this.vlambda = new Vec3();\n this.collisionFilterGroup = typeof options.collisionFilterGroup === 'number' ? options.collisionFilterGroup : 1;\n this.collisionFilterMask = typeof options.collisionFilterMask === 'number' ? options.collisionFilterMask : -1;\n this.collisionResponse = typeof options.collisionResponse === 'boolean' ? options.collisionResponse : true;\n this.position = new Vec3();\n this.previousPosition = new Vec3();\n this.interpolatedPosition = new Vec3();\n this.initPosition = new Vec3();\n\n if (options.position) {\n this.position.copy(options.position);\n this.previousPosition.copy(options.position);\n this.interpolatedPosition.copy(options.position);\n this.initPosition.copy(options.position);\n }\n\n this.velocity = new Vec3();\n\n if (options.velocity) {\n this.velocity.copy(options.velocity);\n }\n\n this.initVelocity = new Vec3();\n this.force = new Vec3();\n const mass = typeof options.mass === 'number' ? options.mass : 0;\n this.mass = mass;\n this.invMass = mass > 0 ? 1.0 / mass : 0;\n this.material = options.material || null;\n this.linearDamping = typeof options.linearDamping === 'number' ? options.linearDamping : 0.01;\n this.type = mass <= 0.0 ? Body.STATIC : Body.DYNAMIC;\n\n if (typeof options.type === typeof Body.STATIC) {\n this.type = options.type;\n }\n\n this.allowSleep = typeof options.allowSleep !== 'undefined' ? options.allowSleep : true;\n this.sleepState = Body.AWAKE;\n this.sleepSpeedLimit = typeof options.sleepSpeedLimit !== 'undefined' ? options.sleepSpeedLimit : 0.1;\n this.sleepTimeLimit = typeof options.sleepTimeLimit !== 'undefined' ? options.sleepTimeLimit : 1;\n this.timeLastSleepy = 0;\n this.wakeUpAfterNarrowphase = false;\n this.torque = new Vec3();\n this.quaternion = new Quaternion();\n this.initQuaternion = new Quaternion();\n this.previousQuaternion = new Quaternion();\n this.interpolatedQuaternion = new Quaternion();\n\n if (options.quaternion) {\n this.quaternion.copy(options.quaternion);\n this.initQuaternion.copy(options.quaternion);\n this.previousQuaternion.copy(options.quaternion);\n this.interpolatedQuaternion.copy(options.quaternion);\n }\n\n this.angularVelocity = new Vec3();\n\n if (options.angularVelocity) {\n this.angularVelocity.copy(options.angularVelocity);\n }\n\n this.initAngularVelocity = new Vec3();\n this.shapes = [];\n this.shapeOffsets = [];\n this.shapeOrientations = [];\n this.inertia = new Vec3();\n this.invInertia = new Vec3();\n this.invInertiaWorld = new Mat3();\n this.invMassSolve = 0;\n this.invInertiaSolve = new Vec3();\n this.invInertiaWorldSolve = new Mat3();\n this.fixedRotation = typeof options.fixedRotation !== 'undefined' ? options.fixedRotation : false;\n this.angularDamping = typeof options.angularDamping !== 'undefined' ? options.angularDamping : 0.01;\n this.linearFactor = new Vec3(1, 1, 1);\n\n if (options.linearFactor) {\n this.linearFactor.copy(options.linearFactor);\n }\n\n this.angularFactor = new Vec3(1, 1, 1);\n\n if (options.angularFactor) {\n this.angularFactor.copy(options.angularFactor);\n }\n\n this.aabb = new AABB();\n this.aabbNeedsUpdate = true;\n this.boundingRadius = 0;\n this.wlambda = new Vec3();\n this.isTrigger = Boolean(options.isTrigger);\n\n if (options.shape) {\n this.addShape(options.shape);\n }\n\n this.updateMassProperties();\n }\n /**\n * Wake the body up.\n */\n\n\n wakeUp() {\n const prevState = this.sleepState;\n this.sleepState = Body.AWAKE;\n this.wakeUpAfterNarrowphase = false;\n\n if (prevState === Body.SLEEPING) {\n this.dispatchEvent(Body.wakeupEvent);\n }\n }\n /**\n * Force body sleep\n */\n\n\n sleep() {\n this.sleepState = Body.SLEEPING;\n this.velocity.set(0, 0, 0);\n this.angularVelocity.set(0, 0, 0);\n this.wakeUpAfterNarrowphase = false;\n }\n /**\n * Called every timestep to update internal sleep timer and change sleep state if needed.\n * @param time The world time in seconds\n */\n\n\n sleepTick(time) {\n if (this.allowSleep) {\n const sleepState = this.sleepState;\n const speedSquared = this.velocity.lengthSquared() + this.angularVelocity.lengthSquared();\n const speedLimitSquared = this.sleepSpeedLimit ** 2;\n\n if (sleepState === Body.AWAKE && speedSquared < speedLimitSquared) {\n this.sleepState = Body.SLEEPY; // Sleepy\n\n this.timeLastSleepy = time;\n this.dispatchEvent(Body.sleepyEvent);\n } else if (sleepState === Body.SLEEPY && speedSquared > speedLimitSquared) {\n this.wakeUp(); // Wake up\n } else if (sleepState === Body.SLEEPY && time - this.timeLastSleepy > this.sleepTimeLimit) {\n this.sleep(); // Sleeping\n\n this.dispatchEvent(Body.sleepEvent);\n }\n }\n }\n /**\n * If the body is sleeping, it should be immovable / have infinite mass during solve. We solve it by having a separate \"solve mass\".\n */\n\n\n updateSolveMassProperties() {\n if (this.sleepState === Body.SLEEPING || this.type === Body.KINEMATIC) {\n this.invMassSolve = 0;\n this.invInertiaSolve.setZero();\n this.invInertiaWorldSolve.setZero();\n } else {\n this.invMassSolve = this.invMass;\n this.invInertiaSolve.copy(this.invInertia);\n this.invInertiaWorldSolve.copy(this.invInertiaWorld);\n }\n }\n /**\n * Convert a world point to local body frame.\n */\n\n\n pointToLocalFrame(worldPoint, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n worldPoint.vsub(this.position, result);\n this.quaternion.conjugate().vmult(result, result);\n return result;\n }\n /**\n * Convert a world vector to local body frame.\n */\n\n\n vectorToLocalFrame(worldVector, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n this.quaternion.conjugate().vmult(worldVector, result);\n return result;\n }\n /**\n * Convert a local body point to world frame.\n */\n\n\n pointToWorldFrame(localPoint, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n this.quaternion.vmult(localPoint, result);\n result.vadd(this.position, result);\n return result;\n }\n /**\n * Convert a local body point to world frame.\n */\n\n\n vectorToWorldFrame(localVector, result) {\n if (result === void 0) {\n result = new Vec3();\n }\n\n this.quaternion.vmult(localVector, result);\n return result;\n }\n /**\n * Add a shape to the body with a local offset and orientation.\n * @return The body object, for chainability.\n */\n\n\n addShape(shape, _offset, _orientation) {\n const offset = new Vec3();\n const orientation = new Quaternion();\n\n if (_offset) {\n offset.copy(_offset);\n }\n\n if (_orientation) {\n orientation.copy(_orientation);\n }\n\n this.shapes.push(shape);\n this.shapeOffsets.push(offset);\n this.shapeOrientations.push(orientation);\n this.updateMassProperties();\n this.updateBoundingRadius();\n this.aabbNeedsUpdate = true;\n shape.body = this;\n return this;\n }\n /**\n * Remove a shape from the body.\n * @return The body object, for chainability.\n */\n\n\n removeShape(shape) {\n const index = this.shapes.indexOf(shape);\n\n if (index === -1) {\n console.warn('Shape does not belong to the body');\n return this;\n }\n\n this.shapes.splice(index, 1);\n this.shapeOffsets.splice(index, 1);\n this.shapeOrientations.splice(index, 1);\n this.updateMassProperties();\n this.updateBoundingRadius();\n this.aabbNeedsUpdate = true;\n shape.body = null;\n return this;\n }\n /**\n * Update the bounding radius of the body. Should be done if any of the shapes are changed.\n */\n\n\n updateBoundingRadius() {\n const shapes = this.shapes;\n const shapeOffsets = this.shapeOffsets;\n const N = shapes.length;\n let radius = 0;\n\n for (let i = 0; i !== N; i++) {\n const shape = shapes[i];\n shape.updateBoundingSphereRadius();\n const offset = shapeOffsets[i].length();\n const r = shape.boundingSphereRadius;\n\n if (offset + r > radius) {\n radius = offset + r;\n }\n }\n\n this.boundingRadius = radius;\n }\n /**\n * Updates the .aabb\n */\n\n\n updateAABB() {\n const shapes = this.shapes;\n const shapeOffsets = this.shapeOffsets;\n const shapeOrientations = this.shapeOrientations;\n const N = shapes.length;\n const offset = tmpVec;\n const orientation = tmpQuat;\n const bodyQuat = this.quaternion;\n const aabb = this.aabb;\n const shapeAABB = updateAABB_shapeAABB;\n\n for (let i = 0; i !== N; i++) {\n const shape = shapes[i]; // Get shape world position\n\n bodyQuat.vmult(shapeOffsets[i], offset);\n offset.vadd(this.position, offset); // Get shape world quaternion\n\n bodyQuat.mult(shapeOrientations[i], orientation); // Get shape AABB\n\n shape.calculateWorldAABB(offset, orientation, shapeAABB.lowerBound, shapeAABB.upperBound);\n\n if (i === 0) {\n aabb.copy(shapeAABB);\n } else {\n aabb.extend(shapeAABB);\n }\n }\n\n this.aabbNeedsUpdate = false;\n }\n /**\n * Update `.inertiaWorld` and `.invInertiaWorld`\n */\n\n\n updateInertiaWorld(force) {\n const I = this.invInertia;\n\n if (I.x === I.y && I.y === I.z && !force) ; else {\n const m1 = uiw_m1;\n const m2 = uiw_m2;\n uiw_m3;\n m1.setRotationFromQuaternion(this.quaternion);\n m1.transpose(m2);\n m1.scale(I, m1);\n m1.mmult(m2, this.invInertiaWorld);\n }\n }\n /**\n * Apply force to a point of the body. This could for example be a point on the Body surface.\n * Applying force this way will add to Body.force and Body.torque.\n * @param force The amount of force to add.\n * @param relativePoint A point relative to the center of mass to apply the force on.\n */\n\n\n applyForce(force, relativePoint) {\n if (relativePoint === void 0) {\n relativePoint = new Vec3();\n }\n\n // Needed?\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n if (this.sleepState === Body.SLEEPING) {\n this.wakeUp();\n } // Compute produced rotational force\n\n\n const rotForce = Body_applyForce_rotForce;\n relativePoint.cross(force, rotForce); // Add linear force\n\n this.force.vadd(force, this.force); // Add rotational force\n\n this.torque.vadd(rotForce, this.torque);\n }\n /**\n * Apply force to a local point in the body.\n * @param force The force vector to apply, defined locally in the body frame.\n * @param localPoint A local point in the body to apply the force on.\n */\n\n\n applyLocalForce(localForce, localPoint) {\n if (localPoint === void 0) {\n localPoint = new Vec3();\n }\n\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n const worldForce = Body_applyLocalForce_worldForce;\n const relativePointWorld = Body_applyLocalForce_relativePointWorld; // Transform the force vector to world space\n\n this.vectorToWorldFrame(localForce, worldForce);\n this.vectorToWorldFrame(localPoint, relativePointWorld);\n this.applyForce(worldForce, relativePointWorld);\n }\n /**\n * Apply torque to the body.\n * @param torque The amount of torque to add.\n */\n\n\n applyTorque(torque) {\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n if (this.sleepState === Body.SLEEPING) {\n this.wakeUp();\n } // Add rotational force\n\n\n this.torque.vadd(torque, this.torque);\n }\n /**\n * Apply impulse to a point of the body. This could for example be a point on the Body surface.\n * An impulse is a force added to a body during a short period of time (impulse = force * time).\n * Impulses will be added to Body.velocity and Body.angularVelocity.\n * @param impulse The amount of impulse to add.\n * @param relativePoint A point relative to the center of mass to apply the force on.\n */\n\n\n applyImpulse(impulse, relativePoint) {\n if (relativePoint === void 0) {\n relativePoint = new Vec3();\n }\n\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n if (this.sleepState === Body.SLEEPING) {\n this.wakeUp();\n } // Compute point position relative to the body center\n\n\n const r = relativePoint; // Compute produced central impulse velocity\n\n const velo = Body_applyImpulse_velo;\n velo.copy(impulse);\n velo.scale(this.invMass, velo); // Add linear impulse\n\n this.velocity.vadd(velo, this.velocity); // Compute produced rotational impulse velocity\n\n const rotVelo = Body_applyImpulse_rotVelo;\n r.cross(impulse, rotVelo);\n /*\n rotVelo.x *= this.invInertia.x;\n rotVelo.y *= this.invInertia.y;\n rotVelo.z *= this.invInertia.z;\n */\n\n this.invInertiaWorld.vmult(rotVelo, rotVelo); // Add rotational Impulse\n\n this.angularVelocity.vadd(rotVelo, this.angularVelocity);\n }\n /**\n * Apply locally-defined impulse to a local point in the body.\n * @param force The force vector to apply, defined locally in the body frame.\n * @param localPoint A local point in the body to apply the force on.\n */\n\n\n applyLocalImpulse(localImpulse, localPoint) {\n if (localPoint === void 0) {\n localPoint = new Vec3();\n }\n\n if (this.type !== Body.DYNAMIC) {\n return;\n }\n\n const worldImpulse = Body_applyLocalImpulse_worldImpulse;\n const relativePointWorld = Body_applyLocalImpulse_relativePoint; // Transform the force vector to world space\n\n this.vectorToWorldFrame(localImpulse, worldImpulse);\n this.vectorToWorldFrame(localPoint, relativePointWorld);\n this.applyImpulse(worldImpulse, relativePointWorld);\n }\n /**\n * Should be called whenever you change the body shape or mass.\n */\n\n\n updateMassProperties() {\n const halfExtents = Body_updateMassProperties_halfExtents;\n this.invMass = this.mass > 0 ? 1.0 / this.mass : 0;\n const I = this.inertia;\n const fixed = this.fixedRotation; // Approximate with AABB box\n\n this.updateAABB();\n halfExtents.set((this.aabb.upperBound.x - this.aabb.lowerBound.x) / 2, (this.aabb.upperBound.y - this.aabb.lowerBound.y) / 2, (this.aabb.upperBound.z - this.aabb.lowerBound.z) / 2);\n Box.calculateInertia(halfExtents, this.mass, I);\n this.invInertia.set(I.x > 0 && !fixed ? 1.0 / I.x : 0, I.y > 0 && !fixed ? 1.0 / I.y : 0, I.z > 0 && !fixed ? 1.0 / I.z : 0);\n this.updateInertiaWorld(true);\n }\n /**\n * Get world velocity of a point in the body.\n * @param worldPoint\n * @param result\n * @return The result vector.\n */\n\n\n getVelocityAtWorldPoint(worldPoint, result) {\n const r = new Vec3();\n worldPoint.vsub(this.position, r);\n this.angularVelocity.cross(r, result);\n this.velocity.vadd(result, result);\n return result;\n }\n /**\n * Move the body forward in time.\n * @param dt Time step\n * @param quatNormalize Set to true to normalize the body quaternion\n * @param quatNormalizeFast If the quaternion should be normalized using \"fast\" quaternion normalization\n */\n\n\n integrate(dt, quatNormalize, quatNormalizeFast) {\n // Save previous position\n this.previousPosition.copy(this.position);\n this.previousQuaternion.copy(this.quaternion);\n\n if (!(this.type === Body.DYNAMIC || this.type === Body.KINEMATIC) || this.sleepState === Body.SLEEPING) {\n // Only for dynamic\n return;\n }\n\n const velo = this.velocity;\n const angularVelo = this.angularVelocity;\n const pos = this.position;\n const force = this.force;\n const torque = this.torque;\n const quat = this.quaternion;\n const invMass = this.invMass;\n const invInertia = this.invInertiaWorld;\n const linearFactor = this.linearFactor;\n const iMdt = invMass * dt;\n velo.x += force.x * iMdt * linearFactor.x;\n velo.y += force.y * iMdt * linearFactor.y;\n velo.z += force.z * iMdt * linearFactor.z;\n const e = invInertia.elements;\n const angularFactor = this.angularFactor;\n const tx = torque.x * angularFactor.x;\n const ty = torque.y * angularFactor.y;\n const tz = torque.z * angularFactor.z;\n angularVelo.x += dt * (e[0] * tx + e[1] * ty + e[2] * tz);\n angularVelo.y += dt * (e[3] * tx + e[4] * ty + e[5] * tz);\n angularVelo.z += dt * (e[6] * tx + e[7] * ty + e[8] * tz); // Use new velocity - leap frog\n\n pos.x += velo.x * dt;\n pos.y += velo.y * dt;\n pos.z += velo.z * dt;\n quat.integrate(this.angularVelocity, dt, this.angularFactor, quat);\n\n if (quatNormalize) {\n if (quatNormalizeFast) {\n quat.normalizeFast();\n } else {\n quat.normalize();\n }\n }\n\n this.aabbNeedsUpdate = true; // Update world inertia\n\n this.updateInertiaWorld();\n }\n\n}\nBody.idCounter = 0;\nBody.COLLIDE_EVENT_NAME = 'collide';\nBody.DYNAMIC = BODY_TYPES.DYNAMIC;\nBody.STATIC = BODY_TYPES.STATIC;\nBody.KINEMATIC = BODY_TYPES.KINEMATIC;\nBody.AWAKE = BODY_SLEEP_STATES.AWAKE;\nBody.SLEEPY = BODY_SLEEP_STATES.SLEEPY;\nBody.SLEEPING = BODY_SLEEP_STATES.SLEEPING;\nBody.wakeupEvent = {\n type: 'wakeup'\n};\nBody.sleepyEvent = {\n type: 'sleepy'\n};\nBody.sleepEvent = {\n type: 'sleep'\n};\nconst tmpVec = new Vec3();\nconst tmpQuat = new Quaternion();\nconst updateAABB_shapeAABB = new AABB();\nconst uiw_m1 = new Mat3();\nconst uiw_m2 = new Mat3();\nconst uiw_m3 = new Mat3();\nconst Body_applyForce_rotForce = new Vec3();\nconst Body_applyLocalForce_worldForce = new Vec3();\nconst Body_applyLocalForce_relativePointWorld = new Vec3();\nconst Body_applyImpulse_velo = new Vec3();\nconst Body_applyImpulse_rotVelo = new Vec3();\nconst Body_applyLocalImpulse_worldImpulse = new Vec3();\nconst Body_applyLocalImpulse_relativePoint = new Vec3();\nconst Body_updateMassProperties_halfExtents = new Vec3();\n\n/**\n * Base class for broadphase implementations\n * @author schteppe\n */\nclass Broadphase {\n /**\n * The world to search for collisions in.\n */\n\n /**\n * If set to true, the broadphase uses bounding boxes for intersection tests, else it uses bounding spheres.\n */\n\n /**\n * Set to true if the objects in the world moved.\n */\n constructor() {\n this.world = null;\n this.useBoundingBoxes = false;\n this.dirty = true;\n }\n /**\n * Get the collision pairs from the world\n * @param world The world to search in\n * @param p1 Empty array to be filled with body objects\n * @param p2 Empty array to be filled with body objects\n */\n\n\n collisionPairs(world, p1, p2) {\n throw new Error('collisionPairs not implemented for this BroadPhase class!');\n }\n /**\n * Check if a body pair needs to be intersection tested at all.\n */\n\n\n needBroadphaseCollision(bodyA, bodyB) {\n // Check collision filter masks\n if ((bodyA.collisionFilterGroup & bodyB.collisionFilterMask) === 0 || (bodyB.collisionFilterGroup & bodyA.collisionFilterMask) === 0) {\n return false;\n } // Check types\n\n\n if (((bodyA.type & Body.STATIC) !== 0 || bodyA.sleepState === Body.SLEEPING) && ((bodyB.type & Body.STATIC) !== 0 || bodyB.sleepState === Body.SLEEPING)) {\n // Both bodies are static or sleeping. Skip.\n return false;\n }\n\n return true;\n }\n /**\n * Check if the bounding volumes of two bodies intersect.\n */\n\n\n intersectionTest(bodyA, bodyB, pairs1, pairs2) {\n if (this.useBoundingBoxes) {\n this.doBoundingBoxBroadphase(bodyA, bodyB, pairs1, pairs2);\n } else {\n this.doBoundingSphereBroadphase(bodyA, bodyB, pairs1, pairs2);\n }\n }\n /**\n * Check if the bounding spheres of two bodies are intersecting.\n * @param pairs1 bodyA is appended to this array if intersection\n * @param pairs2 bodyB is appended to this array if intersection\n */\n\n\n doBoundingSphereBroadphase(bodyA, bodyB, pairs1, pairs2) {\n const r = Broadphase_collisionPairs_r;\n bodyB.position.vsub(bodyA.position, r);\n const boundingRadiusSum2 = (bodyA.boundingRadius + bodyB.boundingRadius) ** 2;\n const norm2 = r.lengthSquared();\n\n if (norm2 < boundingRadiusSum2) {\n pairs1.push(bodyA);\n pairs2.push(bodyB);\n }\n }\n /**\n * Check if the bounding boxes of two bodies are intersecting.\n */\n\n\n doBoundingBoxBroadphase(bodyA, bodyB, pairs1, pairs2) {\n if (bodyA.aabbNeedsUpdate) {\n bodyA.updateAABB();\n }\n\n if (bodyB.aabbNeedsUpdate) {\n bodyB.updateAABB();\n } // Check AABB / AABB\n\n\n if (bodyA.aabb.overlaps(bodyB.aabb)) {\n pairs1.push(bodyA);\n pairs2.push(bodyB);\n }\n }\n /**\n * Removes duplicate pairs from the pair arrays.\n */\n\n\n makePairsUnique(pairs1, pairs2) {\n const t = Broadphase_makePairsUnique_temp;\n const p1 = Broadphase_makePairsUnique_p1;\n const p2 = Broadphase_makePairsUnique_p2;\n const N = pairs1.length;\n\n for (let i = 0; i !== N; i++) {\n p1[i] = pairs1[i];\n p2[i] = pairs2[i];\n }\n\n pairs1.length = 0;\n pairs2.length = 0;\n\n for (let i = 0; i !== N; i++) {\n const id1 = p1[i].id;\n const id2 = p2[i].id;\n const key = id1 < id2 ? `${id1},${id2}` : `${id2},${id1}`;\n t[key] = i;\n t.keys.push(key);\n }\n\n for (let i = 0; i !== t.keys.length; i++) {\n const key = t.keys.pop();\n const pairIndex = t[key];\n pairs1.push(p1[pairIndex]);\n pairs2.push(p2[pairIndex]);\n delete t[key];\n }\n }\n /**\n * To be implemented by subcasses\n */\n\n\n setWorld(world) {}\n /**\n * Check if the bounding spheres of two bodies overlap.\n */\n\n\n static boundingSphereCheck(bodyA, bodyB) {\n const dist = new Vec3(); // bsc_dist;\n\n bodyA.position.vsub(bodyB.position, dist);\n const sa = bodyA.shapes[0];\n const sb = bodyB.shapes[0];\n return Math.pow(sa.boundingSphereRadius + sb.boundingSphereRadius, 2) > dist.lengthSquared();\n }\n /**\n * Returns all the bodies within the AABB.\n */\n\n\n aabbQuery(world, aabb, result) {\n console.warn('.aabbQuery is not implemented in this Broadphase subclass.');\n return [];\n }\n\n} // Temp objects\n\nconst Broadphase_collisionPairs_r = new Vec3();\nnew Vec3();\nnew Quaternion();\nnew Vec3();\nconst Broadphase_makePairsUnique_temp = {\n keys: []\n};\nconst Broadphase_makePairsUnique_p1 = [];\nconst Broadphase_makePairsUnique_p2 = [];\nnew Vec3();\n\n/**\n * Axis aligned uniform grid broadphase.\n * @todo Needs support for more than just planes and spheres.\n */\nclass GridBroadphase extends Broadphase {\n /**\n * Number of boxes along x\n */\n\n /**\n * Number of boxes along y\n */\n\n /**\n * Number of boxes along z\n */\n\n /**\n * aabbMin\n */\n\n /**\n * aabbMax\n */\n\n /**\n * bins\n */\n\n /**\n * binLengths\n */\n\n /**\n * @param nx Number of boxes along x.\n * @param ny Number of boxes along y.\n * @param nz Number of boxes along z.\n */\n constructor(aabbMin, aabbMax, nx, ny, nz) {\n if (aabbMin === void 0) {\n aabbMin = new Vec3(100, 100, 100);\n }\n\n if (aabbMax === void 0) {\n aabbMax = new Vec3(-100, -100, -100);\n }\n\n if (nx === void 0) {\n nx = 10;\n }\n\n if (ny === void 0) {\n ny = 10;\n }\n\n if (nz === void 0) {\n nz = 10;\n }\n\n super();\n this.nx = nx;\n this.ny = ny;\n this.nz = nz;\n this.aabbMin = aabbMin;\n this.aabbMax = aabbMax;\n const nbins = this.nx * this.ny * this.nz;\n\n if (nbins <= 0) {\n throw \"GridBroadphase: Each dimension's n must be >0\";\n }\n\n this.bins = [];\n this.binLengths = []; // Rather than continually resizing arrays (thrashing the memory), just record length and allow them to grow\n\n this.bins.length = nbins;\n this.binLengths.length = nbins;\n\n for (let i = 0; i < nbins; i++) {\n this.bins[i] = [];\n this.binLengths[i] = 0;\n }\n }\n /**\n * Get all the collision pairs in the physics world\n */\n\n\n collisionPairs(world, pairs1, pairs2) {\n const N = world.bodies.length;\n const bodies = world.bodies;\n const max = this.aabbMax;\n const min = this.aabbMin;\n const nx = this.nx;\n const ny = this.ny;\n const nz = this.nz;\n const xstep = ny * nz;\n const ystep = nz;\n const zstep = 1;\n const xmax = max.x;\n const ymax = max.y;\n const zmax = max.z;\n const xmin = min.x;\n const ymin = min.y;\n const zmin = min.z;\n const xmult = nx / (xmax - xmin);\n const ymult = ny / (ymax - ymin);\n const zmult = nz / (zmax - zmin);\n const binsizeX = (xmax - xmin) / nx;\n const binsizeY = (ymax - ymin) / ny;\n const binsizeZ = (zmax - zmin) / nz;\n const binRadius = Math.sqrt(binsizeX * binsizeX + binsizeY * binsizeY + binsizeZ * binsizeZ) * 0.5;\n const types = Shape.types;\n const SPHERE = types.SPHERE;\n const PLANE = types.PLANE;\n types.BOX;\n types.COMPOUND;\n types.CONVEXPOLYHEDRON;\n const bins = this.bins;\n const binLengths = this.binLengths;\n const Nbins = this.bins.length; // Reset bins\n\n for (let i = 0; i !== Nbins; i++) {\n binLengths[i] = 0;\n }\n\n const ceil = Math.ceil;\n\n function addBoxToBins(x0, y0, z0, x1, y1, z1, bi) {\n let xoff0 = (x0 - xmin) * xmult | 0;\n let yoff0 = (y0 - ymin) * ymult | 0;\n let zoff0 = (z0 - zmin) * zmult | 0;\n let xoff1 = ceil((x1 - xmin) * xmult);\n let yoff1 = ceil((y1 - ymin) * ymult);\n let zoff1 = ceil((z1 - zmin) * zmult);\n\n if (xoff0 < 0) {\n xoff0 = 0;\n } else if (xoff0 >= nx) {\n xoff0 = nx - 1;\n }\n\n if (yoff0 < 0) {\n yoff0 = 0;\n } else if (yoff0 >= ny) {\n yoff0 = ny - 1;\n }\n\n if (zoff0 < 0) {\n zoff0 = 0;\n } else if (zoff0 >= nz) {\n zoff0 = nz - 1;\n }\n\n if (xoff1 < 0) {\n xoff1 = 0;\n } else if (xoff1 >= nx) {\n xoff1 = nx - 1;\n }\n\n if (yoff1 < 0) {\n yoff1 = 0;\n } else if (yoff1 >= ny) {\n yoff1 = ny - 1;\n }\n\n if (zoff1 < 0) {\n zoff1 = 0;\n } else if (zoff1 >= nz) {\n zoff1 = nz - 1;\n }\n\n xoff0 *= xstep;\n yoff0 *= ystep;\n zoff0 *= zstep;\n xoff1 *= xstep;\n yoff1 *= ystep;\n zoff1 *= zstep;\n\n for (let xoff = xoff0; xoff <= xoff1; xoff += xstep) {\n for (let yoff = yoff0; yoff <= yoff1; yoff += ystep) {\n for (let zoff = zoff0; zoff <= zoff1; zoff += zstep) {\n const idx = xoff + yoff + zoff;\n bins[idx][binLengths[idx]++] = bi;\n }\n }\n }\n } // Put all bodies into the bins\n\n\n for (let i = 0; i !== N; i++) {\n const bi = bodies[i];\n const si = bi.shapes[0];\n\n switch (si.type) {\n case SPHERE:\n {\n const shape = si; // Put in bin\n // check if overlap with other bins\n\n const x = bi.position.x;\n const y = bi.position.y;\n const z = bi.position.z;\n const r = shape.radius;\n addBoxToBins(x - r, y - r, z - r, x + r, y + r, z + r, bi);\n break;\n }\n\n case PLANE:\n {\n const shape = si;\n\n if (shape.worldNormalNeedsUpdate) {\n shape.computeWorldNormal(bi.quaternion);\n }\n\n const planeNormal = shape.worldNormal; //Relative position from origin of plane object to the first bin\n //Incremented as we iterate through the bins\n\n const xreset = xmin + binsizeX * 0.5 - bi.position.x;\n const yreset = ymin + binsizeY * 0.5 - bi.position.y;\n const zreset = zmin + binsizeZ * 0.5 - bi.position.z;\n const d = GridBroadphase_collisionPairs_d;\n d.set(xreset, yreset, zreset);\n\n for (let xi = 0, xoff = 0; xi !== nx; xi++, xoff += xstep, d.y = yreset, d.x += binsizeX) {\n for (let yi = 0, yoff = 0; yi !== ny; yi++, yoff += ystep, d.z = zreset, d.y += binsizeY) {\n for (let zi = 0, zoff = 0; zi !== nz; zi++, zoff += zstep, d.z += binsizeZ) {\n if (d.dot(planeNormal) < binRadius) {\n const idx = xoff + yoff + zoff;\n bins[idx][binLengths[idx]++] = bi;\n }\n }\n }\n }\n\n break;\n }\n\n default:\n {\n if (bi.aabbNeedsUpdate) {\n bi.updateAABB();\n }\n\n addBoxToBins(bi.aabb.lowerBound.x, bi.aabb.lowerBound.y, bi.aabb.lowerBound.z, bi.aabb.upperBound.x, bi.aabb.upperBound.y, bi.aabb.upperBound.z, bi);\n break;\n }\n }\n } // Check each bin\n\n\n for (let i = 0; i !== Nbins; i++) {\n const binLength = binLengths[i]; //Skip bins with no potential collisions\n\n if (binLength > 1) {\n const bin = bins[i]; // Do N^2 broadphase inside\n\n for (let xi = 0; xi !== binLength; xi++) {\n const bi = bin[xi];\n\n for (let yi = 0; yi !== xi; yi++) {\n const bj = bin[yi];\n\n if (this.needBroadphaseCollision(bi, bj)) {\n this.intersectionTest(bi, bj, pairs1, pairs2);\n }\n }\n }\n }\n } //\tfor (let zi = 0, zoff=0; zi < nz; zi++, zoff+= zstep) {\n //\t\tconsole.log(\"layer \"+zi);\n //\t\tfor (let yi = 0, yoff=0; yi < ny; yi++, yoff += ystep) {\n //\t\t\tconst row = '';\n //\t\t\tfor (let xi = 0, xoff=0; xi < nx; xi++, xoff += xstep) {\n //\t\t\t\tconst idx = xoff + yoff + zoff;\n //\t\t\t\trow += ' ' + binLengths[idx];\n //\t\t\t}\n //\t\t\tconsole.log(row);\n //\t\t}\n //\t}\n\n\n this.makePairsUnique(pairs1, pairs2);\n }\n\n}\nconst GridBroadphase_collisionPairs_d = new Vec3();\nnew Vec3();\n\n/**\n * Naive broadphase implementation, used in lack of better ones.\n *\n * The naive broadphase looks at all possible pairs without restriction, therefore it has complexity N^2 _(which is bad)_\n */\nclass NaiveBroadphase extends Broadphase {\n /**\n * @todo Remove useless constructor\n */\n constructor() {\n super();\n }\n /**\n * Get all the collision pairs in the physics world\n */\n\n\n collisionPairs(world, pairs1, pairs2) {\n const bodies = world.bodies;\n const n = bodies.length;\n let bi;\n let bj; // Naive N^2 ftw!\n\n for (let i = 0; i !== n; i++) {\n for (let j = 0; j !== i; j++) {\n bi = bodies[i];\n bj = bodies[j];\n\n if (!this.needBroadphaseCollision(bi, bj)) {\n continue;\n }\n\n this.intersectionTest(bi, bj, pairs1, pairs2);\n }\n }\n }\n /**\n * Returns all the bodies within an AABB.\n * @param result An array to store resulting bodies in.\n */\n\n\n aabbQuery(world, aabb, result) {\n if (result === void 0) {\n result = [];\n }\n\n for (let i = 0; i < world.bodies.length; i++) {\n const b = world.bodies[i];\n\n if (b.aabbNeedsUpdate) {\n b.updateAABB();\n } // Ugly hack until Body gets aabb\n\n\n if (b.aabb.overlaps(aabb)) {\n result.push(b);\n }\n }\n\n return result;\n }\n\n}\n\n/**\n * Storage for Ray casting data\n */\nclass RaycastResult {\n /**\n * rayFromWorld\n */\n\n /**\n * rayToWorld\n */\n\n /**\n * hitNormalWorld\n */\n\n /**\n * hitPointWorld\n */\n\n /**\n * hasHit\n */\n\n /**\n * shape\n */\n\n /**\n * body\n */\n\n /**\n * The index of the hit triangle, if the hit shape was a trimesh\n */\n\n /**\n * Distance to the hit. Will be set to -1 if there was no hit\n */\n\n /**\n * If the ray should stop traversing the bodies\n */\n constructor() {\n this.rayFromWorld = new Vec3();\n this.rayToWorld = new Vec3();\n this.hitNormalWorld = new Vec3();\n this.hitPointWorld = new Vec3();\n this.hasHit = false;\n this.shape = null;\n this.body = null;\n this.hitFaceIndex = -1;\n this.distance = -1;\n this.shouldStop = false;\n }\n /**\n * Reset all result data.\n */\n\n\n reset() {\n this.rayFromWorld.setZero();\n this.rayToWorld.setZero();\n this.hitNormalWorld.setZero();\n this.hitPointWorld.setZero();\n this.hasHit = false;\n this.shape = null;\n this.body = null;\n this.hitFaceIndex = -1;\n this.distance = -1;\n this.shouldStop = false;\n }\n /**\n * abort\n */\n\n\n abort() {\n this.shouldStop = true;\n }\n /**\n * Set result data.\n */\n\n\n set(rayFromWorld, rayToWorld, hitNormalWorld, hitPointWorld, shape, body, distance) {\n this.rayFromWorld.copy(rayFromWorld);\n this.rayToWorld.copy(rayToWorld);\n this.hitNormalWorld.copy(hitNormalWorld);\n this.hitPointWorld.copy(hitPointWorld);\n this.shape = shape;\n this.body = body;\n this.distance = distance;\n }\n\n}\n\nlet _Shape$types$SPHERE, _Shape$types$PLANE, _Shape$types$BOX, _Shape$types$CYLINDER, _Shape$types$CONVEXPO, _Shape$types$HEIGHTFI, _Shape$types$TRIMESH;\n\n/**\n * RAY_MODES\n */\nconst RAY_MODES = {\n /** CLOSEST */\n CLOSEST: 1,\n\n /** ANY */\n ANY: 2,\n\n /** ALL */\n ALL: 4\n};\n/**\n * RayMode\n */\n\n_Shape$types$SPHERE = Shape.types.SPHERE;\n_Shape$types$PLANE = Shape.types.PLANE;\n_Shape$types$BOX = Shape.types.BOX;\n_Shape$types$CYLINDER = Shape.types.CYLINDER;\n_Shape$types$CONVEXPO = Shape.types.CONVEXPOLYHEDRON;\n_Shape$types$HEIGHTFI = Shape.types.HEIGHTFIELD;\n_Shape$types$TRIMESH = Shape.types.TRIMESH;\n\n/**\n * A line in 3D space that intersects bodies and return points.\n */\nclass Ray {\n /**\n * from\n */\n\n /**\n * to\n */\n\n /**\n * direction\n */\n\n /**\n * The precision of the ray. Used when checking parallelity etc.\n * @default 0.0001\n */\n\n /**\n * Set to `false` if you don't want the Ray to take `collisionResponse` flags into account on bodies and shapes.\n * @default true\n */\n\n /**\n * If set to `true`, the ray skips any hits with normal.dot(rayDirection) < 0.\n * @default false\n */\n\n /**\n * collisionFilterMask\n * @default -1\n */\n\n /**\n * collisionFilterGroup\n * @default -1\n */\n\n /**\n * The intersection mode. Should be Ray.ANY, Ray.ALL or Ray.CLOSEST.\n * @default RAY.ANY\n */\n\n /**\n * Current result object.\n */\n\n /**\n * Will be set to `true` during intersectWorld() if the ray hit anything.\n */\n\n /**\n * User-provided result callback. Will be used if mode is Ray.ALL.\n */\n\n /**\n * CLOSEST\n */\n\n /**\n * ANY\n */\n\n /**\n * ALL\n */\n get [_Shape$types$SPHERE]() {\n return this._intersectSphere;\n }\n\n get [_Shape$types$PLANE]() {\n return this._intersectPlane;\n }\n\n get [_Shape$types$BOX]() {\n return this._intersectBox;\n }\n\n get [_Shape$types$CYLINDER]() {\n return this._intersectConvex;\n }\n\n get [_Shape$types$CONVEXPO]() {\n return this._intersectConvex;\n }\n\n get [_Shape$types$HEIGHTFI]() {\n return this._intersectHeightfield;\n }\n\n get [_Shape$types$TRIMESH]() {\n return this._intersectTrimesh;\n }\n\n constructor(from, to) {\n if (from === void 0) {\n from = new Vec3();\n }\n\n if (to === void 0) {\n to = new Vec3();\n }\n\n this.from = from.clone();\n this.to = to.clone();\n this.direction = new Vec3();\n this.precision = 0.0001;\n this.checkCollisionResponse = true;\n this.skipBackfaces = false;\n this.collisionFilterMask = -1;\n this.collisionFilterGroup = -1;\n this.mode = Ray.ANY;\n this.result = new RaycastResult();\n this.hasHit = false;\n\n this.callback = result => {};\n }\n /**\n * Do itersection against all bodies in the given World.\n * @return True if the ray hit anything, otherwise false.\n */\n\n\n intersectWorld(world, options) {\n this.mode = options.mode || Ray.ANY;\n this.result = options.result || new RaycastResult();\n this.skipBackfaces = !!options.skipBackfaces;\n this.collisionFilterMask = typeof options.collisionFilterMask !== 'undefined' ? options.collisionFilterMask : -1;\n this.collisionFilterGroup = typeof options.collisionFilterGroup !== 'undefined' ? options.collisionFilterGroup : -1;\n this.checkCollisionResponse = typeof options.checkCollisionResponse !== 'undefined' ? options.checkCollisionResponse : true;\n\n if (options.from) {\n this.from.copy(options.from);\n }\n\n if (options.to) {\n this.to.copy(options.to);\n }\n\n this.callback = options.callback || (() => {});\n\n this.hasHit = false;\n this.result.reset();\n this.updateDirection();\n this.getAABB(tmpAABB$1);\n tmpArray.length = 0;\n world.broadphase.aabbQuery(world, tmpAABB$1, tmpArray);\n this.intersectBodies(tmpArray);\n return this.hasHit;\n }\n /**\n * Shoot a ray at a body, get back information about the hit.\n * @deprecated @param result set the result property of the Ray instead.\n */\n\n\n intersectBody(body, result) {\n if (result) {\n this.result = result;\n this.updateDirection();\n }\n\n const checkCollisionResponse = this.checkCollisionResponse;\n\n if (checkCollisionResponse && !body.collisionResponse) {\n return;\n }\n\n if ((this.collisionFilterGroup & body.collisionFilterMask) === 0 || (body.collisionFilterGroup & this.collisionFilterMask) === 0) {\n return;\n }\n\n const xi = intersectBody_xi;\n const qi = intersectBody_qi;\n\n for (let i = 0, N = body.shapes.length; i < N; i++) {\n const shape = body.shapes[i];\n\n if (checkCollisionResponse && !shape.collisionResponse) {\n continue; // Skip\n }\n\n body.quaternion.mult(body.shapeOrientations[i], qi);\n body.quaternion.vmult(body.shapeOffsets[i], xi);\n xi.vadd(body.position, xi);\n this.intersectShape(shape, qi, xi, body);\n\n if (this.result.shouldStop) {\n break;\n }\n }\n }\n /**\n * Shoot a ray at an array bodies, get back information about the hit.\n * @param bodies An array of Body objects.\n * @deprecated @param result set the result property of the Ray instead.\n *\n */\n\n\n intersectBodies(bodies, result) {\n if (result) {\n this.result = result;\n this.updateDirection();\n }\n\n for (let i = 0, l = bodies.length; !this.result.shouldStop && i < l; i++) {\n this.intersectBody(bodies[i]);\n }\n }\n /**\n * Updates the direction vector.\n */\n\n\n updateDirection() {\n this.to.vsub(this.from, this.direction);\n this.direction.normalize();\n }\n\n intersectShape(shape, quat, position, body) {\n const from = this.from; // Checking boundingSphere\n\n const distance = distanceFromIntersection(from, this.direction, position);\n\n if (distance > shape.boundingSphereRadius) {\n return;\n }\n\n const intersectMethod = this[shape.type];\n\n if (intersectMethod) {\n intersectMethod.call(this, shape, quat, position, body, shape);\n }\n }\n\n _intersectBox(box, quat, position, body, reportedShape) {\n return this._intersectConvex(box.convexPolyhedronRepresentation, quat, position, body, reportedShape);\n }\n\n _intersectPlane(shape, quat, position, body, reportedShape) {\n const from = this.from;\n const to = this.to;\n const direction = this.direction; // Get plane normal\n\n const worldNormal = new Vec3(0, 0, 1);\n quat.vmult(worldNormal, worldNormal);\n const len = new Vec3();\n from.vsub(position, len);\n const planeToFrom = len.dot(worldNormal);\n to.vsub(position, len);\n const planeToTo = len.dot(worldNormal);\n\n if (planeToFrom * planeToTo > 0) {\n // \"from\" and \"to\" are on the same side of the plane... bail out\n return;\n }\n\n if (from.distanceTo(to) < planeToFrom) {\n return;\n }\n\n const n_dot_dir = worldNormal.dot(direction);\n\n if (Math.abs(n_dot_dir) < this.precision) {\n // No intersection\n return;\n }\n\n const planePointToFrom = new Vec3();\n const dir_scaled_with_t = new Vec3();\n const hitPointWorld = new Vec3();\n from.vsub(position, planePointToFrom);\n const t = -worldNormal.dot(planePointToFrom) / n_dot_dir;\n direction.scale(t, dir_scaled_with_t);\n from.vadd(dir_scaled_with_t, hitPointWorld);\n this.reportIntersection(worldNormal, hitPointWorld, reportedShape, body, -1);\n }\n /**\n * Get the world AABB of the ray.\n */\n\n\n getAABB(aabb) {\n const {\n lowerBound,\n upperBound\n } = aabb;\n const to = this.to;\n const from = this.from;\n lowerBound.x = Math.min(to.x, from.x);\n lowerBound.y = Math.min(to.y, from.y);\n lowerBound.z = Math.min(to.z, from.z);\n upperBound.x = Math.max(to.x, from.x);\n upperBound.y = Math.max(to.y, from.y);\n upperBound.z = Math.max(to.z, from.z);\n }\n\n _intersectHeightfield(shape, quat, position, body, reportedShape) {\n shape.data;\n shape.elementSize; // Convert the ray to local heightfield coordinates\n\n const localRay = intersectHeightfield_localRay; //new Ray(this.from, this.to);\n\n localRay.from.copy(this.from);\n localRay.to.copy(this.to);\n Transform.pointToLocalFrame(position, quat, localRay.from, localRay.from);\n Transform.pointToLocalFrame(position, quat, localRay.to, localRay.to);\n localRay.updateDirection(); // Get the index of the data points to test against\n\n const index = intersectHeightfield_index;\n let iMinX;\n let iMinY;\n let iMaxX;\n let iMaxY; // Set to max\n\n iMinX = iMinY = 0;\n iMaxX = iMaxY = shape.data.length - 1;\n const aabb = new AABB();\n localRay.getAABB(aabb);\n shape.getIndexOfPosition(aabb.lowerBound.x, aabb.lowerBound.y, index, true);\n iMinX = Math.max(iMinX, index[0]);\n iMinY = Math.max(iMinY, index[1]);\n shape.getIndexOfPosition(aabb.upperBound.x, aabb.upperBound.y, index, true);\n iMaxX = Math.min(iMaxX, index[0] + 1);\n iMaxY = Math.min(iMaxY, index[1] + 1);\n\n for (let i = iMinX; i < iMaxX; i++) {\n for (let j = iMinY; j < iMaxY; j++) {\n if (this.result.shouldStop) {\n return;\n }\n\n shape.getAabbAtIndex(i, j, aabb);\n\n if (!aabb.overlapsRay(localRay)) {\n continue;\n } // Lower triangle\n\n\n shape.getConvexTrianglePillar(i, j, false);\n Transform.pointToWorldFrame(position, quat, shape.pillarOffset, worldPillarOffset);\n\n this._intersectConvex(shape.pillarConvex, quat, worldPillarOffset, body, reportedShape, intersectConvexOptions);\n\n if (this.result.shouldStop) {\n return;\n } // Upper triangle\n\n\n shape.getConvexTrianglePillar(i, j, true);\n Transform.pointToWorldFrame(position, quat, shape.pillarOffset, worldPillarOffset);\n\n this._intersectConvex(shape.pillarConvex, quat, worldPillarOffset, body, reportedShape, intersectConvexOptions);\n }\n }\n }\n\n _intersectSphere(sphere, quat, position, body, reportedShape) {\n const from = this.from;\n const to = this.to;\n const r = sphere.radius;\n const a = (to.x - from.x) ** 2 + (to.y - from.y) ** 2 + (to.z - from.z) ** 2;\n const b = 2 * ((to.x - from.x) * (from.x - position.x) + (to.y - from.y) * (from.y - position.y) + (to.z - from.z) * (from.z - position.z));\n const c = (from.x - position.x) ** 2 + (from.y - position.y) ** 2 + (from.z - position.z) ** 2 - r ** 2;\n const delta = b ** 2 - 4 * a * c;\n const intersectionPoint = Ray_intersectSphere_intersectionPoint;\n const normal = Ray_intersectSphere_normal;\n\n if (delta < 0) {\n // No intersection\n return;\n } else if (delta === 0) {\n // single intersection point\n from.lerp(to, delta, intersectionPoint);\n intersectionPoint.vsub(position, normal);\n normal.normalize();\n this.reportIntersection(normal, intersectionPoint, reportedShape, body, -1);\n } else {\n const d1 = (-b - Math.sqrt(delta)) / (2 * a);\n const d2 = (-b + Math.sqrt(delta)) / (2 * a);\n\n if (d1 >= 0 && d1 <= 1) {\n from.lerp(to, d1, intersectionPoint);\n intersectionPoint.vsub(position, normal);\n normal.normalize();\n this.reportIntersection(normal, intersectionPoint, reportedShape, body, -1);\n }\n\n if (this.result.shouldStop) {\n return;\n }\n\n if (d2 >= 0 && d2 <= 1) {\n from.lerp(to, d2, intersectionPoint);\n intersectionPoint.vsub(position, normal);\n normal.normalize();\n this.reportIntersection(normal, intersectionPoint, reportedShape, body, -1);\n }\n }\n }\n\n _intersectConvex(shape, quat, position, body, reportedShape, options) {\n intersectConvex_minDistNormal;\n const normal = intersectConvex_normal;\n const vector = intersectConvex_vector;\n intersectConvex_minDistIntersect;\n const faceList = options && options.faceList || null; // Checking faces\n\n const faces = shape.faces;\n const vertices = shape.vertices;\n const normals = shape.faceNormals;\n const direction = this.direction;\n const from = this.from;\n const to = this.to;\n const fromToDistance = from.distanceTo(to);\n const Nfaces = faceList ? faceList.length : faces.length;\n const result = this.result;\n\n for (let j = 0; !result.shouldStop && j < Nfaces; j++) {\n const fi = faceList ? faceList[j] : j;\n const face = faces[fi];\n const faceNormal = normals[fi];\n const q = quat;\n const x = position; // determine if ray intersects the plane of the face\n // note: this works regardless of the direction of the face normal\n // Get plane point in world coordinates...\n\n vector.copy(vertices[face[0]]);\n q.vmult(vector, vector);\n vector.vadd(x, vector); // ...but make it relative to the ray from. We'll fix this later.\n\n vector.vsub(from, vector); // Get plane normal\n\n q.vmult(faceNormal, normal); // If this dot product is negative, we have something interesting\n\n const dot = direction.dot(normal); // Bail out if ray and plane are parallel\n\n if (Math.abs(dot) < this.precision) {\n continue;\n } // calc distance to plane\n\n\n const scalar = normal.dot(vector) / dot; // if negative distance, then plane is behind ray\n\n if (scalar < 0) {\n continue;\n } // if (dot < 0) {\n // Intersection point is from + direction * scalar\n\n\n direction.scale(scalar, intersectPoint);\n intersectPoint.vadd(from, intersectPoint); // a is the point we compare points b and c with.\n\n a.copy(vertices[face[0]]);\n q.vmult(a, a);\n x.vadd(a, a);\n\n for (let i = 1; !result.shouldStop && i < face.length - 1; i++) {\n // Transform 3 vertices to world coords\n b.copy(vertices[face[i]]);\n c.copy(vertices[face[i + 1]]);\n q.vmult(b, b);\n q.vmult(c, c);\n x.vadd(b, b);\n x.vadd(c, c);\n const distance = intersectPoint.distanceTo(from);\n\n if (!(Ray.pointInTriangle(intersectPoint, a, b, c) || Ray.pointInTriangle(intersectPoint, b, a, c)) || distance > fromToDistance) {\n continue;\n }\n\n this.reportIntersection(normal, intersectPoint, reportedShape, body, fi);\n } // }\n\n }\n }\n /**\n * @todo Optimize by transforming the world to local space first.\n * @todo Use Octree lookup\n */\n\n\n _intersectTrimesh(mesh, quat, position, body, reportedShape, options) {\n const normal = intersectTrimesh_normal;\n const triangles = intersectTrimesh_triangles;\n const treeTransform = intersectTrimesh_treeTransform;\n const vector = intersectConvex_vector;\n const localDirection = intersectTrimesh_localDirection;\n const localFrom = intersectTrimesh_localFrom;\n const localTo = intersectTrimesh_localTo;\n const worldIntersectPoint = intersectTrimesh_worldIntersectPoint;\n const worldNormal = intersectTrimesh_worldNormal; // Checking faces\n\n const indices = mesh.indices;\n mesh.vertices; // const normals = mesh.faceNormals\n\n const from = this.from;\n const to = this.to;\n const direction = this.direction;\n treeTransform.position.copy(position);\n treeTransform.quaternion.copy(quat); // Transform ray to local space!\n\n Transform.vectorToLocalFrame(position, quat, direction, localDirection);\n Transform.pointToLocalFrame(position, quat, from, localFrom);\n Transform.pointToLocalFrame(position, quat, to, localTo);\n localTo.x *= mesh.scale.x;\n localTo.y *= mesh.scale.y;\n localTo.z *= mesh.scale.z;\n localFrom.x *= mesh.scale.x;\n localFrom.y *= mesh.scale.y;\n localFrom.z *= mesh.scale.z;\n localTo.vsub(localFrom, localDirection);\n localDirection.normalize();\n const fromToDistanceSquared = localFrom.distanceSquared(localTo);\n mesh.tree.rayQuery(this, treeTransform, triangles);\n\n for (let i = 0, N = triangles.length; !this.result.shouldStop && i !== N; i++) {\n const trianglesIndex = triangles[i];\n mesh.getNormal(trianglesIndex, normal); // determine if ray intersects the plane of the face\n // note: this works regardless of the direction of the face normal\n // Get plane point in world coordinates...\n\n mesh.getVertex(indices[trianglesIndex * 3], a); // ...but make it relative to the ray from. We'll fix this later.\n\n a.vsub(localFrom, vector); // If this dot product is negative, we have something interesting\n\n const dot = localDirection.dot(normal); // Bail out if ray and plane are parallel\n // if (Math.abs( dot ) < this.precision){\n // continue;\n // }\n // calc distance to plane\n\n const scalar = normal.dot(vector) / dot; // if negative distance, then plane is behind ray\n\n if (scalar < 0) {\n continue;\n } // Intersection point is from + direction * scalar\n\n\n localDirection.scale(scalar, intersectPoint);\n intersectPoint.vadd(localFrom, intersectPoint); // Get triangle vertices\n\n mesh.getVertex(indices[trianglesIndex * 3 + 1], b);\n mesh.getVertex(indices[trianglesIndex * 3 + 2], c);\n const squaredDistance = intersectPoint.distanceSquared(localFrom);\n\n if (!(Ray.pointInTriangle(intersectPoint, b, a, c) || Ray.pointInTriangle(intersectPoint, a, b, c)) || squaredDistance > fromToDistanceSquared) {\n continue;\n } // transform intersectpoint and normal to world\n\n\n Transform.vectorToWorldFrame(quat, normal, worldNormal);\n Transform.pointToWorldFrame(position, quat, intersectPoint, worldIntersectPoint);\n this.reportIntersection(worldNormal, worldIntersectPoint, reportedShape, body, trianglesIndex);\n }\n\n triangles.length = 0;\n }\n /**\n * @return True if the intersections should continue\n */\n\n\n reportIntersection(normal, hitPointWorld, shape, body, hitFaceIndex) {\n const from = this.from;\n const to = this.to;\n const distance = from.distanceTo(hitPointWorld);\n const result = this.result; // Skip back faces?\n\n if (this.skipBackfaces && normal.dot(this.direction) > 0) {\n return;\n }\n\n result.hitFaceIndex = typeof hitFaceIndex !== 'undefined' ? hitFaceIndex : -1;\n\n switch (this.mode) {\n case Ray.ALL:\n this.hasHit = true;\n result.set(from, to, normal, hitPointWorld, shape, body, distance);\n result.hasHit = true;\n this.callback(result);\n break;\n\n case Ray.CLOSEST:\n // Store if closer than current closest\n if (distance < result.distance || !result.hasHit) {\n this.hasHit = true;\n result.hasHit = true;\n result.set(from, to, normal, hitPointWorld, shape, body, distance);\n }\n\n break;\n\n case Ray.ANY:\n // Report and stop.\n this.hasHit = true;\n result.hasHit = true;\n result.set(from, to, normal, hitPointWorld, shape, body, distance);\n result.shouldStop = true;\n break;\n }\n }\n /**\n * As per \"Barycentric Technique\" as named\n * {@link https://www.blackpawn.com/texts/pointinpoly/default.html here} but without the division\n */\n\n\n static pointInTriangle(p, a, b, c) {\n c.vsub(a, v0);\n b.vsub(a, v1);\n p.vsub(a, v2);\n const dot00 = v0.dot(v0);\n const dot01 = v0.dot(v1);\n const dot02 = v0.dot(v2);\n const dot11 = v1.dot(v1);\n const dot12 = v1.dot(v2);\n let u;\n let v;\n return (u = dot11 * dot02 - dot01 * dot12) >= 0 && (v = dot00 * dot12 - dot01 * dot02) >= 0 && u + v < dot00 * dot11 - dot01 * dot01;\n }\n\n}\nRay.CLOSEST = RAY_MODES.CLOSEST;\nRay.ANY = RAY_MODES.ANY;\nRay.ALL = RAY_MODES.ALL;\nconst tmpAABB$1 = new AABB();\nconst tmpArray = [];\nconst v1 = new Vec3();\nconst v2 = new Vec3();\nconst intersectBody_xi = new Vec3();\nconst intersectBody_qi = new Quaternion();\nconst intersectPoint = new Vec3();\nconst a = new Vec3();\nconst b = new Vec3();\nconst c = new Vec3();\nnew Vec3();\nnew RaycastResult();\nconst intersectConvexOptions = {\n faceList: [0]\n};\nconst worldPillarOffset = new Vec3();\nconst intersectHeightfield_localRay = new Ray();\nconst intersectHeightfield_index = [];\nconst Ray_intersectSphere_intersectionPoint = new Vec3();\nconst Ray_intersectSphere_normal = new Vec3();\nconst intersectConvex_normal = new Vec3();\nconst intersectConvex_minDistNormal = new Vec3();\nconst intersectConvex_minDistIntersect = new Vec3();\nconst intersectConvex_vector = new Vec3();\nconst intersectTrimesh_normal = new Vec3();\nconst intersectTrimesh_localDirection = new Vec3();\nconst intersectTrimesh_localFrom = new Vec3();\nconst intersectTrimesh_localTo = new Vec3();\nconst intersectTrimesh_worldNormal = new Vec3();\nconst intersectTrimesh_worldIntersectPoint = new Vec3();\nnew AABB();\nconst intersectTrimesh_triangles = [];\nconst intersectTrimesh_treeTransform = new Transform();\nconst v0 = new Vec3();\nconst intersect = new Vec3();\n\nfunction distanceFromIntersection(from, direction, position) {\n // v0 is vector from from to position\n position.vsub(from, v0);\n const dot = v0.dot(direction); // intersect = direction*dot + from\n\n direction.scale(dot, intersect);\n intersect.vadd(from, intersect);\n const distance = position.distanceTo(intersect);\n return distance;\n}\n\n/**\n * Sweep and prune broadphase along one axis.\n */\nclass SAPBroadphase extends Broadphase {\n /**\n * List of bodies currently in the broadphase.\n */\n\n /**\n * The world to search in.\n */\n\n /**\n * Axis to sort the bodies along.\n * Set to 0 for x axis, and 1 for y axis.\n * For best performance, pick the axis where bodies are most distributed.\n */\n\n /**\n * Check if the bounds of two bodies overlap, along the given SAP axis.\n */\n static checkBounds(bi, bj, axisIndex) {\n let biPos;\n let bjPos;\n\n if (axisIndex === 0) {\n biPos = bi.position.x;\n bjPos = bj.position.x;\n } else if (axisIndex === 1) {\n biPos = bi.position.y;\n bjPos = bj.position.y;\n } else if (axisIndex === 2) {\n biPos = bi.position.z;\n bjPos = bj.position.z;\n }\n\n const ri = bi.boundingRadius,\n rj = bj.boundingRadius,\n boundA2 = biPos + ri,\n boundB1 = bjPos - rj;\n return boundB1 < boundA2;\n } // Note: these are identical, save for x/y/z lowerbound\n\n /**\n * insertionSortX\n */\n\n\n static insertionSortX(a) {\n for (let i = 1, l = a.length; i < l; i++) {\n const v = a[i];\n let j;\n\n for (j = i - 1; j >= 0; j--) {\n if (a[j].aabb.lowerBound.x <= v.aabb.lowerBound.x) {\n break;\n }\n\n a[j + 1] = a[j];\n }\n\n a[j + 1] = v;\n }\n\n return a;\n }\n /**\n * insertionSortY\n */\n\n\n static insertionSortY(a) {\n for (let i = 1, l = a.length; i < l; i++) {\n const v = a[i];\n let j;\n\n for (j = i - 1; j >= 0; j--) {\n if (a[j].aabb.lowerBound.y <= v.aabb.lowerBound.y) {\n break;\n }\n\n a[j + 1] = a[j];\n }\n\n a[j + 1] = v;\n }\n\n return a;\n }\n /**\n * insertionSortZ\n */\n\n\n static insertionSortZ(a) {\n for (let i = 1, l = a.length; i < l; i++) {\n const v = a[i];\n let j;\n\n for (j = i - 1; j >= 0; j--) {\n if (a[j].aabb.lowerBound.z <= v.aabb.lowerBound.z) {\n break;\n }\n\n a[j + 1] = a[j];\n }\n\n a[j + 1] = v;\n }\n\n return a;\n }\n\n constructor(world) {\n super();\n this.axisList = [];\n this.world = null;\n this.axisIndex = 0;\n const axisList = this.axisList;\n\n this._addBodyHandler = event => {\n axisList.push(event.body);\n };\n\n this._removeBodyHandler = event => {\n const idx = axisList.indexOf(event.body);\n\n if (idx !== -1) {\n axisList.splice(idx, 1);\n }\n };\n\n if (world) {\n this.setWorld(world);\n }\n }\n /**\n * Change the world\n */\n\n\n setWorld(world) {\n // Clear the old axis array\n this.axisList.length = 0; // Add all bodies from the new world\n\n for (let i = 0; i < world.bodies.length; i++) {\n this.axisList.push(world.bodies[i]);\n } // Remove old handlers, if any\n\n\n world.removeEventListener('addBody', this._addBodyHandler);\n world.removeEventListener('removeBody', this._removeBodyHandler); // Add handlers to update the list of bodies.\n\n world.addEventListener('addBody', this._addBodyHandler);\n world.addEventListener('removeBody', this._removeBodyHandler);\n this.world = world;\n this.dirty = true;\n }\n /**\n * Collect all collision pairs\n */\n\n\n collisionPairs(world, p1, p2) {\n const bodies = this.axisList;\n const N = bodies.length;\n const axisIndex = this.axisIndex;\n let i;\n let j;\n\n if (this.dirty) {\n this.sortList();\n this.dirty = false;\n } // Look through the list\n\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n for (j = i + 1; j < N; j++) {\n const bj = bodies[j];\n\n if (!this.needBroadphaseCollision(bi, bj)) {\n continue;\n }\n\n if (!SAPBroadphase.checkBounds(bi, bj, axisIndex)) {\n break;\n }\n\n this.intersectionTest(bi, bj, p1, p2);\n }\n }\n }\n\n sortList() {\n const axisList = this.axisList;\n const axisIndex = this.axisIndex;\n const N = axisList.length; // Update AABBs\n\n for (let i = 0; i !== N; i++) {\n const bi = axisList[i];\n\n if (bi.aabbNeedsUpdate) {\n bi.updateAABB();\n }\n } // Sort the list\n\n\n if (axisIndex === 0) {\n SAPBroadphase.insertionSortX(axisList);\n } else if (axisIndex === 1) {\n SAPBroadphase.insertionSortY(axisList);\n } else if (axisIndex === 2) {\n SAPBroadphase.insertionSortZ(axisList);\n }\n }\n /**\n * Computes the variance of the body positions and estimates the best axis to use.\n * Will automatically set property `axisIndex`.\n */\n\n\n autoDetectAxis() {\n let sumX = 0;\n let sumX2 = 0;\n let sumY = 0;\n let sumY2 = 0;\n let sumZ = 0;\n let sumZ2 = 0;\n const bodies = this.axisList;\n const N = bodies.length;\n const invN = 1 / N;\n\n for (let i = 0; i !== N; i++) {\n const b = bodies[i];\n const centerX = b.position.x;\n sumX += centerX;\n sumX2 += centerX * centerX;\n const centerY = b.position.y;\n sumY += centerY;\n sumY2 += centerY * centerY;\n const centerZ = b.position.z;\n sumZ += centerZ;\n sumZ2 += centerZ * centerZ;\n }\n\n const varianceX = sumX2 - sumX * sumX * invN;\n const varianceY = sumY2 - sumY * sumY * invN;\n const varianceZ = sumZ2 - sumZ * sumZ * invN;\n\n if (varianceX > varianceY) {\n if (varianceX > varianceZ) {\n this.axisIndex = 0;\n } else {\n this.axisIndex = 2;\n }\n } else if (varianceY > varianceZ) {\n this.axisIndex = 1;\n } else {\n this.axisIndex = 2;\n }\n }\n /**\n * Returns all the bodies within an AABB.\n * @param result An array to store resulting bodies in.\n */\n\n\n aabbQuery(world, aabb, result) {\n if (result === void 0) {\n result = [];\n }\n\n if (this.dirty) {\n this.sortList();\n this.dirty = false;\n }\n\n const axisIndex = this.axisIndex;\n let axis = 'x';\n\n if (axisIndex === 1) {\n axis = 'y';\n }\n\n if (axisIndex === 2) {\n axis = 'z';\n }\n\n const axisList = this.axisList;\n aabb.lowerBound[axis];\n aabb.upperBound[axis];\n\n for (let i = 0; i < axisList.length; i++) {\n const b = axisList[i];\n\n if (b.aabbNeedsUpdate) {\n b.updateAABB();\n }\n\n if (b.aabb.overlaps(aabb)) {\n result.push(b);\n }\n }\n\n return result;\n }\n\n}\n\nclass Utils {\n /**\n * Extend an options object with default values.\n * @param options The options object. May be falsy: in this case, a new object is created and returned.\n * @param defaults An object containing default values.\n * @return The modified options object.\n */\n static defaults(options, defaults) {\n if (options === void 0) {\n options = {};\n }\n\n for (let key in defaults) {\n if (!(key in options)) {\n options[key] = defaults[key];\n }\n }\n\n return options;\n }\n\n}\n\n/**\n * Constraint base class\n */\nclass Constraint {\n /**\n * Equations to be solved in this constraint.\n */\n\n /**\n * Body A.\n */\n\n /**\n * Body B.\n */\n\n /**\n * Set to false if you don't want the bodies to collide when they are connected.\n */\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n options = Utils.defaults(options, {\n collideConnected: true,\n wakeUpBodies: true\n });\n this.equations = [];\n this.bodyA = bodyA;\n this.bodyB = bodyB;\n this.id = Constraint.idCounter++;\n this.collideConnected = options.collideConnected;\n\n if (options.wakeUpBodies) {\n if (bodyA) {\n bodyA.wakeUp();\n }\n\n if (bodyB) {\n bodyB.wakeUp();\n }\n }\n }\n /**\n * Update all the equations with data.\n */\n\n\n update() {\n throw new Error('method update() not implmemented in this Constraint subclass!');\n }\n /**\n * Enables all equations in the constraint.\n */\n\n\n enable() {\n const eqs = this.equations;\n\n for (let i = 0; i < eqs.length; i++) {\n eqs[i].enabled = true;\n }\n }\n /**\n * Disables all equations in the constraint.\n */\n\n\n disable() {\n const eqs = this.equations;\n\n for (let i = 0; i < eqs.length; i++) {\n eqs[i].enabled = false;\n }\n }\n\n}\nConstraint.idCounter = 0;\n\n/**\n * An element containing 6 entries, 3 spatial and 3 rotational degrees of freedom.\n */\n\nclass JacobianElement {\n /**\n * spatial\n */\n\n /**\n * rotational\n */\n constructor() {\n this.spatial = new Vec3();\n this.rotational = new Vec3();\n }\n /**\n * Multiply with other JacobianElement\n */\n\n\n multiplyElement(element) {\n return element.spatial.dot(this.spatial) + element.rotational.dot(this.rotational);\n }\n /**\n * Multiply with two vectors\n */\n\n\n multiplyVectors(spatial, rotational) {\n return spatial.dot(this.spatial) + rotational.dot(this.rotational);\n }\n\n}\n\n/**\n * Equation base class.\n *\n * `a`, `b` and `eps` are {@link https://www8.cs.umu.se/kurser/5DV058/VT15/lectures/SPOOKlabnotes.pdf SPOOK} parameters that default to `0.0`. See {@link https://github.com/schteppe/cannon.js/issues/238#issuecomment-147172327 this exchange} for more details on Cannon's physics implementation.\n */\nclass Equation {\n /**\n * Minimum (read: negative max) force to be applied by the constraint.\n */\n\n /**\n * Maximum (read: positive max) force to be applied by the constraint.\n */\n\n /**\n * SPOOK parameter\n */\n\n /**\n * SPOOK parameter\n */\n\n /**\n * SPOOK parameter\n */\n\n /**\n * A number, proportional to the force added to the bodies.\n */\n constructor(bi, bj, minForce, maxForce) {\n if (minForce === void 0) {\n minForce = -1e6;\n }\n\n if (maxForce === void 0) {\n maxForce = 1e6;\n }\n\n this.id = Equation.idCounter++;\n this.minForce = minForce;\n this.maxForce = maxForce;\n this.bi = bi;\n this.bj = bj;\n this.a = 0.0; // SPOOK parameter\n\n this.b = 0.0; // SPOOK parameter\n\n this.eps = 0.0; // SPOOK parameter\n\n this.jacobianElementA = new JacobianElement();\n this.jacobianElementB = new JacobianElement();\n this.enabled = true;\n this.multiplier = 0;\n this.setSpookParams(1e7, 4, 1 / 60); // Set typical spook params\n }\n /**\n * Recalculates a, b, and eps.\n *\n * The Equation constructor sets typical SPOOK parameters as such:\n * * `stiffness` = 1e7\n * * `relaxation` = 4\n * * `timeStep`= 1 / 60, _note the hardcoded refresh rate._\n */\n\n\n setSpookParams(stiffness, relaxation, timeStep) {\n const d = relaxation;\n const k = stiffness;\n const h = timeStep;\n this.a = 4.0 / (h * (1 + 4 * d));\n this.b = 4.0 * d / (1 + 4 * d);\n this.eps = 4.0 / (h * h * k * (1 + 4 * d));\n }\n /**\n * Computes the right hand side of the SPOOK equation\n */\n\n\n computeB(a, b, h) {\n const GW = this.computeGW();\n const Gq = this.computeGq();\n const GiMf = this.computeGiMf();\n return -Gq * a - GW * b - GiMf * h;\n }\n /**\n * Computes G*q, where q are the generalized body coordinates\n */\n\n\n computeGq() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const xi = bi.position;\n const xj = bj.position;\n return GA.spatial.dot(xi) + GB.spatial.dot(xj);\n }\n /**\n * Computes G*W, where W are the body velocities\n */\n\n\n computeGW() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const vi = bi.velocity;\n const vj = bj.velocity;\n const wi = bi.angularVelocity;\n const wj = bj.angularVelocity;\n return GA.multiplyVectors(vi, wi) + GB.multiplyVectors(vj, wj);\n }\n /**\n * Computes G*Wlambda, where W are the body velocities\n */\n\n\n computeGWlambda() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const vi = bi.vlambda;\n const vj = bj.vlambda;\n const wi = bi.wlambda;\n const wj = bj.wlambda;\n return GA.multiplyVectors(vi, wi) + GB.multiplyVectors(vj, wj);\n }\n /**\n * Computes G*inv(M)*f, where M is the mass matrix with diagonal blocks for each body, and f are the forces on the bodies.\n */\n\n\n computeGiMf() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const fi = bi.force;\n const ti = bi.torque;\n const fj = bj.force;\n const tj = bj.torque;\n const invMassi = bi.invMassSolve;\n const invMassj = bj.invMassSolve;\n fi.scale(invMassi, iMfi);\n fj.scale(invMassj, iMfj);\n bi.invInertiaWorldSolve.vmult(ti, invIi_vmult_taui);\n bj.invInertiaWorldSolve.vmult(tj, invIj_vmult_tauj);\n return GA.multiplyVectors(iMfi, invIi_vmult_taui) + GB.multiplyVectors(iMfj, invIj_vmult_tauj);\n }\n /**\n * Computes G*inv(M)*G'\n */\n\n\n computeGiMGt() {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const invMassi = bi.invMassSolve;\n const invMassj = bj.invMassSolve;\n const invIi = bi.invInertiaWorldSolve;\n const invIj = bj.invInertiaWorldSolve;\n let result = invMassi + invMassj;\n invIi.vmult(GA.rotational, tmp);\n result += tmp.dot(GA.rotational);\n invIj.vmult(GB.rotational, tmp);\n result += tmp.dot(GB.rotational);\n return result;\n }\n /**\n * Add constraint velocity to the bodies.\n */\n\n\n addToWlambda(deltalambda) {\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const bi = this.bi;\n const bj = this.bj;\n const temp = addToWlambda_temp; // Add to linear velocity\n // v_lambda += inv(M) * delta_lamba * G\n\n bi.vlambda.addScaledVector(bi.invMassSolve * deltalambda, GA.spatial, bi.vlambda);\n bj.vlambda.addScaledVector(bj.invMassSolve * deltalambda, GB.spatial, bj.vlambda); // Add to angular velocity\n\n bi.invInertiaWorldSolve.vmult(GA.rotational, temp);\n bi.wlambda.addScaledVector(deltalambda, temp, bi.wlambda);\n bj.invInertiaWorldSolve.vmult(GB.rotational, temp);\n bj.wlambda.addScaledVector(deltalambda, temp, bj.wlambda);\n }\n /**\n * Compute the denominator part of the SPOOK equation: C = G*inv(M)*G' + eps\n */\n\n\n computeC() {\n return this.computeGiMGt() + this.eps;\n }\n\n}\nEquation.idCounter = 0;\nconst iMfi = new Vec3();\nconst iMfj = new Vec3();\nconst invIi_vmult_taui = new Vec3();\nconst invIj_vmult_tauj = new Vec3();\nconst tmp = new Vec3();\nconst addToWlambda_temp = new Vec3();\n\n/**\n * Contact/non-penetration constraint equation\n */\nclass ContactEquation extends Equation {\n /**\n * \"bounciness\": u1 = -e*u0\n */\n\n /**\n * World-oriented vector that goes from the center of bi to the contact point.\n */\n\n /**\n * World-oriented vector that starts in body j position and goes to the contact point.\n */\n\n /**\n * Contact normal, pointing out of body i.\n */\n constructor(bodyA, bodyB, maxForce) {\n if (maxForce === void 0) {\n maxForce = 1e6;\n }\n\n super(bodyA, bodyB, 0, maxForce);\n this.restitution = 0.0;\n this.ri = new Vec3();\n this.rj = new Vec3();\n this.ni = new Vec3();\n }\n\n computeB(h) {\n const a = this.a;\n const b = this.b;\n const bi = this.bi;\n const bj = this.bj;\n const ri = this.ri;\n const rj = this.rj;\n const rixn = ContactEquation_computeB_temp1;\n const rjxn = ContactEquation_computeB_temp2;\n const vi = bi.velocity;\n const wi = bi.angularVelocity;\n bi.force;\n bi.torque;\n const vj = bj.velocity;\n const wj = bj.angularVelocity;\n bj.force;\n bj.torque;\n const penetrationVec = ContactEquation_computeB_temp3;\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n const n = this.ni; // Caluclate cross products\n\n ri.cross(n, rixn);\n rj.cross(n, rjxn); // g = xj+rj -(xi+ri)\n // G = [ -ni -rixn ni rjxn ]\n\n n.negate(GA.spatial);\n rixn.negate(GA.rotational);\n GB.spatial.copy(n);\n GB.rotational.copy(rjxn); // Calculate the penetration vector\n\n penetrationVec.copy(bj.position);\n penetrationVec.vadd(rj, penetrationVec);\n penetrationVec.vsub(bi.position, penetrationVec);\n penetrationVec.vsub(ri, penetrationVec);\n const g = n.dot(penetrationVec); // Compute iteration\n\n const ePlusOne = this.restitution + 1;\n const GW = ePlusOne * vj.dot(n) - ePlusOne * vi.dot(n) + wj.dot(rjxn) - wi.dot(rixn);\n const GiMf = this.computeGiMf();\n const B = -g * a - GW * b - h * GiMf;\n return B;\n }\n /**\n * Get the current relative velocity in the contact point.\n */\n\n\n getImpactVelocityAlongNormal() {\n const vi = ContactEquation_getImpactVelocityAlongNormal_vi;\n const vj = ContactEquation_getImpactVelocityAlongNormal_vj;\n const xi = ContactEquation_getImpactVelocityAlongNormal_xi;\n const xj = ContactEquation_getImpactVelocityAlongNormal_xj;\n const relVel = ContactEquation_getImpactVelocityAlongNormal_relVel;\n this.bi.position.vadd(this.ri, xi);\n this.bj.position.vadd(this.rj, xj);\n this.bi.getVelocityAtWorldPoint(xi, vi);\n this.bj.getVelocityAtWorldPoint(xj, vj);\n vi.vsub(vj, relVel);\n return this.ni.dot(relVel);\n }\n\n}\nconst ContactEquation_computeB_temp1 = new Vec3(); // Temp vectors\n\nconst ContactEquation_computeB_temp2 = new Vec3();\nconst ContactEquation_computeB_temp3 = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_vi = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_vj = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_xi = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_xj = new Vec3();\nconst ContactEquation_getImpactVelocityAlongNormal_relVel = new Vec3();\n\n/**\n * Connects two bodies at given offset points.\n * @example\n * const bodyA = new Body({ mass: 1 })\n * const bodyB = new Body({ mass: 1 })\n * bodyA.position.set(-1, 0, 0)\n * bodyB.position.set(1, 0, 0)\n * bodyA.addShape(shapeA)\n * bodyB.addShape(shapeB)\n * world.addBody(bodyA)\n * world.addBody(bodyB)\n * const localPivotA = new Vec3(1, 0, 0)\n * const localPivotB = new Vec3(-1, 0, 0)\n * const constraint = new PointToPointConstraint(bodyA, localPivotA, bodyB, localPivotB)\n * world.addConstraint(constraint)\n */\nclass PointToPointConstraint extends Constraint {\n /**\n * Pivot, defined locally in bodyA.\n */\n\n /**\n * Pivot, defined locally in bodyB.\n */\n\n /**\n * @param pivotA The point relative to the center of mass of bodyA which bodyA is constrained to.\n * @param bodyB Body that will be constrained in a similar way to the same point as bodyA. We will therefore get a link between bodyA and bodyB. If not specified, bodyA will be constrained to a static point.\n * @param pivotB The point relative to the center of mass of bodyB which bodyB is constrained to.\n * @param maxForce The maximum force that should be applied to constrain the bodies.\n */\n constructor(bodyA, pivotA, bodyB, pivotB, maxForce) {\n if (pivotA === void 0) {\n pivotA = new Vec3();\n }\n\n if (pivotB === void 0) {\n pivotB = new Vec3();\n }\n\n if (maxForce === void 0) {\n maxForce = 1e6;\n }\n\n super(bodyA, bodyB);\n this.pivotA = pivotA.clone();\n this.pivotB = pivotB.clone();\n const x = this.equationX = new ContactEquation(bodyA, bodyB);\n const y = this.equationY = new ContactEquation(bodyA, bodyB);\n const z = this.equationZ = new ContactEquation(bodyA, bodyB); // Equations to be fed to the solver\n\n this.equations.push(x, y, z); // Make the equations bidirectional\n\n x.minForce = y.minForce = z.minForce = -maxForce;\n x.maxForce = y.maxForce = z.maxForce = maxForce;\n x.ni.set(1, 0, 0);\n y.ni.set(0, 1, 0);\n z.ni.set(0, 0, 1);\n }\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const x = this.equationX;\n const y = this.equationY;\n const z = this.equationZ; // Rotate the pivots to world space\n\n bodyA.quaternion.vmult(this.pivotA, x.ri);\n bodyB.quaternion.vmult(this.pivotB, x.rj);\n y.ri.copy(x.ri);\n y.rj.copy(x.rj);\n z.ri.copy(x.ri);\n z.rj.copy(x.rj);\n }\n\n}\n\n/**\n * Cone equation. Works to keep the given body world vectors aligned, or tilted within a given angle from each other.\n */\nclass ConeEquation extends Equation {\n /**\n * Local axis in A\n */\n\n /**\n * Local axis in B\n */\n\n /**\n * The \"cone angle\" to keep\n */\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6;\n super(bodyA, bodyB, -maxForce, maxForce);\n this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0);\n this.axisB = options.axisB ? options.axisB.clone() : new Vec3(0, 1, 0);\n this.angle = typeof options.angle !== 'undefined' ? options.angle : 0;\n }\n\n computeB(h) {\n const a = this.a;\n const b = this.b;\n const ni = this.axisA;\n const nj = this.axisB;\n const nixnj = tmpVec1$2;\n const njxni = tmpVec2$2;\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB; // Caluclate cross products\n\n ni.cross(nj, nixnj);\n nj.cross(ni, njxni); // The angle between two vector is:\n // cos(theta) = a * b / (length(a) * length(b) = { len(a) = len(b) = 1 } = a * b\n // g = a * b\n // gdot = (b x a) * wi + (a x b) * wj\n // G = [0 bxa 0 axb]\n // W = [vi wi vj wj]\n\n GA.rotational.copy(njxni);\n GB.rotational.copy(nixnj);\n const g = Math.cos(this.angle) - ni.dot(nj);\n const GW = this.computeGW();\n const GiMf = this.computeGiMf();\n const B = -g * a - GW * b - h * GiMf;\n return B;\n }\n\n}\nconst tmpVec1$2 = new Vec3();\nconst tmpVec2$2 = new Vec3();\n\n/**\n * Rotational constraint. Works to keep the local vectors orthogonal to each other in world space.\n */\nclass RotationalEquation extends Equation {\n /**\n * World oriented rotational axis.\n */\n\n /**\n * World oriented rotational axis.\n */\n\n /**\n * maxAngle\n */\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6;\n super(bodyA, bodyB, -maxForce, maxForce);\n this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0);\n this.axisB = options.axisB ? options.axisB.clone() : new Vec3(0, 1, 0);\n this.maxAngle = Math.PI / 2;\n }\n\n computeB(h) {\n const a = this.a;\n const b = this.b;\n const ni = this.axisA;\n const nj = this.axisB;\n const nixnj = tmpVec1$1;\n const njxni = tmpVec2$1;\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB; // Caluclate cross products\n\n ni.cross(nj, nixnj);\n nj.cross(ni, njxni); // g = ni * nj\n // gdot = (nj x ni) * wi + (ni x nj) * wj\n // G = [0 njxni 0 nixnj]\n // W = [vi wi vj wj]\n\n GA.rotational.copy(njxni);\n GB.rotational.copy(nixnj);\n const g = Math.cos(this.maxAngle) - ni.dot(nj);\n const GW = this.computeGW();\n const GiMf = this.computeGiMf();\n const B = -g * a - GW * b - h * GiMf;\n return B;\n }\n\n}\nconst tmpVec1$1 = new Vec3();\nconst tmpVec2$1 = new Vec3();\n\n/**\n * A Cone Twist constraint, useful for ragdolls.\n */\nclass ConeTwistConstraint extends PointToPointConstraint {\n /**\n * The axis direction for the constraint of the body A.\n */\n\n /**\n * The axis direction for the constraint of the body B.\n */\n\n /**\n * The aperture angle of the cone.\n */\n\n /**\n * The twist angle of the joint.\n */\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; // Set pivot point in between\n\n const pivotA = options.pivotA ? options.pivotA.clone() : new Vec3();\n const pivotB = options.pivotB ? options.pivotB.clone() : new Vec3();\n super(bodyA, pivotA, bodyB, pivotB, maxForce);\n this.axisA = options.axisA ? options.axisA.clone() : new Vec3();\n this.axisB = options.axisB ? options.axisB.clone() : new Vec3();\n this.collideConnected = !!options.collideConnected;\n this.angle = typeof options.angle !== 'undefined' ? options.angle : 0;\n const c = this.coneEquation = new ConeEquation(bodyA, bodyB, options);\n const t = this.twistEquation = new RotationalEquation(bodyA, bodyB, options);\n this.twistAngle = typeof options.twistAngle !== 'undefined' ? options.twistAngle : 0; // Make the cone equation push the bodies toward the cone axis, not outward\n\n c.maxForce = 0;\n c.minForce = -maxForce; // Make the twist equation add torque toward the initial position\n\n t.maxForce = 0;\n t.minForce = -maxForce;\n this.equations.push(c, t);\n }\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const cone = this.coneEquation;\n const twist = this.twistEquation;\n super.update(); // Update the axes to the cone constraint\n\n bodyA.vectorToWorldFrame(this.axisA, cone.axisA);\n bodyB.vectorToWorldFrame(this.axisB, cone.axisB); // Update the world axes in the twist constraint\n\n this.axisA.tangents(twist.axisA, twist.axisA);\n bodyA.vectorToWorldFrame(twist.axisA, twist.axisA);\n this.axisB.tangents(twist.axisB, twist.axisB);\n bodyB.vectorToWorldFrame(twist.axisB, twist.axisB);\n cone.angle = this.angle;\n twist.maxAngle = this.twistAngle;\n }\n\n}\nnew Vec3();\nnew Vec3();\n\n/**\n * Constrains two bodies to be at a constant distance from each others center of mass.\n */\nclass DistanceConstraint extends Constraint {\n /**\n * The distance to keep. If undefined, it will be set to the current distance between bodyA and bodyB\n */\n\n /**\n * @param distance The distance to keep. If undefined, it will be set to the current distance between bodyA and bodyB.\n * @param maxForce The maximum force that should be applied to constrain the bodies.\n */\n constructor(bodyA, bodyB, distance, maxForce) {\n if (maxForce === void 0) {\n maxForce = 1e6;\n }\n\n super(bodyA, bodyB);\n\n if (typeof distance === 'undefined') {\n distance = bodyA.position.distanceTo(bodyB.position);\n }\n\n this.distance = distance;\n const eq = this.distanceEquation = new ContactEquation(bodyA, bodyB);\n this.equations.push(eq); // Make it bidirectional\n\n eq.minForce = -maxForce;\n eq.maxForce = maxForce;\n }\n /**\n * update\n */\n\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const eq = this.distanceEquation;\n const halfDist = this.distance * 0.5;\n const normal = eq.ni;\n bodyB.position.vsub(bodyA.position, normal);\n normal.normalize();\n normal.scale(halfDist, eq.ri);\n normal.scale(-halfDist, eq.rj);\n }\n\n}\n\n/**\n * Lock constraint. Will remove all degrees of freedom between the bodies.\n */\nclass LockConstraint extends PointToPointConstraint {\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6; // Set pivot point in between\n\n const pivotA = new Vec3();\n const pivotB = new Vec3();\n const halfWay = new Vec3();\n bodyA.position.vadd(bodyB.position, halfWay);\n halfWay.scale(0.5, halfWay);\n bodyB.pointToLocalFrame(halfWay, pivotB);\n bodyA.pointToLocalFrame(halfWay, pivotA); // The point-to-point constraint will keep a point shared between the bodies\n\n super(bodyA, pivotA, bodyB, pivotB, maxForce); // Store initial rotation of the bodies as unit vectors in the local body spaces\n\n this.xA = bodyA.vectorToLocalFrame(Vec3.UNIT_X);\n this.xB = bodyB.vectorToLocalFrame(Vec3.UNIT_X);\n this.yA = bodyA.vectorToLocalFrame(Vec3.UNIT_Y);\n this.yB = bodyB.vectorToLocalFrame(Vec3.UNIT_Y);\n this.zA = bodyA.vectorToLocalFrame(Vec3.UNIT_Z);\n this.zB = bodyB.vectorToLocalFrame(Vec3.UNIT_Z); // ...and the following rotational equations will keep all rotational DOF's in place\n\n const r1 = this.rotationalEquation1 = new RotationalEquation(bodyA, bodyB, options);\n const r2 = this.rotationalEquation2 = new RotationalEquation(bodyA, bodyB, options);\n const r3 = this.rotationalEquation3 = new RotationalEquation(bodyA, bodyB, options);\n this.equations.push(r1, r2, r3);\n }\n /**\n * update\n */\n\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n this.motorEquation;\n const r1 = this.rotationalEquation1;\n const r2 = this.rotationalEquation2;\n const r3 = this.rotationalEquation3;\n LockConstraint_update_tmpVec1;\n LockConstraint_update_tmpVec2;\n super.update(); // These vector pairs must be orthogonal\n\n bodyA.vectorToWorldFrame(this.xA, r1.axisA);\n bodyB.vectorToWorldFrame(this.yB, r1.axisB);\n bodyA.vectorToWorldFrame(this.yA, r2.axisA);\n bodyB.vectorToWorldFrame(this.zB, r2.axisB);\n bodyA.vectorToWorldFrame(this.zA, r3.axisA);\n bodyB.vectorToWorldFrame(this.xB, r3.axisB);\n }\n\n}\nconst LockConstraint_update_tmpVec1 = new Vec3();\nconst LockConstraint_update_tmpVec2 = new Vec3();\n\n/**\n * Rotational motor constraint. Tries to keep the relative angular velocity of the bodies to a given value.\n */\nclass RotationalMotorEquation extends Equation {\n /**\n * World oriented rotational axis.\n */\n\n /**\n * World oriented rotational axis.\n */\n\n /**\n * Motor velocity.\n */\n constructor(bodyA, bodyB, maxForce) {\n if (maxForce === void 0) {\n maxForce = 1e6;\n }\n\n super(bodyA, bodyB, -maxForce, maxForce);\n this.axisA = new Vec3();\n this.axisB = new Vec3();\n this.targetVelocity = 0;\n }\n\n computeB(h) {\n this.a;\n const b = this.b;\n this.bi;\n this.bj;\n const axisA = this.axisA;\n const axisB = this.axisB;\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB; // g = 0\n // gdot = axisA * wi - axisB * wj\n // gdot = G * W = G * [vi wi vj wj]\n // =>\n // G = [0 axisA 0 -axisB]\n\n GA.rotational.copy(axisA);\n axisB.negate(GB.rotational);\n const GW = this.computeGW() - this.targetVelocity;\n const GiMf = this.computeGiMf();\n const B = -GW * b - h * GiMf;\n return B;\n }\n\n}\n\n/**\n * Hinge constraint. Think of it as a door hinge. It tries to keep the door in the correct place and with the correct orientation.\n */\nclass HingeConstraint extends PointToPointConstraint {\n /**\n * Rotation axis, defined locally in bodyA.\n */\n\n /**\n * Rotation axis, defined locally in bodyB.\n */\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n const maxForce = typeof options.maxForce !== 'undefined' ? options.maxForce : 1e6;\n const pivotA = options.pivotA ? options.pivotA.clone() : new Vec3();\n const pivotB = options.pivotB ? options.pivotB.clone() : new Vec3();\n super(bodyA, pivotA, bodyB, pivotB, maxForce);\n const axisA = this.axisA = options.axisA ? options.axisA.clone() : new Vec3(1, 0, 0);\n axisA.normalize();\n const axisB = this.axisB = options.axisB ? options.axisB.clone() : new Vec3(1, 0, 0);\n axisB.normalize();\n this.collideConnected = !!options.collideConnected;\n const rotational1 = this.rotationalEquation1 = new RotationalEquation(bodyA, bodyB, options);\n const rotational2 = this.rotationalEquation2 = new RotationalEquation(bodyA, bodyB, options);\n const motor = this.motorEquation = new RotationalMotorEquation(bodyA, bodyB, maxForce);\n motor.enabled = false; // Not enabled by default\n // Equations to be fed to the solver\n\n this.equations.push(rotational1, rotational2, motor);\n }\n /**\n * enableMotor\n */\n\n\n enableMotor() {\n this.motorEquation.enabled = true;\n }\n /**\n * disableMotor\n */\n\n\n disableMotor() {\n this.motorEquation.enabled = false;\n }\n /**\n * setMotorSpeed\n */\n\n\n setMotorSpeed(speed) {\n this.motorEquation.targetVelocity = speed;\n }\n /**\n * setMotorMaxForce\n */\n\n\n setMotorMaxForce(maxForce) {\n this.motorEquation.maxForce = maxForce;\n this.motorEquation.minForce = -maxForce;\n }\n /**\n * update\n */\n\n\n update() {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const motor = this.motorEquation;\n const r1 = this.rotationalEquation1;\n const r2 = this.rotationalEquation2;\n const worldAxisA = HingeConstraint_update_tmpVec1;\n const worldAxisB = HingeConstraint_update_tmpVec2;\n const axisA = this.axisA;\n const axisB = this.axisB;\n super.update(); // Get world axes\n\n bodyA.quaternion.vmult(axisA, worldAxisA);\n bodyB.quaternion.vmult(axisB, worldAxisB);\n worldAxisA.tangents(r1.axisA, r2.axisA);\n r1.axisB.copy(worldAxisB);\n r2.axisB.copy(worldAxisB);\n\n if (this.motorEquation.enabled) {\n bodyA.quaternion.vmult(this.axisA, motor.axisA);\n bodyB.quaternion.vmult(this.axisB, motor.axisB);\n }\n }\n\n}\nconst HingeConstraint_update_tmpVec1 = new Vec3();\nconst HingeConstraint_update_tmpVec2 = new Vec3();\n\n/**\n * Constrains the slipping in a contact along a tangent\n */\nclass FrictionEquation extends Equation {\n // Tangent\n\n /**\n * @param slipForce should be +-F_friction = +-mu * F_normal = +-mu * m * g\n */\n constructor(bodyA, bodyB, slipForce) {\n super(bodyA, bodyB, -slipForce, slipForce);\n this.ri = new Vec3();\n this.rj = new Vec3();\n this.t = new Vec3();\n }\n\n computeB(h) {\n this.a;\n const b = this.b;\n this.bi;\n this.bj;\n const ri = this.ri;\n const rj = this.rj;\n const rixt = FrictionEquation_computeB_temp1;\n const rjxt = FrictionEquation_computeB_temp2;\n const t = this.t; // Caluclate cross products\n\n ri.cross(t, rixt);\n rj.cross(t, rjxt); // G = [-t -rixt t rjxt]\n // And remember, this is a pure velocity constraint, g is always zero!\n\n const GA = this.jacobianElementA;\n const GB = this.jacobianElementB;\n t.negate(GA.spatial);\n rixt.negate(GA.rotational);\n GB.spatial.copy(t);\n GB.rotational.copy(rjxt);\n const GW = this.computeGW();\n const GiMf = this.computeGiMf();\n const B = -GW * b - h * GiMf;\n return B;\n }\n\n}\nconst FrictionEquation_computeB_temp1 = new Vec3();\nconst FrictionEquation_computeB_temp2 = new Vec3();\n\n/**\n * Defines what happens when two materials meet.\n * @todo Refactor materials to materialA and materialB\n */\nclass ContactMaterial {\n /**\n * Identifier of this material.\n */\n\n /**\n * Participating materials.\n */\n\n /**\n * Friction coefficient.\n * @default 0.3\n */\n\n /**\n * Restitution coefficient.\n * @default 0.3\n */\n\n /**\n * Stiffness of the produced contact equations.\n * @default 1e7\n */\n\n /**\n * Relaxation time of the produced contact equations.\n * @default 3\n */\n\n /**\n * Stiffness of the produced friction equations.\n * @default 1e7\n */\n\n /**\n * Relaxation time of the produced friction equations\n * @default 3\n */\n constructor(m1, m2, options) {\n options = Utils.defaults(options, {\n friction: 0.3,\n restitution: 0.3,\n contactEquationStiffness: 1e7,\n contactEquationRelaxation: 3,\n frictionEquationStiffness: 1e7,\n frictionEquationRelaxation: 3\n });\n this.id = ContactMaterial.idCounter++;\n this.materials = [m1, m2];\n this.friction = options.friction;\n this.restitution = options.restitution;\n this.contactEquationStiffness = options.contactEquationStiffness;\n this.contactEquationRelaxation = options.contactEquationRelaxation;\n this.frictionEquationStiffness = options.frictionEquationStiffness;\n this.frictionEquationRelaxation = options.frictionEquationRelaxation;\n }\n\n}\nContactMaterial.idCounter = 0;\n\n/**\n * Defines a physics material.\n */\nclass Material {\n /**\n * Material name.\n * If options is a string, name will be set to that string.\n * @todo Deprecate this\n */\n\n /** Material id. */\n\n /**\n * Friction for this material.\n * If non-negative, it will be used instead of the friction given by ContactMaterials. If there's no matching ContactMaterial, the value from `defaultContactMaterial` in the World will be used.\n */\n\n /**\n * Restitution for this material.\n * If non-negative, it will be used instead of the restitution given by ContactMaterials. If there's no matching ContactMaterial, the value from `defaultContactMaterial` in the World will be used.\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n let name = ''; // Backwards compatibility fix\n\n if (typeof options === 'string') {\n //console.warn(`Passing a string to MaterialOptions is deprecated, and has no effect`)\n name = options;\n options = {};\n }\n\n this.name = name;\n this.id = Material.idCounter++;\n this.friction = typeof options.friction !== 'undefined' ? options.friction : -1;\n this.restitution = typeof options.restitution !== 'undefined' ? options.restitution : -1;\n }\n\n}\nMaterial.idCounter = 0;\n\n/**\n * A spring, connecting two bodies.\n * @example\n * const spring = new Spring(boxBody, sphereBody, {\n * restLength: 0,\n * stiffness: 50,\n * damping: 1,\n * })\n *\n * // Compute the force after each step\n * world.addEventListener('postStep', (event) => {\n * spring.applyForce()\n * })\n */\nclass Spring {\n /**\n * Rest length of the spring. A number > 0.\n * @default 1\n */\n\n /**\n * Stiffness of the spring. A number >= 0.\n * @default 100\n */\n\n /**\n * Damping of the spring. A number >= 0.\n * @default 1\n */\n\n /**\n * First connected body.\n */\n\n /**\n * Second connected body.\n */\n\n /**\n * Anchor for bodyA in local bodyA coordinates.\n * Where to hook the spring to body A, in local body coordinates.\n * @default new Vec3()\n */\n\n /**\n * Anchor for bodyB in local bodyB coordinates.\n * Where to hook the spring to body B, in local body coordinates.\n * @default new Vec3()\n */\n constructor(bodyA, bodyB, options) {\n if (options === void 0) {\n options = {};\n }\n\n this.restLength = typeof options.restLength === 'number' ? options.restLength : 1;\n this.stiffness = options.stiffness || 100;\n this.damping = options.damping || 1;\n this.bodyA = bodyA;\n this.bodyB = bodyB;\n this.localAnchorA = new Vec3();\n this.localAnchorB = new Vec3();\n\n if (options.localAnchorA) {\n this.localAnchorA.copy(options.localAnchorA);\n }\n\n if (options.localAnchorB) {\n this.localAnchorB.copy(options.localAnchorB);\n }\n\n if (options.worldAnchorA) {\n this.setWorldAnchorA(options.worldAnchorA);\n }\n\n if (options.worldAnchorB) {\n this.setWorldAnchorB(options.worldAnchorB);\n }\n }\n /**\n * Set the anchor point on body A, using world coordinates.\n */\n\n\n setWorldAnchorA(worldAnchorA) {\n this.bodyA.pointToLocalFrame(worldAnchorA, this.localAnchorA);\n }\n /**\n * Set the anchor point on body B, using world coordinates.\n */\n\n\n setWorldAnchorB(worldAnchorB) {\n this.bodyB.pointToLocalFrame(worldAnchorB, this.localAnchorB);\n }\n /**\n * Get the anchor point on body A, in world coordinates.\n * @param result The vector to store the result in.\n */\n\n\n getWorldAnchorA(result) {\n this.bodyA.pointToWorldFrame(this.localAnchorA, result);\n }\n /**\n * Get the anchor point on body B, in world coordinates.\n * @param result The vector to store the result in.\n */\n\n\n getWorldAnchorB(result) {\n this.bodyB.pointToWorldFrame(this.localAnchorB, result);\n }\n /**\n * Apply the spring force to the connected bodies.\n */\n\n\n applyForce() {\n const k = this.stiffness;\n const d = this.damping;\n const l = this.restLength;\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n const r = applyForce_r;\n const r_unit = applyForce_r_unit;\n const u = applyForce_u;\n const f = applyForce_f;\n const tmp = applyForce_tmp;\n const worldAnchorA = applyForce_worldAnchorA;\n const worldAnchorB = applyForce_worldAnchorB;\n const ri = applyForce_ri;\n const rj = applyForce_rj;\n const ri_x_f = applyForce_ri_x_f;\n const rj_x_f = applyForce_rj_x_f; // Get world anchors\n\n this.getWorldAnchorA(worldAnchorA);\n this.getWorldAnchorB(worldAnchorB); // Get offset points\n\n worldAnchorA.vsub(bodyA.position, ri);\n worldAnchorB.vsub(bodyB.position, rj); // Compute distance vector between world anchor points\n\n worldAnchorB.vsub(worldAnchorA, r);\n const rlen = r.length();\n r_unit.copy(r);\n r_unit.normalize(); // Compute relative velocity of the anchor points, u\n\n bodyB.velocity.vsub(bodyA.velocity, u); // Add rotational velocity\n\n bodyB.angularVelocity.cross(rj, tmp);\n u.vadd(tmp, u);\n bodyA.angularVelocity.cross(ri, tmp);\n u.vsub(tmp, u); // F = - k * ( x - L ) - D * ( u )\n\n r_unit.scale(-k * (rlen - l) - d * u.dot(r_unit), f); // Add forces to bodies\n\n bodyA.force.vsub(f, bodyA.force);\n bodyB.force.vadd(f, bodyB.force); // Angular force\n\n ri.cross(f, ri_x_f);\n rj.cross(f, rj_x_f);\n bodyA.torque.vsub(ri_x_f, bodyA.torque);\n bodyB.torque.vadd(rj_x_f, bodyB.torque);\n }\n\n}\nconst applyForce_r = new Vec3();\nconst applyForce_r_unit = new Vec3();\nconst applyForce_u = new Vec3();\nconst applyForce_f = new Vec3();\nconst applyForce_worldAnchorA = new Vec3();\nconst applyForce_worldAnchorB = new Vec3();\nconst applyForce_ri = new Vec3();\nconst applyForce_rj = new Vec3();\nconst applyForce_ri_x_f = new Vec3();\nconst applyForce_rj_x_f = new Vec3();\nconst applyForce_tmp = new Vec3();\n\n/**\n * WheelInfo\n */\nclass WheelInfo {\n /**\n * Max travel distance of the suspension, in meters.\n * @default 1\n */\n\n /**\n * Speed to apply to the wheel rotation when the wheel is sliding.\n * @default -0.1\n */\n\n /**\n * If the customSlidingRotationalSpeed should be used.\n * @default false\n */\n\n /**\n * sliding\n */\n\n /**\n * Connection point, defined locally in the chassis body frame.\n */\n\n /**\n * chassisConnectionPointWorld\n */\n\n /**\n * directionLocal\n */\n\n /**\n * directionWorld\n */\n\n /**\n * axleLocal\n */\n\n /**\n * axleWorld\n */\n\n /**\n * suspensionRestLength\n * @default 1\n */\n\n /**\n * suspensionMaxLength\n * @default 2\n */\n\n /**\n * radius\n * @default 1\n */\n\n /**\n * suspensionStiffness\n * @default 100\n */\n\n /**\n * dampingCompression\n * @default 10\n */\n\n /**\n * dampingRelaxation\n * @default 10\n */\n\n /**\n * frictionSlip\n * @default 10.5\n */\n\n /** forwardAcceleration */\n\n /** sideAcceleration */\n\n /**\n * steering\n * @default 0\n */\n\n /**\n * Rotation value, in radians.\n * @default 0\n */\n\n /**\n * deltaRotation\n * @default 0\n */\n\n /**\n * rollInfluence\n * @default 0.01\n */\n\n /**\n * maxSuspensionForce\n */\n\n /**\n * engineForce\n */\n\n /**\n * brake\n */\n\n /**\n * isFrontWheel\n * @default true\n */\n\n /**\n * clippedInvContactDotSuspension\n * @default 1\n */\n\n /**\n * suspensionRelativeVelocity\n * @default 0\n */\n\n /**\n * suspensionForce\n * @default 0\n */\n\n /**\n * slipInfo\n */\n\n /**\n * skidInfo\n * @default 0\n */\n\n /**\n * suspensionLength\n * @default 0\n */\n\n /**\n * sideImpulse\n */\n\n /**\n * forwardImpulse\n */\n\n /**\n * The result from raycasting.\n */\n\n /**\n * Wheel world transform.\n */\n\n /**\n * isInContact\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n options = Utils.defaults(options, {\n chassisConnectionPointLocal: new Vec3(),\n chassisConnectionPointWorld: new Vec3(),\n directionLocal: new Vec3(),\n directionWorld: new Vec3(),\n axleLocal: new Vec3(),\n axleWorld: new Vec3(),\n suspensionRestLength: 1,\n suspensionMaxLength: 2,\n radius: 1,\n suspensionStiffness: 100,\n dampingCompression: 10,\n dampingRelaxation: 10,\n frictionSlip: 10.5,\n forwardAcceleration: 1,\n sideAcceleration: 1,\n steering: 0,\n rotation: 0,\n deltaRotation: 0,\n rollInfluence: 0.01,\n maxSuspensionForce: Number.MAX_VALUE,\n isFrontWheel: true,\n clippedInvContactDotSuspension: 1,\n suspensionRelativeVelocity: 0,\n suspensionForce: 0,\n slipInfo: 0,\n skidInfo: 0,\n suspensionLength: 0,\n maxSuspensionTravel: 1,\n useCustomSlidingRotationalSpeed: false,\n customSlidingRotationalSpeed: -0.1\n });\n this.maxSuspensionTravel = options.maxSuspensionTravel;\n this.customSlidingRotationalSpeed = options.customSlidingRotationalSpeed;\n this.useCustomSlidingRotationalSpeed = options.useCustomSlidingRotationalSpeed;\n this.sliding = false;\n this.chassisConnectionPointLocal = options.chassisConnectionPointLocal.clone();\n this.chassisConnectionPointWorld = options.chassisConnectionPointWorld.clone();\n this.directionLocal = options.directionLocal.clone();\n this.directionWorld = options.directionWorld.clone();\n this.axleLocal = options.axleLocal.clone();\n this.axleWorld = options.axleWorld.clone();\n this.suspensionRestLength = options.suspensionRestLength;\n this.suspensionMaxLength = options.suspensionMaxLength;\n this.radius = options.radius;\n this.suspensionStiffness = options.suspensionStiffness;\n this.dampingCompression = options.dampingCompression;\n this.dampingRelaxation = options.dampingRelaxation;\n this.frictionSlip = options.frictionSlip;\n this.forwardAcceleration = options.forwardAcceleration;\n this.sideAcceleration = options.sideAcceleration;\n this.steering = 0;\n this.rotation = 0;\n this.deltaRotation = 0;\n this.rollInfluence = options.rollInfluence;\n this.maxSuspensionForce = options.maxSuspensionForce;\n this.engineForce = 0;\n this.brake = 0;\n this.isFrontWheel = options.isFrontWheel;\n this.clippedInvContactDotSuspension = 1;\n this.suspensionRelativeVelocity = 0;\n this.suspensionForce = 0;\n this.slipInfo = 0;\n this.skidInfo = 0;\n this.suspensionLength = 0;\n this.sideImpulse = 0;\n this.forwardImpulse = 0;\n this.raycastResult = new RaycastResult();\n this.worldTransform = new Transform();\n this.isInContact = false;\n }\n\n updateWheel(chassis) {\n const raycastResult = this.raycastResult;\n\n if (this.isInContact) {\n const project = raycastResult.hitNormalWorld.dot(raycastResult.directionWorld);\n raycastResult.hitPointWorld.vsub(chassis.position, relpos);\n chassis.getVelocityAtWorldPoint(relpos, chassis_velocity_at_contactPoint);\n const projVel = raycastResult.hitNormalWorld.dot(chassis_velocity_at_contactPoint);\n\n if (project >= -0.1) {\n this.suspensionRelativeVelocity = 0.0;\n this.clippedInvContactDotSuspension = 1.0 / 0.1;\n } else {\n const inv = -1 / project;\n this.suspensionRelativeVelocity = projVel * inv;\n this.clippedInvContactDotSuspension = inv;\n }\n } else {\n // Not in contact : position wheel in a nice (rest length) position\n raycastResult.suspensionLength = this.suspensionRestLength;\n this.suspensionRelativeVelocity = 0.0;\n raycastResult.directionWorld.scale(-1, raycastResult.hitNormalWorld);\n this.clippedInvContactDotSuspension = 1.0;\n }\n }\n\n}\nconst chassis_velocity_at_contactPoint = new Vec3();\nconst relpos = new Vec3();\n\n/**\n * Vehicle helper class that casts rays from the wheel positions towards the ground and applies forces.\n */\nclass RaycastVehicle {\n /** The car chassis body. */\n\n /** The wheels. */\n\n /** Will be set to true if the car is sliding. */\n\n /** Index of the right axis. x=0, y=1, z=2 */\n\n /** Index of the forward axis. x=0, y=1, z=2 */\n\n /** Index of the up axis. x=0, y=1, z=2 */\n\n /** The constraints. */\n\n /** Optional pre-step callback. */\n\n /** Number of wheels on the ground. */\n constructor(options) {\n this.chassisBody = options.chassisBody;\n this.wheelInfos = [];\n this.sliding = false;\n this.world = null;\n this.indexRightAxis = typeof options.indexRightAxis !== 'undefined' ? options.indexRightAxis : 2;\n this.indexForwardAxis = typeof options.indexForwardAxis !== 'undefined' ? options.indexForwardAxis : 0;\n this.indexUpAxis = typeof options.indexUpAxis !== 'undefined' ? options.indexUpAxis : 1;\n this.constraints = [];\n\n this.preStepCallback = () => {};\n\n this.currentVehicleSpeedKmHour = 0;\n this.numWheelsOnGround = 0;\n }\n /**\n * Add a wheel. For information about the options, see `WheelInfo`.\n */\n\n\n addWheel(options) {\n if (options === void 0) {\n options = {};\n }\n\n const info = new WheelInfo(options);\n const index = this.wheelInfos.length;\n this.wheelInfos.push(info);\n return index;\n }\n /**\n * Set the steering value of a wheel.\n */\n\n\n setSteeringValue(value, wheelIndex) {\n const wheel = this.wheelInfos[wheelIndex];\n wheel.steering = value;\n }\n /**\n * Set the wheel force to apply on one of the wheels each time step\n */\n\n\n applyEngineForce(value, wheelIndex) {\n this.wheelInfos[wheelIndex].engineForce = value;\n }\n /**\n * Set the braking force of a wheel\n */\n\n\n setBrake(brake, wheelIndex) {\n this.wheelInfos[wheelIndex].brake = brake;\n }\n /**\n * Add the vehicle including its constraints to the world.\n */\n\n\n addToWorld(world) {\n world.addBody(this.chassisBody);\n const that = this;\n\n this.preStepCallback = () => {\n that.updateVehicle(world.dt);\n };\n\n world.addEventListener('preStep', this.preStepCallback);\n this.world = world;\n }\n /**\n * Get one of the wheel axles, world-oriented.\n */\n\n\n getVehicleAxisWorld(axisIndex, result) {\n result.set(axisIndex === 0 ? 1 : 0, axisIndex === 1 ? 1 : 0, axisIndex === 2 ? 1 : 0);\n this.chassisBody.vectorToWorldFrame(result, result);\n }\n\n updateVehicle(timeStep) {\n const wheelInfos = this.wheelInfos;\n const numWheels = wheelInfos.length;\n const chassisBody = this.chassisBody;\n\n for (let i = 0; i < numWheels; i++) {\n this.updateWheelTransform(i);\n }\n\n this.currentVehicleSpeedKmHour = 3.6 * chassisBody.velocity.length();\n const forwardWorld = new Vec3();\n this.getVehicleAxisWorld(this.indexForwardAxis, forwardWorld);\n\n if (forwardWorld.dot(chassisBody.velocity) < 0) {\n this.currentVehicleSpeedKmHour *= -1;\n } // simulate suspension\n\n\n for (let i = 0; i < numWheels; i++) {\n this.castRay(wheelInfos[i]);\n }\n\n this.updateSuspension(timeStep);\n const impulse = new Vec3();\n const relpos = new Vec3();\n\n for (let i = 0; i < numWheels; i++) {\n //apply suspension force\n const wheel = wheelInfos[i];\n let suspensionForce = wheel.suspensionForce;\n\n if (suspensionForce > wheel.maxSuspensionForce) {\n suspensionForce = wheel.maxSuspensionForce;\n }\n\n wheel.raycastResult.hitNormalWorld.scale(suspensionForce * timeStep, impulse);\n wheel.raycastResult.hitPointWorld.vsub(chassisBody.position, relpos);\n chassisBody.applyImpulse(impulse, relpos);\n }\n\n this.updateFriction(timeStep);\n const hitNormalWorldScaledWithProj = new Vec3();\n const fwd = new Vec3();\n const vel = new Vec3();\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i]; //const relpos = new Vec3();\n //wheel.chassisConnectionPointWorld.vsub(chassisBody.position, relpos);\n\n chassisBody.getVelocityAtWorldPoint(wheel.chassisConnectionPointWorld, vel); // Hack to get the rotation in the correct direction\n\n let m = 1;\n\n switch (this.indexUpAxis) {\n case 1:\n m = -1;\n break;\n }\n\n if (wheel.isInContact) {\n this.getVehicleAxisWorld(this.indexForwardAxis, fwd);\n const proj = fwd.dot(wheel.raycastResult.hitNormalWorld);\n wheel.raycastResult.hitNormalWorld.scale(proj, hitNormalWorldScaledWithProj);\n fwd.vsub(hitNormalWorldScaledWithProj, fwd);\n const proj2 = fwd.dot(vel);\n wheel.deltaRotation = m * proj2 * timeStep / wheel.radius;\n }\n\n if ((wheel.sliding || !wheel.isInContact) && wheel.engineForce !== 0 && wheel.useCustomSlidingRotationalSpeed) {\n // Apply custom rotation when accelerating and sliding\n wheel.deltaRotation = (wheel.engineForce > 0 ? 1 : -1) * wheel.customSlidingRotationalSpeed * timeStep;\n } // Lock wheels\n\n\n if (Math.abs(wheel.brake) > Math.abs(wheel.engineForce)) {\n wheel.deltaRotation = 0;\n }\n\n wheel.rotation += wheel.deltaRotation; // Use the old value\n\n wheel.deltaRotation *= 0.99; // damping of rotation when not in contact\n }\n }\n\n updateSuspension(deltaTime) {\n const chassisBody = this.chassisBody;\n const chassisMass = chassisBody.mass;\n const wheelInfos = this.wheelInfos;\n const numWheels = wheelInfos.length;\n\n for (let w_it = 0; w_it < numWheels; w_it++) {\n const wheel = wheelInfos[w_it];\n\n if (wheel.isInContact) {\n let force; // Spring\n\n const susp_length = wheel.suspensionRestLength;\n const current_length = wheel.suspensionLength;\n const length_diff = susp_length - current_length;\n force = wheel.suspensionStiffness * length_diff * wheel.clippedInvContactDotSuspension; // Damper\n\n const projected_rel_vel = wheel.suspensionRelativeVelocity;\n let susp_damping;\n\n if (projected_rel_vel < 0) {\n susp_damping = wheel.dampingCompression;\n } else {\n susp_damping = wheel.dampingRelaxation;\n }\n\n force -= susp_damping * projected_rel_vel;\n wheel.suspensionForce = force * chassisMass;\n\n if (wheel.suspensionForce < 0) {\n wheel.suspensionForce = 0;\n }\n } else {\n wheel.suspensionForce = 0;\n }\n }\n }\n /**\n * Remove the vehicle including its constraints from the world.\n */\n\n\n removeFromWorld(world) {\n this.constraints;\n world.removeBody(this.chassisBody);\n world.removeEventListener('preStep', this.preStepCallback);\n this.world = null;\n }\n\n castRay(wheel) {\n const rayvector = castRay_rayvector;\n const target = castRay_target;\n this.updateWheelTransformWorld(wheel);\n const chassisBody = this.chassisBody;\n let depth = -1;\n const raylen = wheel.suspensionRestLength + wheel.radius;\n wheel.directionWorld.scale(raylen, rayvector);\n const source = wheel.chassisConnectionPointWorld;\n source.vadd(rayvector, target);\n const raycastResult = wheel.raycastResult;\n raycastResult.reset(); // Turn off ray collision with the chassis temporarily\n\n const oldState = chassisBody.collisionResponse;\n chassisBody.collisionResponse = false; // Cast ray against world\n\n this.world.rayTest(source, target, raycastResult);\n chassisBody.collisionResponse = oldState;\n const object = raycastResult.body;\n wheel.raycastResult.groundObject = 0;\n\n if (object) {\n depth = raycastResult.distance;\n wheel.raycastResult.hitNormalWorld = raycastResult.hitNormalWorld;\n wheel.isInContact = true;\n const hitDistance = raycastResult.distance;\n wheel.suspensionLength = hitDistance - wheel.radius; // clamp on max suspension travel\n\n const minSuspensionLength = wheel.suspensionRestLength - wheel.maxSuspensionTravel;\n const maxSuspensionLength = wheel.suspensionRestLength + wheel.maxSuspensionTravel;\n\n if (wheel.suspensionLength < minSuspensionLength) {\n wheel.suspensionLength = minSuspensionLength;\n }\n\n if (wheel.suspensionLength > maxSuspensionLength) {\n wheel.suspensionLength = maxSuspensionLength;\n wheel.raycastResult.reset();\n }\n\n const denominator = wheel.raycastResult.hitNormalWorld.dot(wheel.directionWorld);\n const chassis_velocity_at_contactPoint = new Vec3();\n chassisBody.getVelocityAtWorldPoint(wheel.raycastResult.hitPointWorld, chassis_velocity_at_contactPoint);\n const projVel = wheel.raycastResult.hitNormalWorld.dot(chassis_velocity_at_contactPoint);\n\n if (denominator >= -0.1) {\n wheel.suspensionRelativeVelocity = 0;\n wheel.clippedInvContactDotSuspension = 1 / 0.1;\n } else {\n const inv = -1 / denominator;\n wheel.suspensionRelativeVelocity = projVel * inv;\n wheel.clippedInvContactDotSuspension = inv;\n }\n } else {\n //put wheel info as in rest position\n wheel.suspensionLength = wheel.suspensionRestLength + 0 * wheel.maxSuspensionTravel;\n wheel.suspensionRelativeVelocity = 0.0;\n wheel.directionWorld.scale(-1, wheel.raycastResult.hitNormalWorld);\n wheel.clippedInvContactDotSuspension = 1.0;\n }\n\n return depth;\n }\n\n updateWheelTransformWorld(wheel) {\n wheel.isInContact = false;\n const chassisBody = this.chassisBody;\n chassisBody.pointToWorldFrame(wheel.chassisConnectionPointLocal, wheel.chassisConnectionPointWorld);\n chassisBody.vectorToWorldFrame(wheel.directionLocal, wheel.directionWorld);\n chassisBody.vectorToWorldFrame(wheel.axleLocal, wheel.axleWorld);\n }\n /**\n * Update one of the wheel transform.\n * Note when rendering wheels: during each step, wheel transforms are updated BEFORE the chassis; ie. their position becomes invalid after the step. Thus when you render wheels, you must update wheel transforms before rendering them. See raycastVehicle demo for an example.\n * @param wheelIndex The wheel index to update.\n */\n\n\n updateWheelTransform(wheelIndex) {\n const up = tmpVec4;\n const right = tmpVec5;\n const fwd = tmpVec6;\n const wheel = this.wheelInfos[wheelIndex];\n this.updateWheelTransformWorld(wheel);\n wheel.directionLocal.scale(-1, up);\n right.copy(wheel.axleLocal);\n up.cross(right, fwd);\n fwd.normalize();\n right.normalize(); // Rotate around steering over the wheelAxle\n\n const steering = wheel.steering;\n const steeringOrn = new Quaternion();\n steeringOrn.setFromAxisAngle(up, steering);\n const rotatingOrn = new Quaternion();\n rotatingOrn.setFromAxisAngle(right, wheel.rotation); // World rotation of the wheel\n\n const q = wheel.worldTransform.quaternion;\n this.chassisBody.quaternion.mult(steeringOrn, q);\n q.mult(rotatingOrn, q);\n q.normalize(); // world position of the wheel\n\n const p = wheel.worldTransform.position;\n p.copy(wheel.directionWorld);\n p.scale(wheel.suspensionLength, p);\n p.vadd(wheel.chassisConnectionPointWorld, p);\n }\n /**\n * Get the world transform of one of the wheels\n */\n\n\n getWheelTransformWorld(wheelIndex) {\n return this.wheelInfos[wheelIndex].worldTransform;\n }\n\n updateFriction(timeStep) {\n const surfNormalWS_scaled_proj = updateFriction_surfNormalWS_scaled_proj; //calculate the impulse, so that the wheels don't move sidewards\n\n const wheelInfos = this.wheelInfos;\n const numWheels = wheelInfos.length;\n const chassisBody = this.chassisBody;\n const forwardWS = updateFriction_forwardWS;\n const axle = updateFriction_axle;\n this.numWheelsOnGround = 0;\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n const groundObject = wheel.raycastResult.body;\n\n if (groundObject) {\n this.numWheelsOnGround++;\n }\n\n wheel.sideImpulse = 0;\n wheel.forwardImpulse = 0;\n\n if (!forwardWS[i]) {\n forwardWS[i] = new Vec3();\n }\n\n if (!axle[i]) {\n axle[i] = new Vec3();\n }\n }\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n const groundObject = wheel.raycastResult.body;\n\n if (groundObject) {\n const axlei = axle[i];\n const wheelTrans = this.getWheelTransformWorld(i); // Get world axle\n\n wheelTrans.vectorToWorldFrame(directions[this.indexRightAxis], axlei);\n const surfNormalWS = wheel.raycastResult.hitNormalWorld;\n const proj = axlei.dot(surfNormalWS);\n surfNormalWS.scale(proj, surfNormalWS_scaled_proj);\n axlei.vsub(surfNormalWS_scaled_proj, axlei);\n axlei.normalize();\n surfNormalWS.cross(axlei, forwardWS[i]);\n forwardWS[i].normalize();\n wheel.sideImpulse = resolveSingleBilateral(chassisBody, wheel.raycastResult.hitPointWorld, groundObject, wheel.raycastResult.hitPointWorld, axlei);\n wheel.sideImpulse *= sideFrictionStiffness2;\n }\n }\n\n const sideFactor = 1;\n const fwdFactor = 0.5;\n this.sliding = false;\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n const groundObject = wheel.raycastResult.body;\n let rollingFriction = 0;\n wheel.slipInfo = 1;\n\n if (groundObject) {\n const defaultRollingFrictionImpulse = 0;\n const maxImpulse = wheel.brake ? wheel.brake : defaultRollingFrictionImpulse; // btWheelContactPoint contactPt(chassisBody,groundObject,wheelInfraycastInfo.hitPointWorld,forwardWS[wheel],maxImpulse);\n // rollingFriction = calcRollingFriction(contactPt);\n\n rollingFriction = calcRollingFriction(chassisBody, groundObject, wheel.raycastResult.hitPointWorld, forwardWS[i], maxImpulse);\n rollingFriction += wheel.engineForce * timeStep; // rollingFriction = 0;\n\n const factor = maxImpulse / rollingFriction;\n wheel.slipInfo *= factor;\n } //switch between active rolling (throttle), braking and non-active rolling friction (nthrottle/break)\n\n\n wheel.forwardImpulse = 0;\n wheel.skidInfo = 1;\n\n if (groundObject) {\n wheel.skidInfo = 1;\n const maximp = wheel.suspensionForce * timeStep * wheel.frictionSlip;\n const maximpSide = maximp;\n const maximpSquared = maximp * maximpSide;\n wheel.forwardImpulse = rollingFriction; //wheelInfo.engineForce* timeStep;\n\n const x = wheel.forwardImpulse * fwdFactor / wheel.forwardAcceleration;\n const y = wheel.sideImpulse * sideFactor / wheel.sideAcceleration;\n const impulseSquared = x * x + y * y;\n wheel.sliding = false;\n\n if (impulseSquared > maximpSquared) {\n this.sliding = true;\n wheel.sliding = true;\n const factor = maximp / Math.sqrt(impulseSquared);\n wheel.skidInfo *= factor;\n }\n }\n }\n\n if (this.sliding) {\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n\n if (wheel.sideImpulse !== 0) {\n if (wheel.skidInfo < 1) {\n wheel.forwardImpulse *= wheel.skidInfo;\n wheel.sideImpulse *= wheel.skidInfo;\n }\n }\n }\n } // apply the impulses\n\n\n for (let i = 0; i < numWheels; i++) {\n const wheel = wheelInfos[i];\n const rel_pos = new Vec3();\n wheel.raycastResult.hitPointWorld.vsub(chassisBody.position, rel_pos); // cannons applyimpulse is using world coord for the position\n //rel_pos.copy(wheel.raycastResult.hitPointWorld);\n\n if (wheel.forwardImpulse !== 0) {\n const impulse = new Vec3();\n forwardWS[i].scale(wheel.forwardImpulse, impulse);\n chassisBody.applyImpulse(impulse, rel_pos);\n }\n\n if (wheel.sideImpulse !== 0) {\n const groundObject = wheel.raycastResult.body;\n const rel_pos2 = new Vec3();\n wheel.raycastResult.hitPointWorld.vsub(groundObject.position, rel_pos2); //rel_pos2.copy(wheel.raycastResult.hitPointWorld);\n\n const sideImp = new Vec3();\n axle[i].scale(wheel.sideImpulse, sideImp); // Scale the relative position in the up direction with rollInfluence.\n // If rollInfluence is 1, the impulse will be applied on the hitPoint (easy to roll over), if it is zero it will be applied in the same plane as the center of mass (not easy to roll over).\n\n chassisBody.vectorToLocalFrame(rel_pos, rel_pos);\n rel_pos['xyz'[this.indexUpAxis]] *= wheel.rollInfluence;\n chassisBody.vectorToWorldFrame(rel_pos, rel_pos);\n chassisBody.applyImpulse(sideImp, rel_pos); //apply friction impulse on the ground\n\n sideImp.scale(-1, sideImp);\n groundObject.applyImpulse(sideImp, rel_pos2);\n }\n }\n }\n\n}\nnew Vec3();\nnew Vec3();\nnew Vec3();\nconst tmpVec4 = new Vec3();\nconst tmpVec5 = new Vec3();\nconst tmpVec6 = new Vec3();\nnew Ray();\nnew Vec3();\nconst castRay_rayvector = new Vec3();\nconst castRay_target = new Vec3();\nconst directions = [new Vec3(1, 0, 0), new Vec3(0, 1, 0), new Vec3(0, 0, 1)];\nconst updateFriction_surfNormalWS_scaled_proj = new Vec3();\nconst updateFriction_axle = [];\nconst updateFriction_forwardWS = [];\nconst sideFrictionStiffness2 = 1;\nconst calcRollingFriction_vel1 = new Vec3();\nconst calcRollingFriction_vel2 = new Vec3();\nconst calcRollingFriction_vel = new Vec3();\n\nfunction calcRollingFriction(body0, body1, frictionPosWorld, frictionDirectionWorld, maxImpulse) {\n let j1 = 0;\n const contactPosWorld = frictionPosWorld; // const rel_pos1 = new Vec3();\n // const rel_pos2 = new Vec3();\n\n const vel1 = calcRollingFriction_vel1;\n const vel2 = calcRollingFriction_vel2;\n const vel = calcRollingFriction_vel; // contactPosWorld.vsub(body0.position, rel_pos1);\n // contactPosWorld.vsub(body1.position, rel_pos2);\n\n body0.getVelocityAtWorldPoint(contactPosWorld, vel1);\n body1.getVelocityAtWorldPoint(contactPosWorld, vel2);\n vel1.vsub(vel2, vel);\n const vrel = frictionDirectionWorld.dot(vel);\n const denom0 = computeImpulseDenominator(body0, frictionPosWorld, frictionDirectionWorld);\n const denom1 = computeImpulseDenominator(body1, frictionPosWorld, frictionDirectionWorld);\n const relaxation = 1;\n const jacDiagABInv = relaxation / (denom0 + denom1); // calculate j that moves us to zero relative velocity\n\n j1 = -vrel * jacDiagABInv;\n\n if (maxImpulse < j1) {\n j1 = maxImpulse;\n }\n\n if (j1 < -maxImpulse) {\n j1 = -maxImpulse;\n }\n\n return j1;\n}\n\nconst computeImpulseDenominator_r0 = new Vec3();\nconst computeImpulseDenominator_c0 = new Vec3();\nconst computeImpulseDenominator_vec = new Vec3();\nconst computeImpulseDenominator_m = new Vec3();\n\nfunction computeImpulseDenominator(body, pos, normal) {\n const r0 = computeImpulseDenominator_r0;\n const c0 = computeImpulseDenominator_c0;\n const vec = computeImpulseDenominator_vec;\n const m = computeImpulseDenominator_m;\n pos.vsub(body.position, r0);\n r0.cross(normal, c0);\n body.invInertiaWorld.vmult(c0, m);\n m.cross(r0, vec);\n return body.invMass + normal.dot(vec);\n}\n\nconst resolveSingleBilateral_vel1 = new Vec3();\nconst resolveSingleBilateral_vel2 = new Vec3();\nconst resolveSingleBilateral_vel = new Vec3(); // bilateral constraint between two dynamic objects\n\nfunction resolveSingleBilateral(body1, pos1, body2, pos2, normal) {\n const normalLenSqr = normal.lengthSquared();\n\n if (normalLenSqr > 1.1) {\n return 0; // no impulse\n } // const rel_pos1 = new Vec3();\n // const rel_pos2 = new Vec3();\n // pos1.vsub(body1.position, rel_pos1);\n // pos2.vsub(body2.position, rel_pos2);\n\n\n const vel1 = resolveSingleBilateral_vel1;\n const vel2 = resolveSingleBilateral_vel2;\n const vel = resolveSingleBilateral_vel;\n body1.getVelocityAtWorldPoint(pos1, vel1);\n body2.getVelocityAtWorldPoint(pos2, vel2);\n vel1.vsub(vel2, vel);\n const rel_vel = normal.dot(vel);\n const contactDamping = 0.2;\n const massTerm = 1 / (body1.invMass + body2.invMass);\n const impulse = -contactDamping * rel_vel * massTerm;\n return impulse;\n}\n\n/**\n * Spherical shape\n * @example\n * const radius = 1\n * const sphereShape = new CANNON.Sphere(radius)\n * const sphereBody = new CANNON.Body({ mass: 1, shape: sphereShape })\n * world.addBody(sphereBody)\n */\nclass Sphere extends Shape {\n /**\n * The radius of the sphere.\n */\n\n /**\n *\n * @param radius The radius of the sphere, a non-negative number.\n */\n constructor(radius) {\n super({\n type: Shape.types.SPHERE\n });\n this.radius = radius !== undefined ? radius : 1.0;\n\n if (this.radius < 0) {\n throw new Error('The sphere radius cannot be negative.');\n }\n\n this.updateBoundingSphereRadius();\n }\n /** calculateLocalInertia */\n\n\n calculateLocalInertia(mass, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n const I = 2.0 * mass * this.radius * this.radius / 5.0;\n target.x = I;\n target.y = I;\n target.z = I;\n return target;\n }\n /** volume */\n\n\n volume() {\n return 4.0 * Math.PI * Math.pow(this.radius, 3) / 3.0;\n }\n\n updateBoundingSphereRadius() {\n this.boundingSphereRadius = this.radius;\n }\n\n calculateWorldAABB(pos, quat, min, max) {\n const r = this.radius;\n const axes = ['x', 'y', 'z'];\n\n for (let i = 0; i < axes.length; i++) {\n const ax = axes[i];\n min[ax] = pos[ax] - r;\n max[ax] = pos[ax] + r;\n }\n }\n\n}\n\n/**\n * Simple vehicle helper class with spherical rigid body wheels.\n */\nclass RigidVehicle {\n /**\n * The bodies of the wheels.\n */\n\n /**\n * The chassis body.\n */\n\n /**\n * The constraints.\n */\n\n /**\n * The wheel axes.\n */\n\n /**\n * The wheel forces.\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.wheelBodies = [];\n this.coordinateSystem = typeof options.coordinateSystem !== 'undefined' ? options.coordinateSystem.clone() : new Vec3(1, 2, 3);\n\n if (options.chassisBody) {\n this.chassisBody = options.chassisBody;\n } else {\n // No chassis body given. Create it!\n this.chassisBody = new Body({\n mass: 1,\n shape: new Box(new Vec3(5, 0.5, 2))\n });\n }\n\n this.constraints = [];\n this.wheelAxes = [];\n this.wheelForces = [];\n }\n /**\n * Add a wheel\n */\n\n\n addWheel(options) {\n if (options === void 0) {\n options = {};\n }\n\n let wheelBody;\n\n if (options.body) {\n wheelBody = options.body;\n } else {\n // No wheel body given. Create it!\n wheelBody = new Body({\n mass: 1,\n shape: new Sphere(1.2)\n });\n }\n\n this.wheelBodies.push(wheelBody);\n this.wheelForces.push(0); // Position constrain wheels\n\n const position = typeof options.position !== 'undefined' ? options.position.clone() : new Vec3(); // Set position locally to the chassis\n\n const worldPosition = new Vec3();\n this.chassisBody.pointToWorldFrame(position, worldPosition);\n wheelBody.position.set(worldPosition.x, worldPosition.y, worldPosition.z); // Constrain wheel\n\n const axis = typeof options.axis !== 'undefined' ? options.axis.clone() : new Vec3(0, 0, 1);\n this.wheelAxes.push(axis);\n const hingeConstraint = new HingeConstraint(this.chassisBody, wheelBody, {\n pivotA: position,\n axisA: axis,\n pivotB: Vec3.ZERO,\n axisB: axis,\n collideConnected: false\n });\n this.constraints.push(hingeConstraint);\n return this.wheelBodies.length - 1;\n }\n /**\n * Set the steering value of a wheel.\n * @todo check coordinateSystem\n */\n\n\n setSteeringValue(value, wheelIndex) {\n // Set angle of the hinge axis\n const axis = this.wheelAxes[wheelIndex];\n const c = Math.cos(value);\n const s = Math.sin(value);\n const x = axis.x;\n const z = axis.z;\n this.constraints[wheelIndex].axisA.set(-c * x + s * z, 0, s * x + c * z);\n }\n /**\n * Set the target rotational speed of the hinge constraint.\n */\n\n\n setMotorSpeed(value, wheelIndex) {\n const hingeConstraint = this.constraints[wheelIndex];\n hingeConstraint.enableMotor();\n hingeConstraint.motorTargetVelocity = value;\n }\n /**\n * Set the target rotational speed of the hinge constraint.\n */\n\n\n disableMotor(wheelIndex) {\n const hingeConstraint = this.constraints[wheelIndex];\n hingeConstraint.disableMotor();\n }\n /**\n * Set the wheel force to apply on one of the wheels each time step\n */\n\n\n setWheelForce(value, wheelIndex) {\n this.wheelForces[wheelIndex] = value;\n }\n /**\n * Apply a torque on one of the wheels.\n */\n\n\n applyWheelForce(value, wheelIndex) {\n const axis = this.wheelAxes[wheelIndex];\n const wheelBody = this.wheelBodies[wheelIndex];\n const bodyTorque = wheelBody.torque;\n axis.scale(value, torque);\n wheelBody.vectorToWorldFrame(torque, torque);\n bodyTorque.vadd(torque, bodyTorque);\n }\n /**\n * Add the vehicle including its constraints to the world.\n */\n\n\n addToWorld(world) {\n const constraints = this.constraints;\n const bodies = this.wheelBodies.concat([this.chassisBody]);\n\n for (let i = 0; i < bodies.length; i++) {\n world.addBody(bodies[i]);\n }\n\n for (let i = 0; i < constraints.length; i++) {\n world.addConstraint(constraints[i]);\n }\n\n world.addEventListener('preStep', this._update.bind(this));\n }\n\n _update() {\n const wheelForces = this.wheelForces;\n\n for (let i = 0; i < wheelForces.length; i++) {\n this.applyWheelForce(wheelForces[i], i);\n }\n }\n /**\n * Remove the vehicle including its constraints from the world.\n */\n\n\n removeFromWorld(world) {\n const constraints = this.constraints;\n const bodies = this.wheelBodies.concat([this.chassisBody]);\n\n for (let i = 0; i < bodies.length; i++) {\n world.removeBody(bodies[i]);\n }\n\n for (let i = 0; i < constraints.length; i++) {\n world.removeConstraint(constraints[i]);\n }\n }\n /**\n * Get current rotational velocity of a wheel\n */\n\n\n getWheelSpeed(wheelIndex) {\n const axis = this.wheelAxes[wheelIndex];\n const wheelBody = this.wheelBodies[wheelIndex];\n const w = wheelBody.angularVelocity;\n this.chassisBody.vectorToWorldFrame(axis, worldAxis);\n return w.dot(worldAxis);\n }\n\n}\nconst torque = new Vec3();\nconst worldAxis = new Vec3();\n\n/**\n * Smoothed-particle hydrodynamics system\n * @todo Make parameters customizable in the constructor\n */\nclass SPHSystem {\n /**\n * The particles array.\n */\n\n /**\n * Density of the system (kg/m3).\n * @default 1\n */\n\n /**\n * Distance below which two particles are considered to be neighbors.\n * It should be adjusted so there are about 15-20 neighbor particles within this radius.\n * @default 1\n */\n\n /**\n * @default 1\n */\n\n /**\n * Viscosity of the system.\n * @default 0.01\n */\n\n /**\n * @default 0.000001\n */\n constructor() {\n this.particles = [];\n this.density = 1;\n this.smoothingRadius = 1;\n this.speedOfSound = 1;\n this.viscosity = 0.01;\n this.eps = 0.000001; // Stuff Computed per particle\n\n this.pressures = [];\n this.densities = [];\n this.neighbors = [];\n }\n /**\n * Add a particle to the system.\n */\n\n\n add(particle) {\n this.particles.push(particle);\n\n if (this.neighbors.length < this.particles.length) {\n this.neighbors.push([]);\n }\n }\n /**\n * Remove a particle from the system.\n */\n\n\n remove(particle) {\n const idx = this.particles.indexOf(particle);\n\n if (idx !== -1) {\n this.particles.splice(idx, 1);\n\n if (this.neighbors.length > this.particles.length) {\n this.neighbors.pop();\n }\n }\n }\n /**\n * Get neighbors within smoothing volume, save in the array neighbors\n */\n\n\n getNeighbors(particle, neighbors) {\n const N = this.particles.length;\n const id = particle.id;\n const R2 = this.smoothingRadius * this.smoothingRadius;\n const dist = SPHSystem_getNeighbors_dist;\n\n for (let i = 0; i !== N; i++) {\n const p = this.particles[i];\n p.position.vsub(particle.position, dist);\n\n if (id !== p.id && dist.lengthSquared() < R2) {\n neighbors.push(p);\n }\n }\n }\n\n update() {\n const N = this.particles.length;\n const dist = SPHSystem_update_dist;\n const cs = this.speedOfSound;\n const eps = this.eps;\n\n for (let i = 0; i !== N; i++) {\n const p = this.particles[i]; // Current particle\n\n const neighbors = this.neighbors[i]; // Get neighbors\n\n neighbors.length = 0;\n this.getNeighbors(p, neighbors);\n neighbors.push(this.particles[i]); // Add current too\n\n const numNeighbors = neighbors.length; // Accumulate density for the particle\n\n let sum = 0.0;\n\n for (let j = 0; j !== numNeighbors; j++) {\n //printf(\"Current particle has position %f %f %f\\n\",objects[id].pos.x(),objects[id].pos.y(),objects[id].pos.z());\n p.position.vsub(neighbors[j].position, dist);\n const len = dist.length();\n const weight = this.w(len);\n sum += neighbors[j].mass * weight;\n } // Save\n\n\n this.densities[i] = sum;\n this.pressures[i] = cs * cs * (this.densities[i] - this.density);\n } // Add forces\n // Sum to these accelerations\n\n\n const a_pressure = SPHSystem_update_a_pressure;\n const a_visc = SPHSystem_update_a_visc;\n const gradW = SPHSystem_update_gradW;\n const r_vec = SPHSystem_update_r_vec;\n const u = SPHSystem_update_u;\n\n for (let i = 0; i !== N; i++) {\n const particle = this.particles[i];\n a_pressure.set(0, 0, 0);\n a_visc.set(0, 0, 0); // Init vars\n\n let Pij;\n let nabla;\n\n const neighbors = this.neighbors[i];\n const numNeighbors = neighbors.length; //printf(\"Neighbors: \");\n\n for (let j = 0; j !== numNeighbors; j++) {\n const neighbor = neighbors[j]; //printf(\"%d \",nj);\n // Get r once for all..\n\n particle.position.vsub(neighbor.position, r_vec);\n const r = r_vec.length(); // Pressure contribution\n\n Pij = -neighbor.mass * (this.pressures[i] / (this.densities[i] * this.densities[i] + eps) + this.pressures[j] / (this.densities[j] * this.densities[j] + eps));\n this.gradw(r_vec, gradW); // Add to pressure acceleration\n\n gradW.scale(Pij, gradW);\n a_pressure.vadd(gradW, a_pressure); // Viscosity contribution\n\n neighbor.velocity.vsub(particle.velocity, u);\n u.scale(1.0 / (0.0001 + this.densities[i] * this.densities[j]) * this.viscosity * neighbor.mass, u);\n nabla = this.nablaw(r);\n u.scale(nabla, u); // Add to viscosity acceleration\n\n a_visc.vadd(u, a_visc);\n } // Calculate force\n\n\n a_visc.scale(particle.mass, a_visc);\n a_pressure.scale(particle.mass, a_pressure); // Add force to particles\n\n particle.force.vadd(a_visc, particle.force);\n particle.force.vadd(a_pressure, particle.force);\n }\n } // Calculate the weight using the W(r) weightfunction\n\n\n w(r) {\n // 315\n const h = this.smoothingRadius;\n return 315.0 / (64.0 * Math.PI * h ** 9) * (h * h - r * r) ** 3;\n } // calculate gradient of the weight function\n\n\n gradw(rVec, resultVec) {\n const r = rVec.length();\n const h = this.smoothingRadius;\n rVec.scale(945.0 / (32.0 * Math.PI * h ** 9) * (h * h - r * r) ** 2, resultVec);\n } // Calculate nabla(W)\n\n\n nablaw(r) {\n const h = this.smoothingRadius;\n const nabla = 945.0 / (32.0 * Math.PI * h ** 9) * (h * h - r * r) * (7 * r * r - 3 * h * h);\n return nabla;\n }\n\n}\nconst SPHSystem_getNeighbors_dist = new Vec3(); // Temp vectors for calculation\n\nconst SPHSystem_update_dist = new Vec3(); // Relative velocity\n\nconst SPHSystem_update_a_pressure = new Vec3();\nconst SPHSystem_update_a_visc = new Vec3();\nconst SPHSystem_update_gradW = new Vec3();\nconst SPHSystem_update_r_vec = new Vec3();\nconst SPHSystem_update_u = new Vec3();\n\n/**\n * Cylinder class.\n * @example\n * const radiusTop = 0.5\n * const radiusBottom = 0.5\n * const height = 2\n * const numSegments = 12\n * const cylinderShape = new CANNON.Cylinder(radiusTop, radiusBottom, height, numSegments)\n * const cylinderBody = new CANNON.Body({ mass: 1, shape: cylinderShape })\n * world.addBody(cylinderBody)\n */\n\nclass Cylinder extends ConvexPolyhedron {\n /** The radius of the top of the Cylinder. */\n\n /** The radius of the bottom of the Cylinder. */\n\n /** The height of the Cylinder. */\n\n /** The number of segments to build the cylinder out of. */\n\n /**\n * @param radiusTop The radius of the top of the Cylinder.\n * @param radiusBottom The radius of the bottom of the Cylinder.\n * @param height The height of the Cylinder.\n * @param numSegments The number of segments to build the cylinder out of.\n */\n constructor(radiusTop, radiusBottom, height, numSegments) {\n if (radiusTop === void 0) {\n radiusTop = 1;\n }\n\n if (radiusBottom === void 0) {\n radiusBottom = 1;\n }\n\n if (height === void 0) {\n height = 1;\n }\n\n if (numSegments === void 0) {\n numSegments = 8;\n }\n\n if (radiusTop < 0) {\n throw new Error('The cylinder radiusTop cannot be negative.');\n }\n\n if (radiusBottom < 0) {\n throw new Error('The cylinder radiusBottom cannot be negative.');\n }\n\n const N = numSegments;\n const vertices = [];\n const axes = [];\n const faces = [];\n const bottomface = [];\n const topface = [];\n const cos = Math.cos;\n const sin = Math.sin; // First bottom point\n\n vertices.push(new Vec3(-radiusBottom * sin(0), -height * 0.5, radiusBottom * cos(0)));\n bottomface.push(0); // First top point\n\n vertices.push(new Vec3(-radiusTop * sin(0), height * 0.5, radiusTop * cos(0)));\n topface.push(1);\n\n for (let i = 0; i < N; i++) {\n const theta = 2 * Math.PI / N * (i + 1);\n const thetaN = 2 * Math.PI / N * (i + 0.5);\n\n if (i < N - 1) {\n // Bottom\n vertices.push(new Vec3(-radiusBottom * sin(theta), -height * 0.5, radiusBottom * cos(theta)));\n bottomface.push(2 * i + 2); // Top\n\n vertices.push(new Vec3(-radiusTop * sin(theta), height * 0.5, radiusTop * cos(theta)));\n topface.push(2 * i + 3); // Face\n\n faces.push([2 * i, 2 * i + 1, 2 * i + 3, 2 * i + 2]);\n } else {\n faces.push([2 * i, 2 * i + 1, 1, 0]); // Connect\n } // Axis: we can cut off half of them if we have even number of segments\n\n\n if (N % 2 === 1 || i < N / 2) {\n axes.push(new Vec3(-sin(thetaN), 0, cos(thetaN)));\n }\n }\n\n faces.push(bottomface);\n axes.push(new Vec3(0, 1, 0)); // Reorder top face\n\n const temp = [];\n\n for (let i = 0; i < topface.length; i++) {\n temp.push(topface[topface.length - i - 1]);\n }\n\n faces.push(temp);\n super({\n vertices,\n faces,\n axes\n });\n this.type = Shape.types.CYLINDER;\n this.radiusTop = radiusTop;\n this.radiusBottom = radiusBottom;\n this.height = height;\n this.numSegments = numSegments;\n }\n\n}\n\n/**\n * Particle shape.\n * @example\n * const particleShape = new CANNON.Particle()\n * const particleBody = new CANNON.Body({ mass: 1, shape: particleShape })\n * world.addBody(particleBody)\n */\nclass Particle extends Shape {\n constructor() {\n super({\n type: Shape.types.PARTICLE\n });\n }\n /**\n * calculateLocalInertia\n */\n\n\n calculateLocalInertia(mass, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n target.set(0, 0, 0);\n return target;\n }\n\n volume() {\n return 0;\n }\n\n updateBoundingSphereRadius() {\n this.boundingSphereRadius = 0;\n }\n\n calculateWorldAABB(pos, quat, min, max) {\n // Get each axis max\n min.copy(pos);\n max.copy(pos);\n }\n\n}\n\n/**\n * A plane, facing in the Z direction. The plane has its surface at z=0 and everything below z=0 is assumed to be solid plane. To make the plane face in some other direction than z, you must put it inside a Body and rotate that body. See the demos.\n * @example\n * const planeShape = new CANNON.Plane()\n * const planeBody = new CANNON.Body({ mass: 0, shape: planeShape })\n * planeBody.quaternion.setFromEuler(-Math.PI / 2, 0, 0) // make it face up\n * world.addBody(planeBody)\n */\nclass Plane extends Shape {\n /** worldNormal */\n\n /** worldNormalNeedsUpdate */\n constructor() {\n super({\n type: Shape.types.PLANE\n }); // World oriented normal\n\n this.worldNormal = new Vec3();\n this.worldNormalNeedsUpdate = true;\n this.boundingSphereRadius = Number.MAX_VALUE;\n }\n /** computeWorldNormal */\n\n\n computeWorldNormal(quat) {\n const n = this.worldNormal;\n n.set(0, 0, 1);\n quat.vmult(n, n);\n this.worldNormalNeedsUpdate = false;\n }\n\n calculateLocalInertia(mass, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n return target;\n }\n\n volume() {\n return (// The plane is infinite...\n Number.MAX_VALUE\n );\n }\n\n calculateWorldAABB(pos, quat, min, max) {\n // The plane AABB is infinite, except if the normal is pointing along any axis\n tempNormal.set(0, 0, 1); // Default plane normal is z\n\n quat.vmult(tempNormal, tempNormal);\n const maxVal = Number.MAX_VALUE;\n min.set(-maxVal, -maxVal, -maxVal);\n max.set(maxVal, maxVal, maxVal);\n\n if (tempNormal.x === 1) {\n max.x = pos.x;\n } else if (tempNormal.x === -1) {\n min.x = pos.x;\n }\n\n if (tempNormal.y === 1) {\n max.y = pos.y;\n } else if (tempNormal.y === -1) {\n min.y = pos.y;\n }\n\n if (tempNormal.z === 1) {\n max.z = pos.z;\n } else if (tempNormal.z === -1) {\n min.z = pos.z;\n }\n }\n\n updateBoundingSphereRadius() {\n this.boundingSphereRadius = Number.MAX_VALUE;\n }\n\n}\nconst tempNormal = new Vec3();\n\n/**\n * Heightfield shape class. Height data is given as an array. These data points are spread out evenly with a given distance.\n * @todo Should be possible to use along all axes, not just y\n * @todo should be possible to scale along all axes\n * @todo Refactor elementSize to elementSizeX and elementSizeY\n *\n * @example\n * // Generate some height data (y-values).\n * const data = []\n * for (let i = 0; i < 1000; i++) {\n * const y = 0.5 * Math.cos(0.2 * i)\n * data.push(y)\n * }\n *\n * // Create the heightfield shape\n * const heightfieldShape = new CANNON.Heightfield(data, {\n * elementSize: 1 // Distance between the data points in X and Y directions\n * })\n * const heightfieldBody = new CANNON.Body({ shape: heightfieldShape })\n * world.addBody(heightfieldBody)\n */\nclass Heightfield extends Shape {\n /**\n * An array of numbers, or height values, that are spread out along the x axis.\n */\n\n /**\n * Max value of the data points in the data array.\n */\n\n /**\n * Minimum value of the data points in the data array.\n */\n\n /**\n * World spacing between the data points in X and Y direction.\n * @todo elementSizeX and Y\n * @default 1\n */\n\n /**\n * @default true\n */\n\n /**\n * @param data An array of numbers, or height values, that are spread out along the x axis.\n */\n constructor(data, options) {\n if (options === void 0) {\n options = {};\n }\n\n options = Utils.defaults(options, {\n maxValue: null,\n minValue: null,\n elementSize: 1\n });\n super({\n type: Shape.types.HEIGHTFIELD\n });\n this.data = data;\n this.maxValue = options.maxValue;\n this.minValue = options.minValue;\n this.elementSize = options.elementSize;\n\n if (options.minValue === null) {\n this.updateMinValue();\n }\n\n if (options.maxValue === null) {\n this.updateMaxValue();\n }\n\n this.cacheEnabled = true;\n this.pillarConvex = new ConvexPolyhedron();\n this.pillarOffset = new Vec3();\n this.updateBoundingSphereRadius(); // \"i_j_isUpper\" => { convex: ..., offset: ... }\n // for example:\n // _cachedPillars[\"0_2_1\"]\n\n this._cachedPillars = {};\n }\n /**\n * Call whenever you change the data array.\n */\n\n\n update() {\n this._cachedPillars = {};\n }\n /**\n * Update the `minValue` property\n */\n\n\n updateMinValue() {\n const data = this.data;\n let minValue = data[0][0];\n\n for (let i = 0; i !== data.length; i++) {\n for (let j = 0; j !== data[i].length; j++) {\n const v = data[i][j];\n\n if (v < minValue) {\n minValue = v;\n }\n }\n }\n\n this.minValue = minValue;\n }\n /**\n * Update the `maxValue` property\n */\n\n\n updateMaxValue() {\n const data = this.data;\n let maxValue = data[0][0];\n\n for (let i = 0; i !== data.length; i++) {\n for (let j = 0; j !== data[i].length; j++) {\n const v = data[i][j];\n\n if (v > maxValue) {\n maxValue = v;\n }\n }\n }\n\n this.maxValue = maxValue;\n }\n /**\n * Set the height value at an index. Don't forget to update maxValue and minValue after you're done.\n */\n\n\n setHeightValueAtIndex(xi, yi, value) {\n const data = this.data;\n data[xi][yi] = value; // Invalidate cache\n\n this.clearCachedConvexTrianglePillar(xi, yi, false);\n\n if (xi > 0) {\n this.clearCachedConvexTrianglePillar(xi - 1, yi, true);\n this.clearCachedConvexTrianglePillar(xi - 1, yi, false);\n }\n\n if (yi > 0) {\n this.clearCachedConvexTrianglePillar(xi, yi - 1, true);\n this.clearCachedConvexTrianglePillar(xi, yi - 1, false);\n }\n\n if (yi > 0 && xi > 0) {\n this.clearCachedConvexTrianglePillar(xi - 1, yi - 1, true);\n }\n }\n /**\n * Get max/min in a rectangle in the matrix data\n * @param result An array to store the results in.\n * @return The result array, if it was passed in. Minimum will be at position 0 and max at 1.\n */\n\n\n getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, result) {\n if (result === void 0) {\n result = [];\n }\n\n // Get max and min of the data\n const data = this.data; // Set first value\n\n let max = this.minValue;\n\n for (let i = iMinX; i <= iMaxX; i++) {\n for (let j = iMinY; j <= iMaxY; j++) {\n const height = data[i][j];\n\n if (height > max) {\n max = height;\n }\n }\n }\n\n result[0] = this.minValue;\n result[1] = max;\n }\n /**\n * Get the index of a local position on the heightfield. The indexes indicate the rectangles, so if your terrain is made of N x N height data points, you will have rectangle indexes ranging from 0 to N-1.\n * @param result Two-element array\n * @param clamp If the position should be clamped to the heightfield edge.\n */\n\n\n getIndexOfPosition(x, y, result, clamp) {\n // Get the index of the data points to test against\n const w = this.elementSize;\n const data = this.data;\n let xi = Math.floor(x / w);\n let yi = Math.floor(y / w);\n result[0] = xi;\n result[1] = yi;\n\n if (clamp) {\n // Clamp index to edges\n if (xi < 0) {\n xi = 0;\n }\n\n if (yi < 0) {\n yi = 0;\n }\n\n if (xi >= data.length - 1) {\n xi = data.length - 1;\n }\n\n if (yi >= data[0].length - 1) {\n yi = data[0].length - 1;\n }\n } // Bail out if we are out of the terrain\n\n\n if (xi < 0 || yi < 0 || xi >= data.length - 1 || yi >= data[0].length - 1) {\n return false;\n }\n\n return true;\n }\n\n getTriangleAt(x, y, edgeClamp, a, b, c) {\n const idx = getHeightAt_idx;\n this.getIndexOfPosition(x, y, idx, edgeClamp);\n let xi = idx[0];\n let yi = idx[1];\n const data = this.data;\n\n if (edgeClamp) {\n xi = Math.min(data.length - 2, Math.max(0, xi));\n yi = Math.min(data[0].length - 2, Math.max(0, yi));\n }\n\n const elementSize = this.elementSize;\n const lowerDist2 = (x / elementSize - xi) ** 2 + (y / elementSize - yi) ** 2;\n const upperDist2 = (x / elementSize - (xi + 1)) ** 2 + (y / elementSize - (yi + 1)) ** 2;\n const upper = lowerDist2 > upperDist2;\n this.getTriangle(xi, yi, upper, a, b, c);\n return upper;\n }\n\n getNormalAt(x, y, edgeClamp, result) {\n const a = getNormalAt_a;\n const b = getNormalAt_b;\n const c = getNormalAt_c;\n const e0 = getNormalAt_e0;\n const e1 = getNormalAt_e1;\n this.getTriangleAt(x, y, edgeClamp, a, b, c);\n b.vsub(a, e0);\n c.vsub(a, e1);\n e0.cross(e1, result);\n result.normalize();\n }\n /**\n * Get an AABB of a square in the heightfield\n * @param xi\n * @param yi\n * @param result\n */\n\n\n getAabbAtIndex(xi, yi, _ref) {\n let {\n lowerBound,\n upperBound\n } = _ref;\n const data = this.data;\n const elementSize = this.elementSize;\n lowerBound.set(xi * elementSize, yi * elementSize, data[xi][yi]);\n upperBound.set((xi + 1) * elementSize, (yi + 1) * elementSize, data[xi + 1][yi + 1]);\n }\n /**\n * Get the height in the heightfield at a given position\n */\n\n\n getHeightAt(x, y, edgeClamp) {\n const data = this.data;\n const a = getHeightAt_a;\n const b = getHeightAt_b;\n const c = getHeightAt_c;\n const idx = getHeightAt_idx;\n this.getIndexOfPosition(x, y, idx, edgeClamp);\n let xi = idx[0];\n let yi = idx[1];\n\n if (edgeClamp) {\n xi = Math.min(data.length - 2, Math.max(0, xi));\n yi = Math.min(data[0].length - 2, Math.max(0, yi));\n }\n\n const upper = this.getTriangleAt(x, y, edgeClamp, a, b, c);\n barycentricWeights(x, y, a.x, a.y, b.x, b.y, c.x, c.y, getHeightAt_weights);\n const w = getHeightAt_weights;\n\n if (upper) {\n // Top triangle verts\n return data[xi + 1][yi + 1] * w.x + data[xi][yi + 1] * w.y + data[xi + 1][yi] * w.z;\n } else {\n // Top triangle verts\n return data[xi][yi] * w.x + data[xi + 1][yi] * w.y + data[xi][yi + 1] * w.z;\n }\n }\n\n getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle) {\n return `${xi}_${yi}_${getUpperTriangle ? 1 : 0}`;\n }\n\n getCachedConvexTrianglePillar(xi, yi, getUpperTriangle) {\n return this._cachedPillars[this.getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle)];\n }\n\n setCachedConvexTrianglePillar(xi, yi, getUpperTriangle, convex, offset) {\n this._cachedPillars[this.getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle)] = {\n convex,\n offset\n };\n }\n\n clearCachedConvexTrianglePillar(xi, yi, getUpperTriangle) {\n delete this._cachedPillars[this.getCacheConvexTrianglePillarKey(xi, yi, getUpperTriangle)];\n }\n /**\n * Get a triangle from the heightfield\n */\n\n\n getTriangle(xi, yi, upper, a, b, c) {\n const data = this.data;\n const elementSize = this.elementSize;\n\n if (upper) {\n // Top triangle verts\n a.set((xi + 1) * elementSize, (yi + 1) * elementSize, data[xi + 1][yi + 1]);\n b.set(xi * elementSize, (yi + 1) * elementSize, data[xi][yi + 1]);\n c.set((xi + 1) * elementSize, yi * elementSize, data[xi + 1][yi]);\n } else {\n // Top triangle verts\n a.set(xi * elementSize, yi * elementSize, data[xi][yi]);\n b.set((xi + 1) * elementSize, yi * elementSize, data[xi + 1][yi]);\n c.set(xi * elementSize, (yi + 1) * elementSize, data[xi][yi + 1]);\n }\n }\n /**\n * Get a triangle in the terrain in the form of a triangular convex shape.\n */\n\n\n getConvexTrianglePillar(xi, yi, getUpperTriangle) {\n let result = this.pillarConvex;\n let offsetResult = this.pillarOffset;\n\n if (this.cacheEnabled) {\n const data = this.getCachedConvexTrianglePillar(xi, yi, getUpperTriangle);\n\n if (data) {\n this.pillarConvex = data.convex;\n this.pillarOffset = data.offset;\n return;\n }\n\n result = new ConvexPolyhedron();\n offsetResult = new Vec3();\n this.pillarConvex = result;\n this.pillarOffset = offsetResult;\n }\n\n const data = this.data;\n const elementSize = this.elementSize;\n const faces = result.faces; // Reuse verts if possible\n\n result.vertices.length = 6;\n\n for (let i = 0; i < 6; i++) {\n if (!result.vertices[i]) {\n result.vertices[i] = new Vec3();\n }\n } // Reuse faces if possible\n\n\n faces.length = 5;\n\n for (let i = 0; i < 5; i++) {\n if (!faces[i]) {\n faces[i] = [];\n }\n }\n\n const verts = result.vertices;\n const h = (Math.min(data[xi][yi], data[xi + 1][yi], data[xi][yi + 1], data[xi + 1][yi + 1]) - this.minValue) / 2 + this.minValue;\n\n if (!getUpperTriangle) {\n // Center of the triangle pillar - all polygons are given relative to this one\n offsetResult.set((xi + 0.25) * elementSize, // sort of center of a triangle\n (yi + 0.25) * elementSize, h // vertical center\n ); // Top triangle verts\n\n verts[0].set(-0.25 * elementSize, -0.25 * elementSize, data[xi][yi] - h);\n verts[1].set(0.75 * elementSize, -0.25 * elementSize, data[xi + 1][yi] - h);\n verts[2].set(-0.25 * elementSize, 0.75 * elementSize, data[xi][yi + 1] - h); // bottom triangle verts\n\n verts[3].set(-0.25 * elementSize, -0.25 * elementSize, -Math.abs(h) - 1);\n verts[4].set(0.75 * elementSize, -0.25 * elementSize, -Math.abs(h) - 1);\n verts[5].set(-0.25 * elementSize, 0.75 * elementSize, -Math.abs(h) - 1); // top triangle\n\n faces[0][0] = 0;\n faces[0][1] = 1;\n faces[0][2] = 2; // bottom triangle\n\n faces[1][0] = 5;\n faces[1][1] = 4;\n faces[1][2] = 3; // -x facing quad\n\n faces[2][0] = 0;\n faces[2][1] = 2;\n faces[2][2] = 5;\n faces[2][3] = 3; // -y facing quad\n\n faces[3][0] = 1;\n faces[3][1] = 0;\n faces[3][2] = 3;\n faces[3][3] = 4; // +xy facing quad\n\n faces[4][0] = 4;\n faces[4][1] = 5;\n faces[4][2] = 2;\n faces[4][3] = 1;\n } else {\n // Center of the triangle pillar - all polygons are given relative to this one\n offsetResult.set((xi + 0.75) * elementSize, // sort of center of a triangle\n (yi + 0.75) * elementSize, h // vertical center\n ); // Top triangle verts\n\n verts[0].set(0.25 * elementSize, 0.25 * elementSize, data[xi + 1][yi + 1] - h);\n verts[1].set(-0.75 * elementSize, 0.25 * elementSize, data[xi][yi + 1] - h);\n verts[2].set(0.25 * elementSize, -0.75 * elementSize, data[xi + 1][yi] - h); // bottom triangle verts\n\n verts[3].set(0.25 * elementSize, 0.25 * elementSize, -Math.abs(h) - 1);\n verts[4].set(-0.75 * elementSize, 0.25 * elementSize, -Math.abs(h) - 1);\n verts[5].set(0.25 * elementSize, -0.75 * elementSize, -Math.abs(h) - 1); // Top triangle\n\n faces[0][0] = 0;\n faces[0][1] = 1;\n faces[0][2] = 2; // bottom triangle\n\n faces[1][0] = 5;\n faces[1][1] = 4;\n faces[1][2] = 3; // +x facing quad\n\n faces[2][0] = 2;\n faces[2][1] = 5;\n faces[2][2] = 3;\n faces[2][3] = 0; // +y facing quad\n\n faces[3][0] = 3;\n faces[3][1] = 4;\n faces[3][2] = 1;\n faces[3][3] = 0; // -xy facing quad\n\n faces[4][0] = 1;\n faces[4][1] = 4;\n faces[4][2] = 5;\n faces[4][3] = 2;\n }\n\n result.computeNormals();\n result.computeEdges();\n result.updateBoundingSphereRadius();\n this.setCachedConvexTrianglePillar(xi, yi, getUpperTriangle, result, offsetResult);\n }\n\n calculateLocalInertia(mass, target) {\n if (target === void 0) {\n target = new Vec3();\n }\n\n target.set(0, 0, 0);\n return target;\n }\n\n volume() {\n return (// The terrain is infinite\n Number.MAX_VALUE\n );\n }\n\n calculateWorldAABB(pos, quat, min, max) {\n /** @TODO do it properly */\n min.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n max.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n }\n\n updateBoundingSphereRadius() {\n // Use the bounding box of the min/max values\n const data = this.data;\n const s = this.elementSize;\n this.boundingSphereRadius = new Vec3(data.length * s, data[0].length * s, Math.max(Math.abs(this.maxValue), Math.abs(this.minValue))).length();\n }\n /**\n * Sets the height values from an image. Currently only supported in browser.\n */\n\n\n setHeightsFromImage(image, scale) {\n const {\n x,\n z,\n y\n } = scale;\n const canvas = document.createElement('canvas');\n canvas.width = image.width;\n canvas.height = image.height;\n const context = canvas.getContext('2d');\n context.drawImage(image, 0, 0);\n const imageData = context.getImageData(0, 0, image.width, image.height);\n const matrix = this.data;\n matrix.length = 0;\n this.elementSize = Math.abs(x) / imageData.width;\n\n for (let i = 0; i < imageData.height; i++) {\n const row = [];\n\n for (let j = 0; j < imageData.width; j++) {\n const a = imageData.data[(i * imageData.height + j) * 4];\n const b = imageData.data[(i * imageData.height + j) * 4 + 1];\n const c = imageData.data[(i * imageData.height + j) * 4 + 2];\n const height = (a + b + c) / 4 / 255 * z;\n\n if (x < 0) {\n row.push(height);\n } else {\n row.unshift(height);\n }\n }\n\n if (y < 0) {\n matrix.unshift(row);\n } else {\n matrix.push(row);\n }\n }\n\n this.updateMaxValue();\n this.updateMinValue();\n this.update();\n }\n\n}\nconst getHeightAt_idx = [];\nconst getHeightAt_weights = new Vec3();\nconst getHeightAt_a = new Vec3();\nconst getHeightAt_b = new Vec3();\nconst getHeightAt_c = new Vec3();\nconst getNormalAt_a = new Vec3();\nconst getNormalAt_b = new Vec3();\nconst getNormalAt_c = new Vec3();\nconst getNormalAt_e0 = new Vec3();\nconst getNormalAt_e1 = new Vec3(); // from https://en.wikipedia.org/wiki/Barycentric_coordinate_system\n\nfunction barycentricWeights(x, y, ax, ay, bx, by, cx, cy, result) {\n result.x = ((by - cy) * (x - cx) + (cx - bx) * (y - cy)) / ((by - cy) * (ax - cx) + (cx - bx) * (ay - cy));\n result.y = ((cy - ay) * (x - cx) + (ax - cx) * (y - cy)) / ((by - cy) * (ax - cx) + (cx - bx) * (ay - cy));\n result.z = 1 - result.x - result.y;\n}\n\n/**\n * OctreeNode\n */\nclass OctreeNode {\n /** The root node */\n\n /** Boundary of this node */\n\n /** Contained data at the current node level */\n\n /** Children to this node */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.root = options.root || null;\n this.aabb = options.aabb ? options.aabb.clone() : new AABB();\n this.data = [];\n this.children = [];\n }\n /**\n * reset\n */\n\n\n reset() {\n this.children.length = this.data.length = 0;\n }\n /**\n * Insert data into this node\n * @return True if successful, otherwise false\n */\n\n\n insert(aabb, elementData, level) {\n if (level === void 0) {\n level = 0;\n }\n\n const nodeData = this.data; // Ignore objects that do not belong in this node\n\n if (!this.aabb.contains(aabb)) {\n return false; // object cannot be added\n }\n\n const children = this.children;\n const maxDepth = this.maxDepth || this.root.maxDepth;\n\n if (level < maxDepth) {\n // Subdivide if there are no children yet\n let subdivided = false;\n\n if (!children.length) {\n this.subdivide();\n subdivided = true;\n } // add to whichever node will accept it\n\n\n for (let i = 0; i !== 8; i++) {\n if (children[i].insert(aabb, elementData, level + 1)) {\n return true;\n }\n }\n\n if (subdivided) {\n // No children accepted! Might as well just remove em since they contain none\n children.length = 0;\n }\n } // Too deep, or children didnt want it. add it in current node\n\n\n nodeData.push(elementData);\n return true;\n }\n /**\n * Create 8 equally sized children nodes and put them in the `children` array.\n */\n\n\n subdivide() {\n const aabb = this.aabb;\n const l = aabb.lowerBound;\n const u = aabb.upperBound;\n const children = this.children;\n children.push(new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(0, 0, 0)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(1, 0, 0)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(1, 1, 0)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(1, 1, 1)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(0, 1, 1)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(0, 0, 1)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(1, 0, 1)\n })\n }), new OctreeNode({\n aabb: new AABB({\n lowerBound: new Vec3(0, 1, 0)\n })\n }));\n u.vsub(l, halfDiagonal);\n halfDiagonal.scale(0.5, halfDiagonal);\n const root = this.root || this;\n\n for (let i = 0; i !== 8; i++) {\n const child = children[i]; // Set current node as root\n\n child.root = root; // Compute bounds\n\n const lowerBound = child.aabb.lowerBound;\n lowerBound.x *= halfDiagonal.x;\n lowerBound.y *= halfDiagonal.y;\n lowerBound.z *= halfDiagonal.z;\n lowerBound.vadd(l, lowerBound); // Upper bound is always lower bound + halfDiagonal\n\n lowerBound.vadd(halfDiagonal, child.aabb.upperBound);\n }\n }\n /**\n * Get all data, potentially within an AABB\n * @return The \"result\" object\n */\n\n\n aabbQuery(aabb, result) {\n this.data; // abort if the range does not intersect this node\n // if (!this.aabb.overlaps(aabb)){\n // return result;\n // }\n // Add objects at this level\n // Array.prototype.push.apply(result, nodeData);\n // Add child data\n // @todo unwrap recursion into a queue / loop, that's faster in JS\n\n this.children; // for (let i = 0, N = this.children.length; i !== N; i++) {\n // children[i].aabbQuery(aabb, result);\n // }\n\n const queue = [this];\n\n while (queue.length) {\n const node = queue.pop();\n\n if (node.aabb.overlaps(aabb)) {\n Array.prototype.push.apply(result, node.data);\n }\n\n Array.prototype.push.apply(queue, node.children);\n }\n\n return result;\n }\n /**\n * Get all data, potentially intersected by a ray.\n * @return The \"result\" object\n */\n\n\n rayQuery(ray, treeTransform, result) {\n // Use aabb query for now.\n\n /** @todo implement real ray query which needs less lookups */\n ray.getAABB(tmpAABB);\n tmpAABB.toLocalFrame(treeTransform, tmpAABB);\n this.aabbQuery(tmpAABB, result);\n return result;\n }\n /**\n * removeEmptyNodes\n */\n\n\n removeEmptyNodes() {\n for (let i = this.children.length - 1; i >= 0; i--) {\n this.children[i].removeEmptyNodes();\n\n if (!this.children[i].children.length && !this.children[i].data.length) {\n this.children.splice(i, 1);\n }\n }\n }\n\n}\n/**\n * Octree\n */\n\n\nclass Octree extends OctreeNode {\n /**\n * Maximum subdivision depth\n * @default 8\n */\n\n /**\n * @param aabb The total AABB of the tree\n */\n constructor(aabb, options) {\n if (options === void 0) {\n options = {};\n }\n\n super({\n root: null,\n aabb\n });\n this.maxDepth = typeof options.maxDepth !== 'undefined' ? options.maxDepth : 8;\n }\n\n}\nconst halfDiagonal = new Vec3();\nconst tmpAABB = new AABB();\n\n/**\n * Trimesh.\n * @example\n * // How to make a mesh with a single triangle\n * const vertices = [\n * 0, 0, 0, // vertex 0\n * 1, 0, 0, // vertex 1\n * 0, 1, 0 // vertex 2\n * ]\n * const indices = [\n * 0, 1, 2 // triangle 0\n * ]\n * const trimeshShape = new CANNON.Trimesh(vertices, indices)\n */\nclass Trimesh extends Shape {\n /**\n * vertices\n */\n\n /**\n * Array of integers, indicating which vertices each triangle consists of. The length of this array is thus 3 times the number of triangles.\n */\n\n /**\n * The normals data.\n */\n\n /**\n * The local AABB of the mesh.\n */\n\n /**\n * References to vertex pairs, making up all unique edges in the trimesh.\n */\n\n /**\n * Local scaling of the mesh. Use .setScale() to set it.\n */\n\n /**\n * The indexed triangles. Use .updateTree() to update it.\n */\n constructor(vertices, indices) {\n super({\n type: Shape.types.TRIMESH\n });\n this.vertices = new Float32Array(vertices);\n this.indices = new Int16Array(indices);\n this.normals = new Float32Array(indices.length);\n this.aabb = new AABB();\n this.edges = null;\n this.scale = new Vec3(1, 1, 1);\n this.tree = new Octree();\n this.updateEdges();\n this.updateNormals();\n this.updateAABB();\n this.updateBoundingSphereRadius();\n this.updateTree();\n }\n /**\n * updateTree\n */\n\n\n updateTree() {\n const tree = this.tree;\n tree.reset();\n tree.aabb.copy(this.aabb);\n const scale = this.scale; // The local mesh AABB is scaled, but the octree AABB should be unscaled\n\n tree.aabb.lowerBound.x *= 1 / scale.x;\n tree.aabb.lowerBound.y *= 1 / scale.y;\n tree.aabb.lowerBound.z *= 1 / scale.z;\n tree.aabb.upperBound.x *= 1 / scale.x;\n tree.aabb.upperBound.y *= 1 / scale.y;\n tree.aabb.upperBound.z *= 1 / scale.z; // Insert all triangles\n\n const triangleAABB = new AABB();\n const a = new Vec3();\n const b = new Vec3();\n const c = new Vec3();\n const points = [a, b, c];\n\n for (let i = 0; i < this.indices.length / 3; i++) {\n //this.getTriangleVertices(i, a, b, c);\n // Get unscaled triangle verts\n const i3 = i * 3;\n\n this._getUnscaledVertex(this.indices[i3], a);\n\n this._getUnscaledVertex(this.indices[i3 + 1], b);\n\n this._getUnscaledVertex(this.indices[i3 + 2], c);\n\n triangleAABB.setFromPoints(points);\n tree.insert(triangleAABB, i);\n }\n\n tree.removeEmptyNodes();\n }\n /**\n * Get triangles in a local AABB from the trimesh.\n * @param result An array of integers, referencing the queried triangles.\n */\n\n\n getTrianglesInAABB(aabb, result) {\n unscaledAABB.copy(aabb); // Scale it to local\n\n const scale = this.scale;\n const isx = scale.x;\n const isy = scale.y;\n const isz = scale.z;\n const l = unscaledAABB.lowerBound;\n const u = unscaledAABB.upperBound;\n l.x /= isx;\n l.y /= isy;\n l.z /= isz;\n u.x /= isx;\n u.y /= isy;\n u.z /= isz;\n return this.tree.aabbQuery(unscaledAABB, result);\n }\n /**\n * setScale\n */\n\n\n setScale(scale) {\n const wasUniform = this.scale.x === this.scale.y && this.scale.y === this.scale.z;\n const isUniform = scale.x === scale.y && scale.y === scale.z;\n\n if (!(wasUniform && isUniform)) {\n // Non-uniform scaling. Need to update normals.\n this.updateNormals();\n }\n\n this.scale.copy(scale);\n this.updateAABB();\n this.updateBoundingSphereRadius();\n }\n /**\n * Compute the normals of the faces. Will save in the `.normals` array.\n */\n\n\n updateNormals() {\n const n = computeNormals_n; // Generate normals\n\n const normals = this.normals;\n\n for (let i = 0; i < this.indices.length / 3; i++) {\n const i3 = i * 3;\n const a = this.indices[i3];\n const b = this.indices[i3 + 1];\n const c = this.indices[i3 + 2];\n this.getVertex(a, va);\n this.getVertex(b, vb);\n this.getVertex(c, vc);\n Trimesh.computeNormal(vb, va, vc, n);\n normals[i3] = n.x;\n normals[i3 + 1] = n.y;\n normals[i3 + 2] = n.z;\n }\n }\n /**\n * Update the `.edges` property\n */\n\n\n updateEdges() {\n const edges = {};\n\n const add = (a, b) => {\n const key = a < b ? `${a}_${b}` : `${b}_${a}`;\n edges[key] = true;\n };\n\n for (let i = 0; i < this.indices.length / 3; i++) {\n const i3 = i * 3;\n const a = this.indices[i3];\n const b = this.indices[i3 + 1];\n const c = this.indices[i3 + 2];\n add(a, b);\n add(b, c);\n add(c, a);\n }\n\n const keys = Object.keys(edges);\n this.edges = new Int16Array(keys.length * 2);\n\n for (let i = 0; i < keys.length; i++) {\n const indices = keys[i].split('_');\n this.edges[2 * i] = parseInt(indices[0], 10);\n this.edges[2 * i + 1] = parseInt(indices[1], 10);\n }\n }\n /**\n * Get an edge vertex\n * @param firstOrSecond 0 or 1, depending on which one of the vertices you need.\n * @param vertexStore Where to store the result\n */\n\n\n getEdgeVertex(edgeIndex, firstOrSecond, vertexStore) {\n const vertexIndex = this.edges[edgeIndex * 2 + (firstOrSecond ? 1 : 0)];\n this.getVertex(vertexIndex, vertexStore);\n }\n /**\n * Get a vector along an edge.\n */\n\n\n getEdgeVector(edgeIndex, vectorStore) {\n const va = getEdgeVector_va;\n const vb = getEdgeVector_vb;\n this.getEdgeVertex(edgeIndex, 0, va);\n this.getEdgeVertex(edgeIndex, 1, vb);\n vb.vsub(va, vectorStore);\n }\n /**\n * Get face normal given 3 vertices\n */\n\n\n static computeNormal(va, vb, vc, target) {\n vb.vsub(va, ab);\n vc.vsub(vb, cb);\n cb.cross(ab, target);\n\n if (!target.isZero()) {\n target.normalize();\n }\n }\n /**\n * Get vertex i.\n * @return The \"out\" vector object\n */\n\n\n getVertex(i, out) {\n const scale = this.scale;\n\n this._getUnscaledVertex(i, out);\n\n out.x *= scale.x;\n out.y *= scale.y;\n out.z *= scale.z;\n return out;\n }\n /**\n * Get raw vertex i\n * @return The \"out\" vector object\n */\n\n\n _getUnscaledVertex(i, out) {\n const i3 = i * 3;\n const vertices = this.vertices;\n return out.set(vertices[i3], vertices[i3 + 1], vertices[i3 + 2]);\n }\n /**\n * Get a vertex from the trimesh,transformed by the given position and quaternion.\n * @return The \"out\" vector object\n */\n\n\n getWorldVertex(i, pos, quat, out) {\n this.getVertex(i, out);\n Transform.pointToWorldFrame(pos, quat, out, out);\n return out;\n }\n /**\n * Get the three vertices for triangle i.\n */\n\n\n getTriangleVertices(i, a, b, c) {\n const i3 = i * 3;\n this.getVertex(this.indices[i3], a);\n this.getVertex(this.indices[i3 + 1], b);\n this.getVertex(this.indices[i3 + 2], c);\n }\n /**\n * Compute the normal of triangle i.\n * @return The \"target\" vector object\n */\n\n\n getNormal(i, target) {\n const i3 = i * 3;\n return target.set(this.normals[i3], this.normals[i3 + 1], this.normals[i3 + 2]);\n }\n /**\n * @return The \"target\" vector object\n */\n\n\n calculateLocalInertia(mass, target) {\n // Approximate with box inertia\n // Exact inertia calculation is overkill, but see http://geometrictools.com/Documentation/PolyhedralMassProperties.pdf for the correct way to do it\n this.computeLocalAABB(cli_aabb);\n const x = cli_aabb.upperBound.x - cli_aabb.lowerBound.x;\n const y = cli_aabb.upperBound.y - cli_aabb.lowerBound.y;\n const z = cli_aabb.upperBound.z - cli_aabb.lowerBound.z;\n return target.set(1.0 / 12.0 * mass * (2 * y * 2 * y + 2 * z * 2 * z), 1.0 / 12.0 * mass * (2 * x * 2 * x + 2 * z * 2 * z), 1.0 / 12.0 * mass * (2 * y * 2 * y + 2 * x * 2 * x));\n }\n /**\n * Compute the local AABB for the trimesh\n */\n\n\n computeLocalAABB(aabb) {\n const l = aabb.lowerBound;\n const u = aabb.upperBound;\n const n = this.vertices.length;\n this.vertices;\n const v = computeLocalAABB_worldVert;\n this.getVertex(0, v);\n l.copy(v);\n u.copy(v);\n\n for (let i = 0; i !== n; i++) {\n this.getVertex(i, v);\n\n if (v.x < l.x) {\n l.x = v.x;\n } else if (v.x > u.x) {\n u.x = v.x;\n }\n\n if (v.y < l.y) {\n l.y = v.y;\n } else if (v.y > u.y) {\n u.y = v.y;\n }\n\n if (v.z < l.z) {\n l.z = v.z;\n } else if (v.z > u.z) {\n u.z = v.z;\n }\n }\n }\n /**\n * Update the `.aabb` property\n */\n\n\n updateAABB() {\n this.computeLocalAABB(this.aabb);\n }\n /**\n * Will update the `.boundingSphereRadius` property\n */\n\n\n updateBoundingSphereRadius() {\n // Assume points are distributed with local (0,0,0) as center\n let max2 = 0;\n const vertices = this.vertices;\n const v = new Vec3();\n\n for (let i = 0, N = vertices.length / 3; i !== N; i++) {\n this.getVertex(i, v);\n const norm2 = v.lengthSquared();\n\n if (norm2 > max2) {\n max2 = norm2;\n }\n }\n\n this.boundingSphereRadius = Math.sqrt(max2);\n }\n /**\n * calculateWorldAABB\n */\n\n\n calculateWorldAABB(pos, quat, min, max) {\n /*\n const n = this.vertices.length / 3,\n verts = this.vertices;\n const minx,miny,minz,maxx,maxy,maxz;\n const v = tempWorldVertex;\n for(let i=0; i maxx || maxx===undefined){\n maxx = v.x;\n }\n if (v.y < miny || miny===undefined){\n miny = v.y;\n } else if(v.y > maxy || maxy===undefined){\n maxy = v.y;\n }\n if (v.z < minz || minz===undefined){\n minz = v.z;\n } else if(v.z > maxz || maxz===undefined){\n maxz = v.z;\n }\n }\n min.set(minx,miny,minz);\n max.set(maxx,maxy,maxz);\n */\n // Faster approximation using local AABB\n const frame = calculateWorldAABB_frame;\n const result = calculateWorldAABB_aabb;\n frame.position = pos;\n frame.quaternion = quat;\n this.aabb.toWorldFrame(frame, result);\n min.copy(result.lowerBound);\n max.copy(result.upperBound);\n }\n /**\n * Get approximate volume\n */\n\n\n volume() {\n return 4.0 * Math.PI * this.boundingSphereRadius / 3.0;\n }\n /**\n * Create a Trimesh instance, shaped as a torus.\n */\n\n\n static createTorus(radius, tube, radialSegments, tubularSegments, arc) {\n if (radius === void 0) {\n radius = 1;\n }\n\n if (tube === void 0) {\n tube = 0.5;\n }\n\n if (radialSegments === void 0) {\n radialSegments = 8;\n }\n\n if (tubularSegments === void 0) {\n tubularSegments = 6;\n }\n\n if (arc === void 0) {\n arc = Math.PI * 2;\n }\n\n const vertices = [];\n const indices = [];\n\n for (let j = 0; j <= radialSegments; j++) {\n for (let i = 0; i <= tubularSegments; i++) {\n const u = i / tubularSegments * arc;\n const v = j / radialSegments * Math.PI * 2;\n const x = (radius + tube * Math.cos(v)) * Math.cos(u);\n const y = (radius + tube * Math.cos(v)) * Math.sin(u);\n const z = tube * Math.sin(v);\n vertices.push(x, y, z);\n }\n }\n\n for (let j = 1; j <= radialSegments; j++) {\n for (let i = 1; i <= tubularSegments; i++) {\n const a = (tubularSegments + 1) * j + i - 1;\n const b = (tubularSegments + 1) * (j - 1) + i - 1;\n const c = (tubularSegments + 1) * (j - 1) + i;\n const d = (tubularSegments + 1) * j + i;\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n }\n\n return new Trimesh(vertices, indices);\n }\n\n}\nconst computeNormals_n = new Vec3();\nconst unscaledAABB = new AABB();\nconst getEdgeVector_va = new Vec3();\nconst getEdgeVector_vb = new Vec3();\nconst cb = new Vec3();\nconst ab = new Vec3();\nconst va = new Vec3();\nconst vb = new Vec3();\nconst vc = new Vec3();\nconst cli_aabb = new AABB();\nconst computeLocalAABB_worldVert = new Vec3();\nconst calculateWorldAABB_frame = new Transform();\nconst calculateWorldAABB_aabb = new AABB();\n\n/**\n * Constraint equation solver base class.\n */\nclass Solver {\n /**\n * All equations to be solved\n */\n\n /**\n * @todo remove useless constructor\n */\n constructor() {\n this.equations = [];\n }\n /**\n * Should be implemented in subclasses!\n * @todo use abstract\n * @return number of iterations performed\n */\n\n\n solve(dt, world) {\n return (// Should return the number of iterations done!\n 0\n );\n }\n /**\n * Add an equation\n */\n\n\n addEquation(eq) {\n if (eq.enabled && !eq.bi.isTrigger && !eq.bj.isTrigger) {\n this.equations.push(eq);\n }\n }\n /**\n * Remove an equation\n */\n\n\n removeEquation(eq) {\n const eqs = this.equations;\n const i = eqs.indexOf(eq);\n\n if (i !== -1) {\n eqs.splice(i, 1);\n }\n }\n /**\n * Add all equations\n */\n\n\n removeAllEquations() {\n this.equations.length = 0;\n }\n\n}\n\n/**\n * Constraint equation Gauss-Seidel solver.\n * @todo The spook parameters should be specified for each constraint, not globally.\n * @see https://www8.cs.umu.se/kurser/5DV058/VT09/lectures/spooknotes.pdf\n */\nclass GSSolver extends Solver {\n /**\n * The number of solver iterations determines quality of the constraints in the world.\n * The more iterations, the more correct simulation. More iterations need more computations though. If you have a large gravity force in your world, you will need more iterations.\n */\n\n /**\n * When tolerance is reached, the system is assumed to be converged.\n */\n\n /**\n * @todo remove useless constructor\n */\n constructor() {\n super();\n this.iterations = 10;\n this.tolerance = 1e-7;\n }\n /**\n * Solve\n * @return number of iterations performed\n */\n\n\n solve(dt, world) {\n let iter = 0;\n const maxIter = this.iterations;\n const tolSquared = this.tolerance * this.tolerance;\n const equations = this.equations;\n const Neq = equations.length;\n const bodies = world.bodies;\n const Nbodies = bodies.length;\n const h = dt;\n let B;\n let invC;\n let deltalambda;\n let deltalambdaTot;\n let GWlambda;\n let lambdaj; // Update solve mass\n\n if (Neq !== 0) {\n for (let i = 0; i !== Nbodies; i++) {\n bodies[i].updateSolveMassProperties();\n }\n } // Things that do not change during iteration can be computed once\n\n\n const invCs = GSSolver_solve_invCs;\n const Bs = GSSolver_solve_Bs;\n const lambda = GSSolver_solve_lambda;\n invCs.length = Neq;\n Bs.length = Neq;\n lambda.length = Neq;\n\n for (let i = 0; i !== Neq; i++) {\n const c = equations[i];\n lambda[i] = 0.0;\n Bs[i] = c.computeB(h);\n invCs[i] = 1.0 / c.computeC();\n }\n\n if (Neq !== 0) {\n // Reset vlambda\n for (let i = 0; i !== Nbodies; i++) {\n const b = bodies[i];\n const vlambda = b.vlambda;\n const wlambda = b.wlambda;\n vlambda.set(0, 0, 0);\n wlambda.set(0, 0, 0);\n } // Iterate over equations\n\n\n for (iter = 0; iter !== maxIter; iter++) {\n // Accumulate the total error for each iteration.\n deltalambdaTot = 0.0;\n\n for (let j = 0; j !== Neq; j++) {\n const c = equations[j]; // Compute iteration\n\n B = Bs[j];\n invC = invCs[j];\n lambdaj = lambda[j];\n GWlambda = c.computeGWlambda();\n deltalambda = invC * (B - GWlambda - c.eps * lambdaj); // Clamp if we are not within the min/max interval\n\n if (lambdaj + deltalambda < c.minForce) {\n deltalambda = c.minForce - lambdaj;\n } else if (lambdaj + deltalambda > c.maxForce) {\n deltalambda = c.maxForce - lambdaj;\n }\n\n lambda[j] += deltalambda;\n deltalambdaTot += deltalambda > 0.0 ? deltalambda : -deltalambda; // abs(deltalambda)\n\n c.addToWlambda(deltalambda);\n } // If the total error is small enough - stop iterate\n\n\n if (deltalambdaTot * deltalambdaTot < tolSquared) {\n break;\n }\n } // Add result to velocity\n\n\n for (let i = 0; i !== Nbodies; i++) {\n const b = bodies[i];\n const v = b.velocity;\n const w = b.angularVelocity;\n b.vlambda.vmul(b.linearFactor, b.vlambda);\n v.vadd(b.vlambda, v);\n b.wlambda.vmul(b.angularFactor, b.wlambda);\n w.vadd(b.wlambda, w);\n } // Set the `.multiplier` property of each equation\n\n\n let l = equations.length;\n const invDt = 1 / h;\n\n while (l--) {\n equations[l].multiplier = lambda[l] * invDt;\n }\n }\n\n return iter;\n }\n\n} // Just temporary number holders that we want to reuse each iteration.\n\nconst GSSolver_solve_lambda = [];\nconst GSSolver_solve_invCs = [];\nconst GSSolver_solve_Bs = [];\n\n/**\n * Splits the equations into islands and solves them independently. Can improve performance.\n */\nclass SplitSolver extends Solver {\n /**\n * The number of solver iterations determines quality of the constraints in the world. The more iterations, the more correct simulation. More iterations need more computations though. If you have a large gravity force in your world, you will need more iterations.\n */\n\n /**\n * When tolerance is reached, the system is assumed to be converged.\n */\n\n /** subsolver */\n constructor(subsolver) {\n super();\n this.iterations = 10;\n this.tolerance = 1e-7;\n this.subsolver = subsolver;\n this.nodes = [];\n this.nodePool = []; // Create needed nodes, reuse if possible\n\n while (this.nodePool.length < 128) {\n this.nodePool.push(this.createNode());\n }\n }\n /**\n * createNode\n */\n\n\n createNode() {\n return {\n body: null,\n children: [],\n eqs: [],\n visited: false\n };\n }\n /**\n * Solve the subsystems\n * @return number of iterations performed\n */\n\n\n solve(dt, world) {\n const nodes = SplitSolver_solve_nodes;\n const nodePool = this.nodePool;\n const bodies = world.bodies;\n const equations = this.equations;\n const Neq = equations.length;\n const Nbodies = bodies.length;\n const subsolver = this.subsolver; // Create needed nodes, reuse if possible\n\n while (nodePool.length < Nbodies) {\n nodePool.push(this.createNode());\n }\n\n nodes.length = Nbodies;\n\n for (let i = 0; i < Nbodies; i++) {\n nodes[i] = nodePool[i];\n } // Reset node values\n\n\n for (let i = 0; i !== Nbodies; i++) {\n const node = nodes[i];\n node.body = bodies[i];\n node.children.length = 0;\n node.eqs.length = 0;\n node.visited = false;\n }\n\n for (let k = 0; k !== Neq; k++) {\n const eq = equations[k];\n const i = bodies.indexOf(eq.bi);\n const j = bodies.indexOf(eq.bj);\n const ni = nodes[i];\n const nj = nodes[j];\n ni.children.push(nj);\n ni.eqs.push(eq);\n nj.children.push(ni);\n nj.eqs.push(eq);\n }\n\n let child;\n let n = 0;\n let eqs = SplitSolver_solve_eqs;\n subsolver.tolerance = this.tolerance;\n subsolver.iterations = this.iterations;\n const dummyWorld = SplitSolver_solve_dummyWorld;\n\n while (child = getUnvisitedNode(nodes)) {\n eqs.length = 0;\n dummyWorld.bodies.length = 0;\n bfs(child, visitFunc, dummyWorld.bodies, eqs);\n const Neqs = eqs.length;\n eqs = eqs.sort(sortById);\n\n for (let i = 0; i !== Neqs; i++) {\n subsolver.addEquation(eqs[i]);\n }\n\n subsolver.solve(dt, dummyWorld);\n subsolver.removeAllEquations();\n n++;\n }\n\n return n;\n }\n\n} // Returns the number of subsystems\n\nconst SplitSolver_solve_nodes = []; // All allocated node objects\n\nconst SplitSolver_solve_eqs = []; // Temp array\n\nconst SplitSolver_solve_dummyWorld = {\n bodies: []\n}; // Temp object\n\nconst STATIC = Body.STATIC;\n\nfunction getUnvisitedNode(nodes) {\n const Nnodes = nodes.length;\n\n for (let i = 0; i !== Nnodes; i++) {\n const node = nodes[i];\n\n if (!node.visited && !(node.body.type & STATIC)) {\n return node;\n }\n }\n\n return false;\n}\n\nconst queue = [];\n\nfunction bfs(root, visitFunc, bds, eqs) {\n queue.push(root);\n root.visited = true;\n visitFunc(root, bds, eqs);\n\n while (queue.length) {\n const node = queue.pop(); // Loop over unvisited child nodes\n\n let child;\n\n while (child = getUnvisitedNode(node.children)) {\n child.visited = true;\n visitFunc(child, bds, eqs);\n queue.push(child);\n }\n }\n}\n\nfunction visitFunc(node, bds, eqs) {\n bds.push(node.body);\n const Neqs = node.eqs.length;\n\n for (let i = 0; i !== Neqs; i++) {\n const eq = node.eqs[i];\n\n if (!eqs.includes(eq)) {\n eqs.push(eq);\n }\n }\n}\n\nfunction sortById(a, b) {\n return b.id - a.id;\n}\n\n/**\n * For pooling objects that can be reused.\n */\nclass Pool {\n constructor() {\n this.objects = [];\n this.type = Object;\n }\n\n /**\n * Release an object after use\n */\n release() {\n const Nargs = arguments.length;\n\n for (let i = 0; i !== Nargs; i++) {\n this.objects.push(i < 0 || arguments.length <= i ? undefined : arguments[i]);\n }\n\n return this;\n }\n /**\n * Get an object\n */\n\n\n get() {\n if (this.objects.length === 0) {\n return this.constructObject();\n } else {\n return this.objects.pop();\n }\n }\n /**\n * Construct an object. Should be implemented in each subclass.\n */\n\n\n constructObject() {\n throw new Error('constructObject() not implemented in this Pool subclass yet!');\n }\n /**\n * @return Self, for chaining\n */\n\n\n resize(size) {\n const objects = this.objects;\n\n while (objects.length > size) {\n objects.pop();\n }\n\n while (objects.length < size) {\n objects.push(this.constructObject());\n }\n\n return this;\n }\n\n}\n\n/**\n * Vec3Pool\n */\n\nclass Vec3Pool extends Pool {\n constructor() {\n super(...arguments);\n this.type = Vec3;\n }\n\n /**\n * Construct a vector\n */\n constructObject() {\n return new Vec3();\n }\n\n}\n\n// Naming rule: based of the order in SHAPE_TYPES,\n// the first part of the method is formed by the\n// shape type that comes before, in the second part\n// there is the shape type that comes after in the SHAPE_TYPES list\nconst COLLISION_TYPES = {\n sphereSphere: Shape.types.SPHERE,\n spherePlane: Shape.types.SPHERE | Shape.types.PLANE,\n boxBox: Shape.types.BOX | Shape.types.BOX,\n sphereBox: Shape.types.SPHERE | Shape.types.BOX,\n planeBox: Shape.types.PLANE | Shape.types.BOX,\n convexConvex: Shape.types.CONVEXPOLYHEDRON,\n sphereConvex: Shape.types.SPHERE | Shape.types.CONVEXPOLYHEDRON,\n planeConvex: Shape.types.PLANE | Shape.types.CONVEXPOLYHEDRON,\n boxConvex: Shape.types.BOX | Shape.types.CONVEXPOLYHEDRON,\n sphereHeightfield: Shape.types.SPHERE | Shape.types.HEIGHTFIELD,\n boxHeightfield: Shape.types.BOX | Shape.types.HEIGHTFIELD,\n convexHeightfield: Shape.types.CONVEXPOLYHEDRON | Shape.types.HEIGHTFIELD,\n sphereParticle: Shape.types.PARTICLE | Shape.types.SPHERE,\n planeParticle: Shape.types.PLANE | Shape.types.PARTICLE,\n boxParticle: Shape.types.BOX | Shape.types.PARTICLE,\n convexParticle: Shape.types.PARTICLE | Shape.types.CONVEXPOLYHEDRON,\n cylinderCylinder: Shape.types.CYLINDER,\n sphereCylinder: Shape.types.SPHERE | Shape.types.CYLINDER,\n planeCylinder: Shape.types.PLANE | Shape.types.CYLINDER,\n boxCylinder: Shape.types.BOX | Shape.types.CYLINDER,\n convexCylinder: Shape.types.CONVEXPOLYHEDRON | Shape.types.CYLINDER,\n heightfieldCylinder: Shape.types.HEIGHTFIELD | Shape.types.CYLINDER,\n particleCylinder: Shape.types.PARTICLE | Shape.types.CYLINDER,\n sphereTrimesh: Shape.types.SPHERE | Shape.types.TRIMESH,\n planeTrimesh: Shape.types.PLANE | Shape.types.TRIMESH\n};\n\n/**\n * Helper class for the World. Generates ContactEquations.\n * @todo Sphere-ConvexPolyhedron contacts\n * @todo Contact reduction\n * @todo should move methods to prototype\n */\nclass Narrowphase {\n /**\n * Internal storage of pooled contact points.\n */\n\n /**\n * Pooled vectors.\n */\n get [COLLISION_TYPES.sphereSphere]() {\n return this.sphereSphere;\n }\n\n get [COLLISION_TYPES.spherePlane]() {\n return this.spherePlane;\n }\n\n get [COLLISION_TYPES.boxBox]() {\n return this.boxBox;\n }\n\n get [COLLISION_TYPES.sphereBox]() {\n return this.sphereBox;\n }\n\n get [COLLISION_TYPES.planeBox]() {\n return this.planeBox;\n }\n\n get [COLLISION_TYPES.convexConvex]() {\n return this.convexConvex;\n }\n\n get [COLLISION_TYPES.sphereConvex]() {\n return this.sphereConvex;\n }\n\n get [COLLISION_TYPES.planeConvex]() {\n return this.planeConvex;\n }\n\n get [COLLISION_TYPES.boxConvex]() {\n return this.boxConvex;\n }\n\n get [COLLISION_TYPES.sphereHeightfield]() {\n return this.sphereHeightfield;\n }\n\n get [COLLISION_TYPES.boxHeightfield]() {\n return this.boxHeightfield;\n }\n\n get [COLLISION_TYPES.convexHeightfield]() {\n return this.convexHeightfield;\n }\n\n get [COLLISION_TYPES.sphereParticle]() {\n return this.sphereParticle;\n }\n\n get [COLLISION_TYPES.planeParticle]() {\n return this.planeParticle;\n }\n\n get [COLLISION_TYPES.boxParticle]() {\n return this.boxParticle;\n }\n\n get [COLLISION_TYPES.convexParticle]() {\n return this.convexParticle;\n }\n\n get [COLLISION_TYPES.cylinderCylinder]() {\n return this.convexConvex;\n }\n\n get [COLLISION_TYPES.sphereCylinder]() {\n return this.sphereConvex;\n }\n\n get [COLLISION_TYPES.planeCylinder]() {\n return this.planeConvex;\n }\n\n get [COLLISION_TYPES.boxCylinder]() {\n return this.boxConvex;\n }\n\n get [COLLISION_TYPES.convexCylinder]() {\n return this.convexConvex;\n }\n\n get [COLLISION_TYPES.heightfieldCylinder]() {\n return this.heightfieldCylinder;\n }\n\n get [COLLISION_TYPES.particleCylinder]() {\n return this.particleCylinder;\n }\n\n get [COLLISION_TYPES.sphereTrimesh]() {\n return this.sphereTrimesh;\n }\n\n get [COLLISION_TYPES.planeTrimesh]() {\n return this.planeTrimesh;\n } // get [COLLISION_TYPES.convexTrimesh]() {\n // return this.convexTrimesh\n // }\n\n\n constructor(world) {\n this.contactPointPool = [];\n this.frictionEquationPool = [];\n this.result = [];\n this.frictionResult = [];\n this.v3pool = new Vec3Pool();\n this.world = world;\n this.currentContactMaterial = world.defaultContactMaterial;\n this.enableFrictionReduction = false;\n }\n /**\n * Make a contact object, by using the internal pool or creating a new one.\n */\n\n\n createContactEquation(bi, bj, si, sj, overrideShapeA, overrideShapeB) {\n let c;\n\n if (this.contactPointPool.length) {\n c = this.contactPointPool.pop();\n c.bi = bi;\n c.bj = bj;\n } else {\n c = new ContactEquation(bi, bj);\n }\n\n c.enabled = bi.collisionResponse && bj.collisionResponse && si.collisionResponse && sj.collisionResponse;\n const cm = this.currentContactMaterial;\n c.restitution = cm.restitution;\n c.setSpookParams(cm.contactEquationStiffness, cm.contactEquationRelaxation, this.world.dt);\n const matA = si.material || bi.material;\n const matB = sj.material || bj.material;\n\n if (matA && matB && matA.restitution >= 0 && matB.restitution >= 0) {\n c.restitution = matA.restitution * matB.restitution;\n }\n\n c.si = overrideShapeA || si;\n c.sj = overrideShapeB || sj;\n return c;\n }\n\n createFrictionEquationsFromContact(contactEquation, outArray) {\n const bodyA = contactEquation.bi;\n const bodyB = contactEquation.bj;\n const shapeA = contactEquation.si;\n const shapeB = contactEquation.sj;\n const world = this.world;\n const cm = this.currentContactMaterial; // If friction or restitution were specified in the material, use them\n\n let friction = cm.friction;\n const matA = shapeA.material || bodyA.material;\n const matB = shapeB.material || bodyB.material;\n\n if (matA && matB && matA.friction >= 0 && matB.friction >= 0) {\n friction = matA.friction * matB.friction;\n }\n\n if (friction > 0) {\n // Create 2 tangent equations\n // Users may provide a force different from global gravity to use when computing contact friction.\n const mug = friction * (world.frictionGravity || world.gravity).length();\n let reducedMass = bodyA.invMass + bodyB.invMass;\n\n if (reducedMass > 0) {\n reducedMass = 1 / reducedMass;\n }\n\n const pool = this.frictionEquationPool;\n const c1 = pool.length ? pool.pop() : new FrictionEquation(bodyA, bodyB, mug * reducedMass);\n const c2 = pool.length ? pool.pop() : new FrictionEquation(bodyA, bodyB, mug * reducedMass);\n c1.bi = c2.bi = bodyA;\n c1.bj = c2.bj = bodyB;\n c1.minForce = c2.minForce = -mug * reducedMass;\n c1.maxForce = c2.maxForce = mug * reducedMass; // Copy over the relative vectors\n\n c1.ri.copy(contactEquation.ri);\n c1.rj.copy(contactEquation.rj);\n c2.ri.copy(contactEquation.ri);\n c2.rj.copy(contactEquation.rj); // Construct tangents\n\n contactEquation.ni.tangents(c1.t, c2.t); // Set spook params\n\n c1.setSpookParams(cm.frictionEquationStiffness, cm.frictionEquationRelaxation, world.dt);\n c2.setSpookParams(cm.frictionEquationStiffness, cm.frictionEquationRelaxation, world.dt);\n c1.enabled = c2.enabled = contactEquation.enabled;\n outArray.push(c1, c2);\n return true;\n }\n\n return false;\n }\n /**\n * Take the average N latest contact point on the plane.\n */\n\n\n createFrictionFromAverage(numContacts) {\n // The last contactEquation\n let c = this.result[this.result.length - 1]; // Create the result: two \"average\" friction equations\n\n if (!this.createFrictionEquationsFromContact(c, this.frictionResult) || numContacts === 1) {\n return;\n }\n\n const f1 = this.frictionResult[this.frictionResult.length - 2];\n const f2 = this.frictionResult[this.frictionResult.length - 1];\n averageNormal.setZero();\n averageContactPointA.setZero();\n averageContactPointB.setZero();\n const bodyA = c.bi;\n c.bj;\n\n for (let i = 0; i !== numContacts; i++) {\n c = this.result[this.result.length - 1 - i];\n\n if (c.bi !== bodyA) {\n averageNormal.vadd(c.ni, averageNormal);\n averageContactPointA.vadd(c.ri, averageContactPointA);\n averageContactPointB.vadd(c.rj, averageContactPointB);\n } else {\n averageNormal.vsub(c.ni, averageNormal);\n averageContactPointA.vadd(c.rj, averageContactPointA);\n averageContactPointB.vadd(c.ri, averageContactPointB);\n }\n }\n\n const invNumContacts = 1 / numContacts;\n averageContactPointA.scale(invNumContacts, f1.ri);\n averageContactPointB.scale(invNumContacts, f1.rj);\n f2.ri.copy(f1.ri); // Should be the same\n\n f2.rj.copy(f1.rj);\n averageNormal.normalize();\n averageNormal.tangents(f1.t, f2.t); // return eq;\n }\n /**\n * Generate all contacts between a list of body pairs\n * @param p1 Array of body indices\n * @param p2 Array of body indices\n * @param result Array to store generated contacts\n * @param oldcontacts Optional. Array of reusable contact objects\n */\n\n\n getContacts(p1, p2, world, result, oldcontacts, frictionResult, frictionPool) {\n // Save old contact objects\n this.contactPointPool = oldcontacts;\n this.frictionEquationPool = frictionPool;\n this.result = result;\n this.frictionResult = frictionResult;\n const qi = tmpQuat1;\n const qj = tmpQuat2;\n const xi = tmpVec1;\n const xj = tmpVec2;\n\n for (let k = 0, N = p1.length; k !== N; k++) {\n // Get current collision bodies\n const bi = p1[k];\n const bj = p2[k]; // Get contact material\n\n let bodyContactMaterial = null;\n\n if (bi.material && bj.material) {\n bodyContactMaterial = world.getContactMaterial(bi.material, bj.material) || null;\n }\n\n const justTest = bi.type & Body.KINEMATIC && bj.type & Body.STATIC || bi.type & Body.STATIC && bj.type & Body.KINEMATIC || bi.type & Body.KINEMATIC && bj.type & Body.KINEMATIC;\n\n for (let i = 0; i < bi.shapes.length; i++) {\n bi.quaternion.mult(bi.shapeOrientations[i], qi);\n bi.quaternion.vmult(bi.shapeOffsets[i], xi);\n xi.vadd(bi.position, xi);\n const si = bi.shapes[i];\n\n for (let j = 0; j < bj.shapes.length; j++) {\n // Compute world transform of shapes\n bj.quaternion.mult(bj.shapeOrientations[j], qj);\n bj.quaternion.vmult(bj.shapeOffsets[j], xj);\n xj.vadd(bj.position, xj);\n const sj = bj.shapes[j];\n\n if (!(si.collisionFilterMask & sj.collisionFilterGroup && sj.collisionFilterMask & si.collisionFilterGroup)) {\n continue;\n }\n\n if (xi.distanceTo(xj) > si.boundingSphereRadius + sj.boundingSphereRadius) {\n continue;\n } // Get collision material\n\n\n let shapeContactMaterial = null;\n\n if (si.material && sj.material) {\n shapeContactMaterial = world.getContactMaterial(si.material, sj.material) || null;\n }\n\n this.currentContactMaterial = shapeContactMaterial || bodyContactMaterial || world.defaultContactMaterial; // Get contacts\n\n const resolverIndex = si.type | sj.type;\n const resolver = this[resolverIndex];\n\n if (resolver) {\n let retval = false; // TO DO: investigate why sphereParticle and convexParticle\n // resolvers expect si and sj shapes to be in reverse order\n // (i.e. larger integer value type first instead of smaller first)\n\n if (si.type < sj.type) {\n retval = resolver.call(this, si, sj, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n } else {\n retval = resolver.call(this, sj, si, xj, xi, qj, qi, bj, bi, si, sj, justTest);\n }\n\n if (retval && justTest) {\n // Register overlap\n world.shapeOverlapKeeper.set(si.id, sj.id);\n world.bodyOverlapKeeper.set(bi.id, bj.id);\n }\n }\n }\n }\n }\n }\n\n sphereSphere(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n if (justTest) {\n return xi.distanceSquared(xj) < (si.radius + sj.radius) ** 2;\n } // We will have only one contact in this case\n\n\n const contactEq = this.createContactEquation(bi, bj, si, sj, rsi, rsj); // Contact normal\n\n xj.vsub(xi, contactEq.ni);\n contactEq.ni.normalize(); // Contact point locations\n\n contactEq.ri.copy(contactEq.ni);\n contactEq.rj.copy(contactEq.ni);\n contactEq.ri.scale(si.radius, contactEq.ri);\n contactEq.rj.scale(-sj.radius, contactEq.rj);\n contactEq.ri.vadd(xi, contactEq.ri);\n contactEq.ri.vsub(bi.position, contactEq.ri);\n contactEq.rj.vadd(xj, contactEq.rj);\n contactEq.rj.vsub(bj.position, contactEq.rj);\n this.result.push(contactEq);\n this.createFrictionEquationsFromContact(contactEq, this.frictionResult);\n }\n\n spherePlane(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n // We will have one contact in this case\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj); // Contact normal\n\n r.ni.set(0, 0, 1);\n qj.vmult(r.ni, r.ni);\n r.ni.negate(r.ni); // body i is the sphere, flip normal\n\n r.ni.normalize(); // Needed?\n // Vector from sphere center to contact point\n\n r.ni.scale(si.radius, r.ri); // Project down sphere on plane\n\n xi.vsub(xj, point_on_plane_to_sphere);\n r.ni.scale(r.ni.dot(point_on_plane_to_sphere), plane_to_sphere_ortho);\n point_on_plane_to_sphere.vsub(plane_to_sphere_ortho, r.rj); // The sphere position projected to plane\n\n if (-point_on_plane_to_sphere.dot(r.ni) <= si.radius) {\n if (justTest) {\n return true;\n } // Make it relative to the body\n\n\n const ri = r.ri;\n const rj = r.rj;\n ri.vadd(xi, ri);\n ri.vsub(bi.position, ri);\n rj.vadd(xj, rj);\n rj.vsub(bj.position, rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n boxBox(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n si.convexPolyhedronRepresentation.material = si.material;\n sj.convexPolyhedronRepresentation.material = sj.material;\n si.convexPolyhedronRepresentation.collisionResponse = si.collisionResponse;\n sj.convexPolyhedronRepresentation.collisionResponse = sj.collisionResponse;\n return this.convexConvex(si.convexPolyhedronRepresentation, sj.convexPolyhedronRepresentation, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n sphereBox(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n const v3pool = this.v3pool; // we refer to the box as body j\n\n const sides = sphereBox_sides;\n xi.vsub(xj, box_to_sphere);\n sj.getSideNormals(sides, qj);\n const R = si.radius;\n\n let found = false; // Store the resulting side penetration info\n\n const side_ns = sphereBox_side_ns;\n const side_ns1 = sphereBox_side_ns1;\n const side_ns2 = sphereBox_side_ns2;\n let side_h = null;\n let side_penetrations = 0;\n let side_dot1 = 0;\n let side_dot2 = 0;\n let side_distance = null;\n\n for (let idx = 0, nsides = sides.length; idx !== nsides && found === false; idx++) {\n // Get the plane side normal (ns)\n const ns = sphereBox_ns;\n ns.copy(sides[idx]);\n const h = ns.length();\n ns.normalize(); // The normal/distance dot product tells which side of the plane we are\n\n const dot = box_to_sphere.dot(ns);\n\n if (dot < h + R && dot > 0) {\n // Intersects plane. Now check the other two dimensions\n const ns1 = sphereBox_ns1;\n const ns2 = sphereBox_ns2;\n ns1.copy(sides[(idx + 1) % 3]);\n ns2.copy(sides[(idx + 2) % 3]);\n const h1 = ns1.length();\n const h2 = ns2.length();\n ns1.normalize();\n ns2.normalize();\n const dot1 = box_to_sphere.dot(ns1);\n const dot2 = box_to_sphere.dot(ns2);\n\n if (dot1 < h1 && dot1 > -h1 && dot2 < h2 && dot2 > -h2) {\n const dist = Math.abs(dot - h - R);\n\n if (side_distance === null || dist < side_distance) {\n side_distance = dist;\n side_dot1 = dot1;\n side_dot2 = dot2;\n side_h = h;\n side_ns.copy(ns);\n side_ns1.copy(ns1);\n side_ns2.copy(ns2);\n side_penetrations++;\n\n if (justTest) {\n return true;\n }\n }\n }\n }\n }\n\n if (side_penetrations) {\n found = true;\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n side_ns.scale(-R, r.ri); // Sphere r\n\n r.ni.copy(side_ns);\n r.ni.negate(r.ni); // Normal should be out of sphere\n\n side_ns.scale(side_h, side_ns);\n side_ns1.scale(side_dot1, side_ns1);\n side_ns.vadd(side_ns1, side_ns);\n side_ns2.scale(side_dot2, side_ns2);\n side_ns.vadd(side_ns2, r.rj); // Make relative to bodies\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri);\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n } // Check corners\n\n\n let rj = v3pool.get();\n const sphere_to_corner = sphereBox_sphere_to_corner;\n\n for (let j = 0; j !== 2 && !found; j++) {\n for (let k = 0; k !== 2 && !found; k++) {\n for (let l = 0; l !== 2 && !found; l++) {\n rj.set(0, 0, 0);\n\n if (j) {\n rj.vadd(sides[0], rj);\n } else {\n rj.vsub(sides[0], rj);\n }\n\n if (k) {\n rj.vadd(sides[1], rj);\n } else {\n rj.vsub(sides[1], rj);\n }\n\n if (l) {\n rj.vadd(sides[2], rj);\n } else {\n rj.vsub(sides[2], rj);\n } // World position of corner\n\n\n xj.vadd(rj, sphere_to_corner);\n sphere_to_corner.vsub(xi, sphere_to_corner);\n\n if (sphere_to_corner.lengthSquared() < R * R) {\n if (justTest) {\n return true;\n }\n\n found = true;\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n r.ri.copy(sphere_to_corner);\n r.ri.normalize();\n r.ni.copy(r.ri);\n r.ri.scale(R, r.ri);\n r.rj.copy(rj); // Make relative to bodies\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri);\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n }\n }\n\n v3pool.release(rj);\n rj = null; // Check edges\n\n const edgeTangent = v3pool.get();\n const edgeCenter = v3pool.get();\n const r = v3pool.get(); // r = edge center to sphere center\n\n const orthogonal = v3pool.get();\n const dist = v3pool.get();\n const Nsides = sides.length;\n\n for (let j = 0; j !== Nsides && !found; j++) {\n for (let k = 0; k !== Nsides && !found; k++) {\n if (j % 3 !== k % 3) {\n // Get edge tangent\n sides[k].cross(sides[j], edgeTangent);\n edgeTangent.normalize();\n sides[j].vadd(sides[k], edgeCenter);\n r.copy(xi);\n r.vsub(edgeCenter, r);\n r.vsub(xj, r);\n const orthonorm = r.dot(edgeTangent); // distance from edge center to sphere center in the tangent direction\n\n edgeTangent.scale(orthonorm, orthogonal); // Vector from edge center to sphere center in the tangent direction\n // Find the third side orthogonal to this one\n\n let l = 0;\n\n while (l === j % 3 || l === k % 3) {\n l++;\n } // vec from edge center to sphere projected to the plane orthogonal to the edge tangent\n\n\n dist.copy(xi);\n dist.vsub(orthogonal, dist);\n dist.vsub(edgeCenter, dist);\n dist.vsub(xj, dist); // Distances in tangent direction and distance in the plane orthogonal to it\n\n const tdist = Math.abs(orthonorm);\n const ndist = dist.length();\n\n if (tdist < sides[l].length() && ndist < R) {\n if (justTest) {\n return true;\n }\n\n found = true;\n const res = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n edgeCenter.vadd(orthogonal, res.rj); // box rj\n\n res.rj.copy(res.rj);\n dist.negate(res.ni);\n res.ni.normalize();\n res.ri.copy(res.rj);\n res.ri.vadd(xj, res.ri);\n res.ri.vsub(xi, res.ri);\n res.ri.normalize();\n res.ri.scale(R, res.ri); // Make relative to bodies\n\n res.ri.vadd(xi, res.ri);\n res.ri.vsub(bi.position, res.ri);\n res.rj.vadd(xj, res.rj);\n res.rj.vsub(bj.position, res.rj);\n this.result.push(res);\n this.createFrictionEquationsFromContact(res, this.frictionResult);\n }\n }\n }\n }\n\n v3pool.release(edgeTangent, edgeCenter, r, orthogonal, dist);\n }\n\n planeBox(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n sj.convexPolyhedronRepresentation.material = sj.material;\n sj.convexPolyhedronRepresentation.collisionResponse = sj.collisionResponse;\n sj.convexPolyhedronRepresentation.id = sj.id;\n return this.planeConvex(si, sj.convexPolyhedronRepresentation, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n convexConvex(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest, faceListA, faceListB) {\n const sepAxis = convexConvex_sepAxis;\n\n if (xi.distanceTo(xj) > si.boundingSphereRadius + sj.boundingSphereRadius) {\n return;\n }\n\n if (si.findSeparatingAxis(sj, xi, qi, xj, qj, sepAxis, faceListA, faceListB)) {\n const res = [];\n const q = convexConvex_q;\n si.clipAgainstHull(xi, qi, sj, xj, qj, sepAxis, -100, 100, res);\n let numContacts = 0;\n\n for (let j = 0; j !== res.length; j++) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n const ri = r.ri;\n const rj = r.rj;\n sepAxis.negate(r.ni);\n res[j].normal.negate(q);\n q.scale(res[j].depth, q);\n res[j].point.vadd(q, ri);\n rj.copy(res[j].point); // Contact points are in world coordinates. Transform back to relative\n\n ri.vsub(xi, ri);\n rj.vsub(xj, rj); // Make relative to bodies\n\n ri.vadd(xi, ri);\n ri.vsub(bi.position, ri);\n rj.vadd(xj, rj);\n rj.vsub(bj.position, rj);\n this.result.push(r);\n numContacts++;\n\n if (!this.enableFrictionReduction) {\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n if (this.enableFrictionReduction && numContacts) {\n this.createFrictionFromAverage(numContacts);\n }\n }\n }\n\n sphereConvex(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n const v3pool = this.v3pool;\n xi.vsub(xj, convex_to_sphere);\n const normals = sj.faceNormals;\n const faces = sj.faces;\n const verts = sj.vertices;\n const R = si.radius;\n // return;\n // }\n\n let found = false; // Check corners\n\n for (let i = 0; i !== verts.length; i++) {\n const v = verts[i]; // World position of corner\n\n const worldCorner = sphereConvex_worldCorner;\n qj.vmult(v, worldCorner);\n xj.vadd(worldCorner, worldCorner);\n const sphere_to_corner = sphereConvex_sphereToCorner;\n worldCorner.vsub(xi, sphere_to_corner);\n\n if (sphere_to_corner.lengthSquared() < R * R) {\n if (justTest) {\n return true;\n }\n\n found = true;\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n r.ri.copy(sphere_to_corner);\n r.ri.normalize();\n r.ni.copy(r.ri);\n r.ri.scale(R, r.ri);\n worldCorner.vsub(xj, r.rj); // Should be relative to the body.\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri); // Should be relative to the body.\n\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n return;\n }\n } // Check side (plane) intersections\n\n\n for (let i = 0, nfaces = faces.length; i !== nfaces && found === false; i++) {\n const normal = normals[i];\n const face = faces[i]; // Get world-transformed normal of the face\n\n const worldNormal = sphereConvex_worldNormal;\n qj.vmult(normal, worldNormal); // Get a world vertex from the face\n\n const worldPoint = sphereConvex_worldPoint;\n qj.vmult(verts[face[0]], worldPoint);\n worldPoint.vadd(xj, worldPoint); // Get a point on the sphere, closest to the face normal\n\n const worldSpherePointClosestToPlane = sphereConvex_worldSpherePointClosestToPlane;\n worldNormal.scale(-R, worldSpherePointClosestToPlane);\n xi.vadd(worldSpherePointClosestToPlane, worldSpherePointClosestToPlane); // Vector from a face point to the closest point on the sphere\n\n const penetrationVec = sphereConvex_penetrationVec;\n worldSpherePointClosestToPlane.vsub(worldPoint, penetrationVec); // The penetration. Negative value means overlap.\n\n const penetration = penetrationVec.dot(worldNormal);\n const worldPointToSphere = sphereConvex_sphereToWorldPoint;\n xi.vsub(worldPoint, worldPointToSphere);\n\n if (penetration < 0 && worldPointToSphere.dot(worldNormal) > 0) {\n // Intersects plane. Now check if the sphere is inside the face polygon\n const faceVerts = []; // Face vertices, in world coords\n\n for (let j = 0, Nverts = face.length; j !== Nverts; j++) {\n const worldVertex = v3pool.get();\n qj.vmult(verts[face[j]], worldVertex);\n xj.vadd(worldVertex, worldVertex);\n faceVerts.push(worldVertex);\n }\n\n if (pointInPolygon(faceVerts, worldNormal, xi)) {\n // Is the sphere center in the face polygon?\n if (justTest) {\n return true;\n }\n\n found = true;\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n worldNormal.scale(-R, r.ri); // Contact offset, from sphere center to contact\n\n worldNormal.negate(r.ni); // Normal pointing out of sphere\n\n const penetrationVec2 = v3pool.get();\n worldNormal.scale(-penetration, penetrationVec2);\n const penetrationSpherePoint = v3pool.get();\n worldNormal.scale(-R, penetrationSpherePoint); //xi.vsub(xj).vadd(penetrationSpherePoint).vadd(penetrationVec2 , r.rj);\n\n xi.vsub(xj, r.rj);\n r.rj.vadd(penetrationSpherePoint, r.rj);\n r.rj.vadd(penetrationVec2, r.rj); // Should be relative to the body.\n\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj); // Should be relative to the body.\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri);\n v3pool.release(penetrationVec2);\n v3pool.release(penetrationSpherePoint);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult); // Release world vertices\n\n for (let j = 0, Nfaceverts = faceVerts.length; j !== Nfaceverts; j++) {\n v3pool.release(faceVerts[j]);\n }\n\n return; // We only expect *one* face contact\n } else {\n // Edge?\n for (let j = 0; j !== face.length; j++) {\n // Get two world transformed vertices\n const v1 = v3pool.get();\n const v2 = v3pool.get();\n qj.vmult(verts[face[(j + 1) % face.length]], v1);\n qj.vmult(verts[face[(j + 2) % face.length]], v2);\n xj.vadd(v1, v1);\n xj.vadd(v2, v2); // Construct edge vector\n\n const edge = sphereConvex_edge;\n v2.vsub(v1, edge); // Construct the same vector, but normalized\n\n const edgeUnit = sphereConvex_edgeUnit;\n edge.unit(edgeUnit); // p is xi projected onto the edge\n\n const p = v3pool.get();\n const v1_to_xi = v3pool.get();\n xi.vsub(v1, v1_to_xi);\n const dot = v1_to_xi.dot(edgeUnit);\n edgeUnit.scale(dot, p);\n p.vadd(v1, p); // Compute a vector from p to the center of the sphere\n\n const xi_to_p = v3pool.get();\n p.vsub(xi, xi_to_p); // Collision if the edge-sphere distance is less than the radius\n // AND if p is in between v1 and v2\n\n if (dot > 0 && dot * dot < edge.lengthSquared() && xi_to_p.lengthSquared() < R * R) {\n // Collision if the edge-sphere distance is less than the radius\n // Edge contact!\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n p.vsub(xj, r.rj);\n p.vsub(xi, r.ni);\n r.ni.normalize();\n r.ni.scale(R, r.ri); // Should be relative to the body.\n\n r.rj.vadd(xj, r.rj);\n r.rj.vsub(bj.position, r.rj); // Should be relative to the body.\n\n r.ri.vadd(xi, r.ri);\n r.ri.vsub(bi.position, r.ri);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult); // Release world vertices\n\n for (let j = 0, Nfaceverts = faceVerts.length; j !== Nfaceverts; j++) {\n v3pool.release(faceVerts[j]);\n }\n\n v3pool.release(v1);\n v3pool.release(v2);\n v3pool.release(p);\n v3pool.release(xi_to_p);\n v3pool.release(v1_to_xi);\n return;\n }\n\n v3pool.release(v1);\n v3pool.release(v2);\n v3pool.release(p);\n v3pool.release(xi_to_p);\n v3pool.release(v1_to_xi);\n }\n } // Release world vertices\n\n\n for (let j = 0, Nfaceverts = faceVerts.length; j !== Nfaceverts; j++) {\n v3pool.release(faceVerts[j]);\n }\n }\n }\n }\n\n planeConvex(planeShape, convexShape, planePosition, convexPosition, planeQuat, convexQuat, planeBody, convexBody, si, sj, justTest) {\n // Simply return the points behind the plane.\n const worldVertex = planeConvex_v;\n const worldNormal = planeConvex_normal;\n worldNormal.set(0, 0, 1);\n planeQuat.vmult(worldNormal, worldNormal); // Turn normal according to plane orientation\n\n let numContacts = 0;\n const relpos = planeConvex_relpos;\n\n for (let i = 0; i !== convexShape.vertices.length; i++) {\n // Get world convex vertex\n worldVertex.copy(convexShape.vertices[i]);\n convexQuat.vmult(worldVertex, worldVertex);\n convexPosition.vadd(worldVertex, worldVertex);\n worldVertex.vsub(planePosition, relpos);\n const dot = worldNormal.dot(relpos);\n\n if (dot <= 0.0) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(planeBody, convexBody, planeShape, convexShape, si, sj); // Get vertex position projected on plane\n\n const projected = planeConvex_projected;\n worldNormal.scale(worldNormal.dot(relpos), projected);\n worldVertex.vsub(projected, projected);\n projected.vsub(planePosition, r.ri); // From plane to vertex projected on plane\n\n r.ni.copy(worldNormal); // Contact normal is the plane normal out from plane\n // rj is now just the vector from the convex center to the vertex\n\n worldVertex.vsub(convexPosition, r.rj); // Make it relative to the body\n\n r.ri.vadd(planePosition, r.ri);\n r.ri.vsub(planeBody.position, r.ri);\n r.rj.vadd(convexPosition, r.rj);\n r.rj.vsub(convexBody.position, r.rj);\n this.result.push(r);\n numContacts++;\n\n if (!this.enableFrictionReduction) {\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n }\n\n if (this.enableFrictionReduction && numContacts) {\n this.createFrictionFromAverage(numContacts);\n }\n }\n\n boxConvex(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n si.convexPolyhedronRepresentation.material = si.material;\n si.convexPolyhedronRepresentation.collisionResponse = si.collisionResponse;\n return this.convexConvex(si.convexPolyhedronRepresentation, sj, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n sphereHeightfield(sphereShape, hfShape, spherePos, hfPos, sphereQuat, hfQuat, sphereBody, hfBody, rsi, rsj, justTest) {\n const data = hfShape.data;\n const radius = sphereShape.radius;\n const w = hfShape.elementSize;\n const worldPillarOffset = sphereHeightfield_tmp2; // Get sphere position to heightfield local!\n\n const localSpherePos = sphereHeightfield_tmp1;\n Transform.pointToLocalFrame(hfPos, hfQuat, spherePos, localSpherePos); // Get the index of the data points to test against\n\n let iMinX = Math.floor((localSpherePos.x - radius) / w) - 1;\n let iMaxX = Math.ceil((localSpherePos.x + radius) / w) + 1;\n let iMinY = Math.floor((localSpherePos.y - radius) / w) - 1;\n let iMaxY = Math.ceil((localSpherePos.y + radius) / w) + 1; // Bail out if we are out of the terrain\n\n if (iMaxX < 0 || iMaxY < 0 || iMinX > data.length || iMinY > data[0].length) {\n return;\n } // Clamp index to edges\n\n\n if (iMinX < 0) {\n iMinX = 0;\n }\n\n if (iMaxX < 0) {\n iMaxX = 0;\n }\n\n if (iMinY < 0) {\n iMinY = 0;\n }\n\n if (iMaxY < 0) {\n iMaxY = 0;\n }\n\n if (iMinX >= data.length) {\n iMinX = data.length - 1;\n }\n\n if (iMaxX >= data.length) {\n iMaxX = data.length - 1;\n }\n\n if (iMaxY >= data[0].length) {\n iMaxY = data[0].length - 1;\n }\n\n if (iMinY >= data[0].length) {\n iMinY = data[0].length - 1;\n }\n\n const minMax = [];\n hfShape.getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, minMax);\n const min = minMax[0];\n const max = minMax[1]; // Bail out if we can't touch the bounding height box\n\n if (localSpherePos.z - radius > max || localSpherePos.z + radius < min) {\n return;\n }\n\n const result = this.result;\n\n for (let i = iMinX; i < iMaxX; i++) {\n for (let j = iMinY; j < iMaxY; j++) {\n const numContactsBefore = result.length;\n let intersecting = false; // Lower triangle\n\n hfShape.getConvexTrianglePillar(i, j, false);\n Transform.pointToWorldFrame(hfPos, hfQuat, hfShape.pillarOffset, worldPillarOffset);\n\n if (spherePos.distanceTo(worldPillarOffset) < hfShape.pillarConvex.boundingSphereRadius + sphereShape.boundingSphereRadius) {\n intersecting = this.sphereConvex(sphereShape, hfShape.pillarConvex, spherePos, worldPillarOffset, sphereQuat, hfQuat, sphereBody, hfBody, sphereShape, hfShape, justTest);\n }\n\n if (justTest && intersecting) {\n return true;\n } // Upper triangle\n\n\n hfShape.getConvexTrianglePillar(i, j, true);\n Transform.pointToWorldFrame(hfPos, hfQuat, hfShape.pillarOffset, worldPillarOffset);\n\n if (spherePos.distanceTo(worldPillarOffset) < hfShape.pillarConvex.boundingSphereRadius + sphereShape.boundingSphereRadius) {\n intersecting = this.sphereConvex(sphereShape, hfShape.pillarConvex, spherePos, worldPillarOffset, sphereQuat, hfQuat, sphereBody, hfBody, sphereShape, hfShape, justTest);\n }\n\n if (justTest && intersecting) {\n return true;\n }\n\n const numContacts = result.length - numContactsBefore;\n\n if (numContacts > 2) {\n return;\n }\n /*\n // Skip all but 1\n for (let k = 0; k < numContacts - 1; k++) {\n result.pop();\n }\n */\n\n }\n }\n }\n\n boxHeightfield(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n si.convexPolyhedronRepresentation.material = si.material;\n si.convexPolyhedronRepresentation.collisionResponse = si.collisionResponse;\n return this.convexHeightfield(si.convexPolyhedronRepresentation, sj, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n convexHeightfield(convexShape, hfShape, convexPos, hfPos, convexQuat, hfQuat, convexBody, hfBody, rsi, rsj, justTest) {\n const data = hfShape.data;\n const w = hfShape.elementSize;\n const radius = convexShape.boundingSphereRadius;\n const worldPillarOffset = convexHeightfield_tmp2;\n const faceList = convexHeightfield_faceList; // Get sphere position to heightfield local!\n\n const localConvexPos = convexHeightfield_tmp1;\n Transform.pointToLocalFrame(hfPos, hfQuat, convexPos, localConvexPos); // Get the index of the data points to test against\n\n let iMinX = Math.floor((localConvexPos.x - radius) / w) - 1;\n let iMaxX = Math.ceil((localConvexPos.x + radius) / w) + 1;\n let iMinY = Math.floor((localConvexPos.y - radius) / w) - 1;\n let iMaxY = Math.ceil((localConvexPos.y + radius) / w) + 1; // Bail out if we are out of the terrain\n\n if (iMaxX < 0 || iMaxY < 0 || iMinX > data.length || iMinY > data[0].length) {\n return;\n } // Clamp index to edges\n\n\n if (iMinX < 0) {\n iMinX = 0;\n }\n\n if (iMaxX < 0) {\n iMaxX = 0;\n }\n\n if (iMinY < 0) {\n iMinY = 0;\n }\n\n if (iMaxY < 0) {\n iMaxY = 0;\n }\n\n if (iMinX >= data.length) {\n iMinX = data.length - 1;\n }\n\n if (iMaxX >= data.length) {\n iMaxX = data.length - 1;\n }\n\n if (iMaxY >= data[0].length) {\n iMaxY = data[0].length - 1;\n }\n\n if (iMinY >= data[0].length) {\n iMinY = data[0].length - 1;\n }\n\n const minMax = [];\n hfShape.getRectMinMax(iMinX, iMinY, iMaxX, iMaxY, minMax);\n const min = minMax[0];\n const max = minMax[1]; // Bail out if we're cant touch the bounding height box\n\n if (localConvexPos.z - radius > max || localConvexPos.z + radius < min) {\n return;\n }\n\n for (let i = iMinX; i < iMaxX; i++) {\n for (let j = iMinY; j < iMaxY; j++) {\n let intersecting = false; // Lower triangle\n\n hfShape.getConvexTrianglePillar(i, j, false);\n Transform.pointToWorldFrame(hfPos, hfQuat, hfShape.pillarOffset, worldPillarOffset);\n\n if (convexPos.distanceTo(worldPillarOffset) < hfShape.pillarConvex.boundingSphereRadius + convexShape.boundingSphereRadius) {\n intersecting = this.convexConvex(convexShape, hfShape.pillarConvex, convexPos, worldPillarOffset, convexQuat, hfQuat, convexBody, hfBody, null, null, justTest, faceList, null);\n }\n\n if (justTest && intersecting) {\n return true;\n } // Upper triangle\n\n\n hfShape.getConvexTrianglePillar(i, j, true);\n Transform.pointToWorldFrame(hfPos, hfQuat, hfShape.pillarOffset, worldPillarOffset);\n\n if (convexPos.distanceTo(worldPillarOffset) < hfShape.pillarConvex.boundingSphereRadius + convexShape.boundingSphereRadius) {\n intersecting = this.convexConvex(convexShape, hfShape.pillarConvex, convexPos, worldPillarOffset, convexQuat, hfQuat, convexBody, hfBody, null, null, justTest, faceList, null);\n }\n\n if (justTest && intersecting) {\n return true;\n }\n }\n }\n }\n\n sphereParticle(sj, si, xj, xi, qj, qi, bj, bi, rsi, rsj, justTest) {\n // The normal is the unit vector from sphere center to particle center\n const normal = particleSphere_normal;\n normal.set(0, 0, 1);\n xi.vsub(xj, normal);\n const lengthSquared = normal.lengthSquared();\n\n if (lengthSquared <= sj.radius * sj.radius) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n normal.normalize();\n r.rj.copy(normal);\n r.rj.scale(sj.radius, r.rj);\n r.ni.copy(normal); // Contact normal\n\n r.ni.negate(r.ni);\n r.ri.set(0, 0, 0); // Center of particle\n\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n planeParticle(sj, si, xj, xi, qj, qi, bj, bi, rsi, rsj, justTest) {\n const normal = particlePlane_normal;\n normal.set(0, 0, 1);\n bj.quaternion.vmult(normal, normal); // Turn normal according to plane orientation\n\n const relpos = particlePlane_relpos;\n xi.vsub(bj.position, relpos);\n const dot = normal.dot(relpos);\n\n if (dot <= 0.0) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n r.ni.copy(normal); // Contact normal is the plane normal\n\n r.ni.negate(r.ni);\n r.ri.set(0, 0, 0); // Center of particle\n // Get particle position projected on plane\n\n const projected = particlePlane_projected;\n normal.scale(normal.dot(xi), projected);\n xi.vsub(projected, projected); //projected.vadd(bj.position,projected);\n // rj is now the projected world position minus plane position\n\n r.rj.copy(projected);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n boxParticle(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n si.convexPolyhedronRepresentation.material = si.material;\n si.convexPolyhedronRepresentation.collisionResponse = si.collisionResponse;\n return this.convexParticle(si.convexPolyhedronRepresentation, sj, xi, xj, qi, qj, bi, bj, si, sj, justTest);\n }\n\n convexParticle(sj, si, xj, xi, qj, qi, bj, bi, rsi, rsj, justTest) {\n let penetratedFaceIndex = -1;\n const penetratedFaceNormal = convexParticle_penetratedFaceNormal;\n const worldPenetrationVec = convexParticle_worldPenetrationVec;\n let minPenetration = null;\n\n const local = convexParticle_local;\n local.copy(xi);\n local.vsub(xj, local); // Convert position to relative the convex origin\n\n qj.conjugate(cqj);\n cqj.vmult(local, local);\n\n if (sj.pointIsInside(local)) {\n if (sj.worldVerticesNeedsUpdate) {\n sj.computeWorldVertices(xj, qj);\n }\n\n if (sj.worldFaceNormalsNeedsUpdate) {\n sj.computeWorldFaceNormals(qj);\n } // For each world polygon in the polyhedra\n\n\n for (let i = 0, nfaces = sj.faces.length; i !== nfaces; i++) {\n // Construct world face vertices\n const verts = [sj.worldVertices[sj.faces[i][0]]];\n const normal = sj.worldFaceNormals[i]; // Check how much the particle penetrates the polygon plane.\n\n xi.vsub(verts[0], convexParticle_vertexToParticle);\n const penetration = -normal.dot(convexParticle_vertexToParticle);\n\n if (minPenetration === null || Math.abs(penetration) < Math.abs(minPenetration)) {\n if (justTest) {\n return true;\n }\n\n minPenetration = penetration;\n penetratedFaceIndex = i;\n penetratedFaceNormal.copy(normal);\n }\n }\n\n if (penetratedFaceIndex !== -1) {\n // Setup contact\n const r = this.createContactEquation(bi, bj, si, sj, rsi, rsj);\n penetratedFaceNormal.scale(minPenetration, worldPenetrationVec); // rj is the particle position projected to the face\n\n worldPenetrationVec.vadd(xi, worldPenetrationVec);\n worldPenetrationVec.vsub(xj, worldPenetrationVec);\n r.rj.copy(worldPenetrationVec); //const projectedToFace = xi.vsub(xj).vadd(worldPenetrationVec);\n //projectedToFace.copy(r.rj);\n //qj.vmult(r.rj,r.rj);\n\n penetratedFaceNormal.negate(r.ni); // Contact normal\n\n r.ri.set(0, 0, 0); // Center of particle\n\n const ri = r.ri;\n const rj = r.rj; // Make relative to bodies\n\n ri.vadd(xi, ri);\n ri.vsub(bi.position, ri);\n rj.vadd(xj, rj);\n rj.vsub(bj.position, rj);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n } else {\n console.warn('Point found inside convex, but did not find penetrating face!');\n }\n }\n }\n\n heightfieldCylinder(hfShape, convexShape, hfPos, convexPos, hfQuat, convexQuat, hfBody, convexBody, rsi, rsj, justTest) {\n return this.convexHeightfield(convexShape, hfShape, convexPos, hfPos, convexQuat, hfQuat, convexBody, hfBody, rsi, rsj, justTest);\n }\n\n particleCylinder(si, sj, xi, xj, qi, qj, bi, bj, rsi, rsj, justTest) {\n return this.convexParticle(sj, si, xj, xi, qj, qi, bj, bi, rsi, rsj, justTest);\n }\n\n sphereTrimesh(sphereShape, trimeshShape, spherePos, trimeshPos, sphereQuat, trimeshQuat, sphereBody, trimeshBody, rsi, rsj, justTest) {\n const edgeVertexA = sphereTrimesh_edgeVertexA;\n const edgeVertexB = sphereTrimesh_edgeVertexB;\n const edgeVector = sphereTrimesh_edgeVector;\n const edgeVectorUnit = sphereTrimesh_edgeVectorUnit;\n const localSpherePos = sphereTrimesh_localSpherePos;\n const tmp = sphereTrimesh_tmp;\n const localSphereAABB = sphereTrimesh_localSphereAABB;\n const v2 = sphereTrimesh_v2;\n const relpos = sphereTrimesh_relpos;\n const triangles = sphereTrimesh_triangles; // Convert sphere position to local in the trimesh\n\n Transform.pointToLocalFrame(trimeshPos, trimeshQuat, spherePos, localSpherePos); // Get the aabb of the sphere locally in the trimesh\n\n const sphereRadius = sphereShape.radius;\n localSphereAABB.lowerBound.set(localSpherePos.x - sphereRadius, localSpherePos.y - sphereRadius, localSpherePos.z - sphereRadius);\n localSphereAABB.upperBound.set(localSpherePos.x + sphereRadius, localSpherePos.y + sphereRadius, localSpherePos.z + sphereRadius);\n trimeshShape.getTrianglesInAABB(localSphereAABB, triangles); //for (let i = 0; i < trimeshShape.indices.length / 3; i++) triangles.push(i); // All\n // Vertices\n\n const v = sphereTrimesh_v;\n const radiusSquared = sphereShape.radius * sphereShape.radius;\n\n for (let i = 0; i < triangles.length; i++) {\n for (let j = 0; j < 3; j++) {\n trimeshShape.getVertex(trimeshShape.indices[triangles[i] * 3 + j], v); // Check vertex overlap in sphere\n\n v.vsub(localSpherePos, relpos);\n\n if (relpos.lengthSquared() <= radiusSquared) {\n // Safe up\n v2.copy(v);\n Transform.pointToWorldFrame(trimeshPos, trimeshQuat, v2, v);\n v.vsub(spherePos, relpos);\n\n if (justTest) {\n return true;\n }\n\n let r = this.createContactEquation(sphereBody, trimeshBody, sphereShape, trimeshShape, rsi, rsj);\n r.ni.copy(relpos);\n r.ni.normalize(); // ri is the vector from sphere center to the sphere surface\n\n r.ri.copy(r.ni);\n r.ri.scale(sphereShape.radius, r.ri);\n r.ri.vadd(spherePos, r.ri);\n r.ri.vsub(sphereBody.position, r.ri);\n r.rj.copy(v);\n r.rj.vsub(trimeshBody.position, r.rj); // Store result\n\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n } // Check all edges\n\n\n for (let i = 0; i < triangles.length; i++) {\n for (let j = 0; j < 3; j++) {\n trimeshShape.getVertex(trimeshShape.indices[triangles[i] * 3 + j], edgeVertexA);\n trimeshShape.getVertex(trimeshShape.indices[triangles[i] * 3 + (j + 1) % 3], edgeVertexB);\n edgeVertexB.vsub(edgeVertexA, edgeVector); // Project sphere position to the edge\n\n localSpherePos.vsub(edgeVertexB, tmp);\n const positionAlongEdgeB = tmp.dot(edgeVector);\n localSpherePos.vsub(edgeVertexA, tmp);\n let positionAlongEdgeA = tmp.dot(edgeVector);\n\n if (positionAlongEdgeA > 0 && positionAlongEdgeB < 0) {\n // Now check the orthogonal distance from edge to sphere center\n localSpherePos.vsub(edgeVertexA, tmp);\n edgeVectorUnit.copy(edgeVector);\n edgeVectorUnit.normalize();\n positionAlongEdgeA = tmp.dot(edgeVectorUnit);\n edgeVectorUnit.scale(positionAlongEdgeA, tmp);\n tmp.vadd(edgeVertexA, tmp); // tmp is now the sphere center position projected to the edge, defined locally in the trimesh frame\n\n const dist = tmp.distanceTo(localSpherePos);\n\n if (dist < sphereShape.radius) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(sphereBody, trimeshBody, sphereShape, trimeshShape, rsi, rsj);\n tmp.vsub(localSpherePos, r.ni);\n r.ni.normalize();\n r.ni.scale(sphereShape.radius, r.ri);\n r.ri.vadd(spherePos, r.ri);\n r.ri.vsub(sphereBody.position, r.ri);\n Transform.pointToWorldFrame(trimeshPos, trimeshQuat, tmp, tmp);\n tmp.vsub(trimeshBody.position, r.rj);\n Transform.vectorToWorldFrame(trimeshQuat, r.ni, r.ni);\n Transform.vectorToWorldFrame(trimeshQuat, r.ri, r.ri);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n }\n } // Triangle faces\n\n\n const va = sphereTrimesh_va;\n const vb = sphereTrimesh_vb;\n const vc = sphereTrimesh_vc;\n const normal = sphereTrimesh_normal;\n\n for (let i = 0, N = triangles.length; i !== N; i++) {\n trimeshShape.getTriangleVertices(triangles[i], va, vb, vc);\n trimeshShape.getNormal(triangles[i], normal);\n localSpherePos.vsub(va, tmp);\n let dist = tmp.dot(normal);\n normal.scale(dist, tmp);\n localSpherePos.vsub(tmp, tmp); // tmp is now the sphere position projected to the triangle plane\n\n dist = tmp.distanceTo(localSpherePos);\n\n if (Ray.pointInTriangle(tmp, va, vb, vc) && dist < sphereShape.radius) {\n if (justTest) {\n return true;\n }\n\n let r = this.createContactEquation(sphereBody, trimeshBody, sphereShape, trimeshShape, rsi, rsj);\n tmp.vsub(localSpherePos, r.ni);\n r.ni.normalize();\n r.ni.scale(sphereShape.radius, r.ri);\n r.ri.vadd(spherePos, r.ri);\n r.ri.vsub(sphereBody.position, r.ri);\n Transform.pointToWorldFrame(trimeshPos, trimeshQuat, tmp, tmp);\n tmp.vsub(trimeshBody.position, r.rj);\n Transform.vectorToWorldFrame(trimeshQuat, r.ni, r.ni);\n Transform.vectorToWorldFrame(trimeshQuat, r.ri, r.ri);\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n\n triangles.length = 0;\n }\n\n planeTrimesh(planeShape, trimeshShape, planePos, trimeshPos, planeQuat, trimeshQuat, planeBody, trimeshBody, rsi, rsj, justTest) {\n // Make contacts!\n const v = new Vec3();\n const normal = planeTrimesh_normal;\n normal.set(0, 0, 1);\n planeQuat.vmult(normal, normal); // Turn normal according to plane\n\n for (let i = 0; i < trimeshShape.vertices.length / 3; i++) {\n // Get world vertex from trimesh\n trimeshShape.getVertex(i, v); // Safe up\n\n const v2 = new Vec3();\n v2.copy(v);\n Transform.pointToWorldFrame(trimeshPos, trimeshQuat, v2, v); // Check plane side\n\n const relpos = planeTrimesh_relpos;\n v.vsub(planePos, relpos);\n const dot = normal.dot(relpos);\n\n if (dot <= 0.0) {\n if (justTest) {\n return true;\n }\n\n const r = this.createContactEquation(planeBody, trimeshBody, planeShape, trimeshShape, rsi, rsj);\n r.ni.copy(normal); // Contact normal is the plane normal\n // Get vertex position projected on plane\n\n const projected = planeTrimesh_projected;\n normal.scale(relpos.dot(normal), projected);\n v.vsub(projected, projected); // ri is the projected world position minus plane position\n\n r.ri.copy(projected);\n r.ri.vsub(planeBody.position, r.ri);\n r.rj.copy(v);\n r.rj.vsub(trimeshBody.position, r.rj); // Store result\n\n this.result.push(r);\n this.createFrictionEquationsFromContact(r, this.frictionResult);\n }\n }\n } // convexTrimesh(\n // si: ConvexPolyhedron, sj: Trimesh, xi: Vec3, xj: Vec3, qi: Quaternion, qj: Quaternion,\n // bi: Body, bj: Body, rsi?: Shape | null, rsj?: Shape | null,\n // faceListA?: number[] | null, faceListB?: number[] | null,\n // ) {\n // const sepAxis = convexConvex_sepAxis;\n // if(xi.distanceTo(xj) > si.boundingSphereRadius + sj.boundingSphereRadius){\n // return;\n // }\n // // Construct a temp hull for each triangle\n // const hullB = new ConvexPolyhedron();\n // hullB.faces = [[0,1,2]];\n // const va = new Vec3();\n // const vb = new Vec3();\n // const vc = new Vec3();\n // hullB.vertices = [\n // va,\n // vb,\n // vc\n // ];\n // for (let i = 0; i < sj.indices.length / 3; i++) {\n // const triangleNormal = new Vec3();\n // sj.getNormal(i, triangleNormal);\n // hullB.faceNormals = [triangleNormal];\n // sj.getTriangleVertices(i, va, vb, vc);\n // let d = si.testSepAxis(triangleNormal, hullB, xi, qi, xj, qj);\n // if(!d){\n // triangleNormal.scale(-1, triangleNormal);\n // d = si.testSepAxis(triangleNormal, hullB, xi, qi, xj, qj);\n // if(!d){\n // continue;\n // }\n // }\n // const res: ConvexPolyhedronContactPoint[] = [];\n // const q = convexConvex_q;\n // si.clipAgainstHull(xi,qi,hullB,xj,qj,triangleNormal,-100,100,res);\n // for(let j = 0; j !== res.length; j++){\n // const r = this.createContactEquation(bi,bj,si,sj,rsi,rsj),\n // ri = r.ri,\n // rj = r.rj;\n // r.ni.copy(triangleNormal);\n // r.ni.negate(r.ni);\n // res[j].normal.negate(q);\n // q.mult(res[j].depth, q);\n // res[j].point.vadd(q, ri);\n // rj.copy(res[j].point);\n // // Contact points are in world coordinates. Transform back to relative\n // ri.vsub(xi,ri);\n // rj.vsub(xj,rj);\n // // Make relative to bodies\n // ri.vadd(xi, ri);\n // ri.vsub(bi.position, ri);\n // rj.vadd(xj, rj);\n // rj.vsub(bj.position, rj);\n // result.push(r);\n // }\n // }\n // }\n\n\n}\nconst averageNormal = new Vec3();\nconst averageContactPointA = new Vec3();\nconst averageContactPointB = new Vec3();\nconst tmpVec1 = new Vec3();\nconst tmpVec2 = new Vec3();\nconst tmpQuat1 = new Quaternion();\nconst tmpQuat2 = new Quaternion();\n\nconst planeTrimesh_normal = new Vec3();\nconst planeTrimesh_relpos = new Vec3();\nconst planeTrimesh_projected = new Vec3();\nconst sphereTrimesh_normal = new Vec3();\nconst sphereTrimesh_relpos = new Vec3();\nnew Vec3();\nconst sphereTrimesh_v = new Vec3();\nconst sphereTrimesh_v2 = new Vec3();\nconst sphereTrimesh_edgeVertexA = new Vec3();\nconst sphereTrimesh_edgeVertexB = new Vec3();\nconst sphereTrimesh_edgeVector = new Vec3();\nconst sphereTrimesh_edgeVectorUnit = new Vec3();\nconst sphereTrimesh_localSpherePos = new Vec3();\nconst sphereTrimesh_tmp = new Vec3();\nconst sphereTrimesh_va = new Vec3();\nconst sphereTrimesh_vb = new Vec3();\nconst sphereTrimesh_vc = new Vec3();\nconst sphereTrimesh_localSphereAABB = new AABB();\nconst sphereTrimesh_triangles = [];\nconst point_on_plane_to_sphere = new Vec3();\nconst plane_to_sphere_ortho = new Vec3(); // See http://bulletphysics.com/Bullet/BulletFull/SphereTriangleDetector_8cpp_source.html\n\nconst pointInPolygon_edge = new Vec3();\nconst pointInPolygon_edge_x_normal = new Vec3();\nconst pointInPolygon_vtp = new Vec3();\n\nfunction pointInPolygon(verts, normal, p) {\n let positiveResult = null;\n const N = verts.length;\n\n for (let i = 0; i !== N; i++) {\n const v = verts[i]; // Get edge to the next vertex\n\n const edge = pointInPolygon_edge;\n verts[(i + 1) % N].vsub(v, edge); // Get cross product between polygon normal and the edge\n\n const edge_x_normal = pointInPolygon_edge_x_normal; //const edge_x_normal = new Vec3();\n\n edge.cross(normal, edge_x_normal); // Get vector between point and current vertex\n\n const vertex_to_p = pointInPolygon_vtp;\n p.vsub(v, vertex_to_p); // This dot product determines which side of the edge the point is\n\n const r = edge_x_normal.dot(vertex_to_p); // If all such dot products have same sign, we are inside the polygon.\n\n if (positiveResult === null || r > 0 && positiveResult === true || r <= 0 && positiveResult === false) {\n if (positiveResult === null) {\n positiveResult = r > 0;\n }\n\n continue;\n } else {\n return false; // Encountered some other sign. Exit.\n }\n } // If we got here, all dot products were of the same sign.\n\n\n return true;\n}\n\nconst box_to_sphere = new Vec3();\nconst sphereBox_ns = new Vec3();\nconst sphereBox_ns1 = new Vec3();\nconst sphereBox_ns2 = new Vec3();\nconst sphereBox_sides = [new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3()];\nconst sphereBox_sphere_to_corner = new Vec3();\nconst sphereBox_side_ns = new Vec3();\nconst sphereBox_side_ns1 = new Vec3();\nconst sphereBox_side_ns2 = new Vec3();\nconst convex_to_sphere = new Vec3();\nconst sphereConvex_edge = new Vec3();\nconst sphereConvex_edgeUnit = new Vec3();\nconst sphereConvex_sphereToCorner = new Vec3();\nconst sphereConvex_worldCorner = new Vec3();\nconst sphereConvex_worldNormal = new Vec3();\nconst sphereConvex_worldPoint = new Vec3();\nconst sphereConvex_worldSpherePointClosestToPlane = new Vec3();\nconst sphereConvex_penetrationVec = new Vec3();\nconst sphereConvex_sphereToWorldPoint = new Vec3();\nnew Vec3();\nnew Vec3();\nconst planeConvex_v = new Vec3();\nconst planeConvex_normal = new Vec3();\nconst planeConvex_relpos = new Vec3();\nconst planeConvex_projected = new Vec3();\nconst convexConvex_sepAxis = new Vec3();\nconst convexConvex_q = new Vec3();\nconst particlePlane_normal = new Vec3();\nconst particlePlane_relpos = new Vec3();\nconst particlePlane_projected = new Vec3();\nconst particleSphere_normal = new Vec3(); // WIP\n\nconst cqj = new Quaternion();\nconst convexParticle_local = new Vec3();\nnew Vec3();\nconst convexParticle_penetratedFaceNormal = new Vec3();\nconst convexParticle_vertexToParticle = new Vec3();\nconst convexParticle_worldPenetrationVec = new Vec3();\nconst convexHeightfield_tmp1 = new Vec3();\nconst convexHeightfield_tmp2 = new Vec3();\nconst convexHeightfield_faceList = [0];\nconst sphereHeightfield_tmp1 = new Vec3();\nconst sphereHeightfield_tmp2 = new Vec3();\n\nclass OverlapKeeper {\n /**\n * @todo Remove useless constructor\n */\n constructor() {\n this.current = [];\n this.previous = [];\n }\n /**\n * getKey\n */\n\n\n getKey(i, j) {\n if (j < i) {\n const temp = j;\n j = i;\n i = temp;\n }\n\n return i << 16 | j;\n }\n /**\n * set\n */\n\n\n set(i, j) {\n // Insertion sort. This way the diff will have linear complexity.\n const key = this.getKey(i, j);\n const current = this.current;\n let index = 0;\n\n while (key > current[index]) {\n index++;\n }\n\n if (key === current[index]) {\n return; // Pair was already added\n }\n\n for (let j = current.length - 1; j >= index; j--) {\n current[j + 1] = current[j];\n }\n\n current[index] = key;\n }\n /**\n * tick\n */\n\n\n tick() {\n const tmp = this.current;\n this.current = this.previous;\n this.previous = tmp;\n this.current.length = 0;\n }\n /**\n * getDiff\n */\n\n\n getDiff(additions, removals) {\n const a = this.current;\n const b = this.previous;\n const al = a.length;\n const bl = b.length;\n let j = 0;\n\n for (let i = 0; i < al; i++) {\n let found = false;\n const keyA = a[i];\n\n while (keyA > b[j]) {\n j++;\n }\n\n found = keyA === b[j];\n\n if (!found) {\n unpackAndPush(additions, keyA);\n }\n }\n\n j = 0;\n\n for (let i = 0; i < bl; i++) {\n let found = false;\n const keyB = b[i];\n\n while (keyB > a[j]) {\n j++;\n }\n\n found = a[j] === keyB;\n\n if (!found) {\n unpackAndPush(removals, keyB);\n }\n }\n }\n\n}\n\nfunction unpackAndPush(array, key) {\n array.push((key & 0xffff0000) >> 16, key & 0x0000ffff);\n}\n\nconst getKey = (i, j) => i < j ? `${i}-${j}` : `${j}-${i}`;\n/**\n * TupleDictionary\n */\n\n\nclass TupleDictionary {\n constructor() {\n this.data = {\n keys: []\n };\n }\n\n /** get */\n get(i, j) {\n const key = getKey(i, j);\n return this.data[key];\n }\n /** set */\n\n\n set(i, j, value) {\n const key = getKey(i, j); // Check if key already exists\n\n if (!this.get(i, j)) {\n this.data.keys.push(key);\n }\n\n this.data[key] = value;\n }\n /** delete */\n\n\n delete(i, j) {\n const key = getKey(i, j);\n const index = this.data.keys.indexOf(key);\n\n if (index !== -1) {\n this.data.keys.splice(index, 1);\n }\n\n delete this.data[key];\n }\n /** reset */\n\n\n reset() {\n const data = this.data;\n const keys = data.keys;\n\n while (keys.length > 0) {\n const key = keys.pop();\n delete data[key];\n }\n }\n\n}\n\n/**\n * The physics world\n */\nclass World extends EventTarget {\n /**\n * Currently / last used timestep. Is set to -1 if not available. This value is updated before each internal step, which means that it is \"fresh\" inside event callbacks.\n */\n\n /**\n * Makes bodies go to sleep when they've been inactive.\n * @default false\n */\n\n /**\n * All the current contacts (instances of ContactEquation) in the world.\n */\n\n /**\n * How often to normalize quaternions. Set to 0 for every step, 1 for every second etc.. A larger value increases performance. If bodies tend to explode, set to a smaller value (zero to be sure nothing can go wrong).\n * @default 0\n */\n\n /**\n * Set to true to use fast quaternion normalization. It is often enough accurate to use.\n * If bodies tend to explode, set to false.\n * @default false\n */\n\n /**\n * The wall-clock time since simulation start.\n */\n\n /**\n * Number of timesteps taken since start.\n */\n\n /**\n * Default and last timestep sizes.\n */\n\n /**\n * The gravity of the world.\n */\n\n /**\n * Gravity to use when approximating the friction max force (mu*mass*gravity).\n * If undefined, global gravity will be used.\n * Use to enable friction in a World with a null gravity vector (no gravity).\n */\n\n /**\n * The broadphase algorithm to use.\n * @default NaiveBroadphase\n */\n\n /**\n * All bodies in this world\n */\n\n /**\n * True if any bodies are not sleeping, false if every body is sleeping.\n */\n\n /**\n * The solver algorithm to use.\n * @default GSSolver\n */\n\n /**\n * collisionMatrix\n */\n\n /**\n * CollisionMatrix from the previous step.\n */\n\n /**\n * All added contactmaterials.\n */\n\n /**\n * Used to look up a ContactMaterial given two instances of Material.\n */\n\n /**\n * The default material of the bodies.\n */\n\n /**\n * This contact material is used if no suitable contactmaterial is found for a contact.\n */\n\n /**\n * Time accumulator for interpolation.\n * @see https://gafferongames.com/game-physics/fix-your-timestep/\n */\n\n /**\n * Dispatched after a body has been added to the world.\n */\n\n /**\n * Dispatched after a body has been removed from the world.\n */\n constructor(options) {\n if (options === void 0) {\n options = {};\n }\n\n super();\n this.dt = -1;\n this.allowSleep = !!options.allowSleep;\n this.contacts = [];\n this.frictionEquations = [];\n this.quatNormalizeSkip = options.quatNormalizeSkip !== undefined ? options.quatNormalizeSkip : 0;\n this.quatNormalizeFast = options.quatNormalizeFast !== undefined ? options.quatNormalizeFast : false;\n this.time = 0.0;\n this.stepnumber = 0;\n this.default_dt = 1 / 60;\n this.nextId = 0;\n this.gravity = new Vec3();\n\n if (options.gravity) {\n this.gravity.copy(options.gravity);\n }\n\n if (options.frictionGravity) {\n this.frictionGravity = new Vec3();\n this.frictionGravity.copy(options.frictionGravity);\n }\n\n this.broadphase = options.broadphase !== undefined ? options.broadphase : new NaiveBroadphase();\n this.bodies = [];\n this.hasActiveBodies = false;\n this.solver = options.solver !== undefined ? options.solver : new GSSolver();\n this.constraints = [];\n this.narrowphase = new Narrowphase(this);\n this.collisionMatrix = new ArrayCollisionMatrix();\n this.collisionMatrixPrevious = new ArrayCollisionMatrix();\n this.bodyOverlapKeeper = new OverlapKeeper();\n this.shapeOverlapKeeper = new OverlapKeeper();\n this.contactmaterials = [];\n this.contactMaterialTable = new TupleDictionary();\n this.defaultMaterial = new Material('default');\n this.defaultContactMaterial = new ContactMaterial(this.defaultMaterial, this.defaultMaterial, {\n friction: 0.3,\n restitution: 0.0\n });\n this.doProfiling = false;\n this.profile = {\n solve: 0,\n makeContactConstraints: 0,\n broadphase: 0,\n integrate: 0,\n narrowphase: 0\n };\n this.accumulator = 0;\n this.subsystems = [];\n this.addBodyEvent = {\n type: 'addBody',\n body: null\n };\n this.removeBodyEvent = {\n type: 'removeBody',\n body: null\n };\n this.idToBodyMap = {};\n this.broadphase.setWorld(this);\n }\n /**\n * Get the contact material between materials m1 and m2\n * @return The contact material if it was found.\n */\n\n\n getContactMaterial(m1, m2) {\n return this.contactMaterialTable.get(m1.id, m2.id);\n }\n /**\n * Store old collision state info\n */\n\n\n collisionMatrixTick() {\n const temp = this.collisionMatrixPrevious;\n this.collisionMatrixPrevious = this.collisionMatrix;\n this.collisionMatrix = temp;\n this.collisionMatrix.reset();\n this.bodyOverlapKeeper.tick();\n this.shapeOverlapKeeper.tick();\n }\n /**\n * Add a constraint to the simulation.\n */\n\n\n addConstraint(c) {\n this.constraints.push(c);\n }\n /**\n * Removes a constraint\n */\n\n\n removeConstraint(c) {\n const idx = this.constraints.indexOf(c);\n\n if (idx !== -1) {\n this.constraints.splice(idx, 1);\n }\n }\n /**\n * Raycast test\n * @deprecated Use .raycastAll, .raycastClosest or .raycastAny instead.\n */\n\n\n rayTest(from, to, result) {\n if (result instanceof RaycastResult) {\n // Do raycastClosest\n this.raycastClosest(from, to, {\n skipBackfaces: true\n }, result);\n } else {\n // Do raycastAll\n this.raycastAll(from, to, {\n skipBackfaces: true\n }, result);\n }\n }\n /**\n * Ray cast against all bodies. The provided callback will be executed for each hit with a RaycastResult as single argument.\n * @return True if any body was hit.\n */\n\n\n raycastAll(from, to, options, callback) {\n if (options === void 0) {\n options = {};\n }\n\n options.mode = Ray.ALL;\n options.from = from;\n options.to = to;\n options.callback = callback;\n return tmpRay.intersectWorld(this, options);\n }\n /**\n * Ray cast, and stop at the first result. Note that the order is random - but the method is fast.\n * @return True if any body was hit.\n */\n\n\n raycastAny(from, to, options, result) {\n if (options === void 0) {\n options = {};\n }\n\n options.mode = Ray.ANY;\n options.from = from;\n options.to = to;\n options.result = result;\n return tmpRay.intersectWorld(this, options);\n }\n /**\n * Ray cast, and return information of the closest hit.\n * @return True if any body was hit.\n */\n\n\n raycastClosest(from, to, options, result) {\n if (options === void 0) {\n options = {};\n }\n\n options.mode = Ray.CLOSEST;\n options.from = from;\n options.to = to;\n options.result = result;\n return tmpRay.intersectWorld(this, options);\n }\n /**\n * Add a rigid body to the simulation.\n * @todo If the simulation has not yet started, why recrete and copy arrays for each body? Accumulate in dynamic arrays in this case.\n * @todo Adding an array of bodies should be possible. This would save some loops too\n */\n\n\n addBody(body) {\n if (this.bodies.includes(body)) {\n return;\n }\n\n body.index = this.bodies.length;\n this.bodies.push(body);\n body.world = this;\n body.initPosition.copy(body.position);\n body.initVelocity.copy(body.velocity);\n body.timeLastSleepy = this.time;\n\n if (body instanceof Body) {\n body.initAngularVelocity.copy(body.angularVelocity);\n body.initQuaternion.copy(body.quaternion);\n }\n\n this.collisionMatrix.setNumObjects(this.bodies.length);\n this.addBodyEvent.body = body;\n this.idToBodyMap[body.id] = body;\n this.dispatchEvent(this.addBodyEvent);\n }\n /**\n * Remove a rigid body from the simulation.\n */\n\n\n removeBody(body) {\n body.world = null;\n const n = this.bodies.length - 1;\n const bodies = this.bodies;\n const idx = bodies.indexOf(body);\n\n if (idx !== -1) {\n bodies.splice(idx, 1); // Todo: should use a garbage free method\n // Recompute index\n\n for (let i = 0; i !== bodies.length; i++) {\n bodies[i].index = i;\n }\n\n this.collisionMatrix.setNumObjects(n);\n this.removeBodyEvent.body = body;\n delete this.idToBodyMap[body.id];\n this.dispatchEvent(this.removeBodyEvent);\n }\n }\n\n getBodyById(id) {\n return this.idToBodyMap[id];\n }\n /**\n * @todo Make a faster map\n */\n\n\n getShapeById(id) {\n const bodies = this.bodies;\n\n for (let i = 0; i < bodies.length; i++) {\n const shapes = bodies[i].shapes;\n\n for (let j = 0; j < shapes.length; j++) {\n const shape = shapes[j];\n\n if (shape.id === id) {\n return shape;\n }\n }\n }\n\n return null;\n }\n /**\n * Adds a contact material to the World\n */\n\n\n addContactMaterial(cmat) {\n // Add contact material\n this.contactmaterials.push(cmat); // Add current contact material to the material table\n\n this.contactMaterialTable.set(cmat.materials[0].id, cmat.materials[1].id, cmat);\n }\n /**\n * Removes a contact material from the World.\n */\n\n\n removeContactMaterial(cmat) {\n const idx = this.contactmaterials.indexOf(cmat);\n\n if (idx === -1) {\n return;\n }\n\n this.contactmaterials.splice(idx, 1);\n this.contactMaterialTable.delete(cmat.materials[0].id, cmat.materials[1].id);\n }\n /**\n * Step the simulation forward keeping track of last called time\n * to be able to step the world at a fixed rate, independently of framerate.\n *\n * @param dt The fixed time step size to use (default: 1 / 60).\n * @param maxSubSteps Maximum number of fixed steps to take per function call (default: 10).\n * @see https://gafferongames.com/post/fix_your_timestep/\n * @example\n * // Run the simulation independently of framerate every 1 / 60 ms\n * world.fixedStep()\n */\n\n\n fixedStep(dt, maxSubSteps) {\n if (dt === void 0) {\n dt = 1 / 60;\n }\n\n if (maxSubSteps === void 0) {\n maxSubSteps = 10;\n }\n\n const time = performance.now() / 1000; // seconds\n\n if (!this.lastCallTime) {\n this.step(dt, undefined, maxSubSteps);\n } else {\n const timeSinceLastCalled = time - this.lastCallTime;\n this.step(dt, timeSinceLastCalled, maxSubSteps);\n }\n\n this.lastCallTime = time;\n }\n /**\n * Step the physics world forward in time.\n *\n * There are two modes. The simple mode is fixed timestepping without interpolation. In this case you only use the first argument. The second case uses interpolation. In that you also provide the time since the function was last used, as well as the maximum fixed timesteps to take.\n *\n * @param dt The fixed time step size to use.\n * @param timeSinceLastCalled The time elapsed since the function was last called.\n * @param maxSubSteps Maximum number of fixed steps to take per function call (default: 10).\n * @see https://web.archive.org/web/20180426154531/http://bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_The_World#What_do_the_parameters_to_btDynamicsWorld::stepSimulation_mean.3F\n * @example\n * // fixed timestepping without interpolation\n * world.step(1 / 60)\n */\n\n\n step(dt, timeSinceLastCalled, maxSubSteps) {\n if (maxSubSteps === void 0) {\n maxSubSteps = 10;\n }\n\n if (timeSinceLastCalled === undefined) {\n // Fixed, simple stepping\n this.internalStep(dt); // Increment time\n\n this.time += dt;\n } else {\n this.accumulator += timeSinceLastCalled;\n const t0 = performance.now();\n let substeps = 0;\n\n while (this.accumulator >= dt && substeps < maxSubSteps) {\n // Do fixed steps to catch up\n this.internalStep(dt);\n this.accumulator -= dt;\n substeps++;\n\n if (performance.now() - t0 > dt * 1000) {\n // The framerate is not interactive anymore.\n // We are below the target framerate.\n // Better bail out.\n break;\n }\n } // Remove the excess accumulator, since we may not\n // have had enough substeps available to catch up\n\n\n this.accumulator = this.accumulator % dt;\n const t = this.accumulator / dt;\n\n for (let j = 0; j !== this.bodies.length; j++) {\n const b = this.bodies[j];\n b.previousPosition.lerp(b.position, t, b.interpolatedPosition);\n b.previousQuaternion.slerp(b.quaternion, t, b.interpolatedQuaternion);\n b.previousQuaternion.normalize();\n }\n\n this.time += timeSinceLastCalled;\n }\n }\n\n internalStep(dt) {\n this.dt = dt;\n const contacts = this.contacts;\n const p1 = World_step_p1;\n const p2 = World_step_p2;\n const N = this.bodies.length;\n const bodies = this.bodies;\n const solver = this.solver;\n const gravity = this.gravity;\n const doProfiling = this.doProfiling;\n const profile = this.profile;\n const DYNAMIC = Body.DYNAMIC;\n let profilingStart = -Infinity;\n const constraints = this.constraints;\n const frictionEquationPool = World_step_frictionEquationPool;\n gravity.length();\n const gx = gravity.x;\n const gy = gravity.y;\n const gz = gravity.z;\n let i = 0;\n\n if (doProfiling) {\n profilingStart = performance.now();\n } // Add gravity to all objects\n\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n if (bi.type === DYNAMIC) {\n // Only for dynamic bodies\n const f = bi.force;\n const m = bi.mass;\n f.x += m * gx;\n f.y += m * gy;\n f.z += m * gz;\n }\n } // Update subsystems\n\n\n for (let i = 0, Nsubsystems = this.subsystems.length; i !== Nsubsystems; i++) {\n this.subsystems[i].update();\n } // Collision detection\n\n\n if (doProfiling) {\n profilingStart = performance.now();\n }\n\n p1.length = 0; // Clean up pair arrays from last step\n\n p2.length = 0;\n this.broadphase.collisionPairs(this, p1, p2);\n\n if (doProfiling) {\n profile.broadphase = performance.now() - profilingStart;\n } // Remove constrained pairs with collideConnected == false\n\n\n let Nconstraints = constraints.length;\n\n for (i = 0; i !== Nconstraints; i++) {\n const c = constraints[i];\n\n if (!c.collideConnected) {\n for (let j = p1.length - 1; j >= 0; j -= 1) {\n if (c.bodyA === p1[j] && c.bodyB === p2[j] || c.bodyB === p1[j] && c.bodyA === p2[j]) {\n p1.splice(j, 1);\n p2.splice(j, 1);\n }\n }\n }\n }\n\n this.collisionMatrixTick(); // Generate contacts\n\n if (doProfiling) {\n profilingStart = performance.now();\n }\n\n const oldcontacts = World_step_oldContacts;\n const NoldContacts = contacts.length;\n\n for (i = 0; i !== NoldContacts; i++) {\n oldcontacts.push(contacts[i]);\n }\n\n contacts.length = 0; // Transfer FrictionEquation from current list to the pool for reuse\n\n const NoldFrictionEquations = this.frictionEquations.length;\n\n for (i = 0; i !== NoldFrictionEquations; i++) {\n frictionEquationPool.push(this.frictionEquations[i]);\n }\n\n this.frictionEquations.length = 0;\n this.narrowphase.getContacts(p1, p2, this, contacts, oldcontacts, // To be reused\n this.frictionEquations, frictionEquationPool);\n\n if (doProfiling) {\n profile.narrowphase = performance.now() - profilingStart;\n } // Loop over all collisions\n\n\n if (doProfiling) {\n profilingStart = performance.now();\n } // Add all friction eqs\n\n\n for (i = 0; i < this.frictionEquations.length; i++) {\n solver.addEquation(this.frictionEquations[i]);\n }\n\n const ncontacts = contacts.length;\n\n for (let k = 0; k !== ncontacts; k++) {\n // Current contact\n const c = contacts[k]; // Get current collision indeces\n\n const bi = c.bi;\n const bj = c.bj;\n const si = c.si;\n const sj = c.sj; // Get collision properties\n\n let cm;\n\n if (bi.material && bj.material) {\n cm = this.getContactMaterial(bi.material, bj.material) || this.defaultContactMaterial;\n } else {\n cm = this.defaultContactMaterial;\n } // c.enabled = bi.collisionResponse && bj.collisionResponse && si.collisionResponse && sj.collisionResponse;\n\n\n cm.friction; // c.restitution = cm.restitution;\n // If friction or restitution were specified in the material, use them\n\n if (bi.material && bj.material) {\n if (bi.material.friction >= 0 && bj.material.friction >= 0) {\n bi.material.friction * bj.material.friction;\n }\n\n if (bi.material.restitution >= 0 && bj.material.restitution >= 0) {\n c.restitution = bi.material.restitution * bj.material.restitution;\n }\n } // c.setSpookParams(\n // cm.contactEquationStiffness,\n // cm.contactEquationRelaxation,\n // dt\n // );\n\n\n solver.addEquation(c); // // Add friction constraint equation\n // if(mu > 0){\n // \t// Create 2 tangent equations\n // \tconst mug = mu * gnorm;\n // \tconst reducedMass = (bi.invMass + bj.invMass);\n // \tif(reducedMass > 0){\n // \t\treducedMass = 1/reducedMass;\n // \t}\n // \tconst pool = frictionEquationPool;\n // \tconst c1 = pool.length ? pool.pop() : new FrictionEquation(bi,bj,mug*reducedMass);\n // \tconst c2 = pool.length ? pool.pop() : new FrictionEquation(bi,bj,mug*reducedMass);\n // \tthis.frictionEquations.push(c1, c2);\n // \tc1.bi = c2.bi = bi;\n // \tc1.bj = c2.bj = bj;\n // \tc1.minForce = c2.minForce = -mug*reducedMass;\n // \tc1.maxForce = c2.maxForce = mug*reducedMass;\n // \t// Copy over the relative vectors\n // \tc1.ri.copy(c.ri);\n // \tc1.rj.copy(c.rj);\n // \tc2.ri.copy(c.ri);\n // \tc2.rj.copy(c.rj);\n // \t// Construct tangents\n // \tc.ni.tangents(c1.t, c2.t);\n // // Set spook params\n // c1.setSpookParams(cm.frictionEquationStiffness, cm.frictionEquationRelaxation, dt);\n // c2.setSpookParams(cm.frictionEquationStiffness, cm.frictionEquationRelaxation, dt);\n // c1.enabled = c2.enabled = c.enabled;\n // \t// Add equations to solver\n // \tsolver.addEquation(c1);\n // \tsolver.addEquation(c2);\n // }\n\n if (bi.allowSleep && bi.type === Body.DYNAMIC && bi.sleepState === Body.SLEEPING && bj.sleepState === Body.AWAKE && bj.type !== Body.STATIC) {\n const speedSquaredB = bj.velocity.lengthSquared() + bj.angularVelocity.lengthSquared();\n const speedLimitSquaredB = bj.sleepSpeedLimit ** 2;\n\n if (speedSquaredB >= speedLimitSquaredB * 2) {\n bi.wakeUpAfterNarrowphase = true;\n }\n }\n\n if (bj.allowSleep && bj.type === Body.DYNAMIC && bj.sleepState === Body.SLEEPING && bi.sleepState === Body.AWAKE && bi.type !== Body.STATIC) {\n const speedSquaredA = bi.velocity.lengthSquared() + bi.angularVelocity.lengthSquared();\n const speedLimitSquaredA = bi.sleepSpeedLimit ** 2;\n\n if (speedSquaredA >= speedLimitSquaredA * 2) {\n bj.wakeUpAfterNarrowphase = true;\n }\n } // Now we know that i and j are in contact. Set collision matrix state\n\n\n this.collisionMatrix.set(bi, bj, true);\n\n if (!this.collisionMatrixPrevious.get(bi, bj)) {\n // First contact!\n // We reuse the collideEvent object, otherwise we will end up creating new objects for each new contact, even if there's no event listener attached.\n World_step_collideEvent.body = bj;\n World_step_collideEvent.contact = c;\n bi.dispatchEvent(World_step_collideEvent);\n World_step_collideEvent.body = bi;\n bj.dispatchEvent(World_step_collideEvent);\n }\n\n this.bodyOverlapKeeper.set(bi.id, bj.id);\n this.shapeOverlapKeeper.set(si.id, sj.id);\n }\n\n this.emitContactEvents();\n\n if (doProfiling) {\n profile.makeContactConstraints = performance.now() - profilingStart;\n profilingStart = performance.now();\n } // Wake up bodies\n\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n if (bi.wakeUpAfterNarrowphase) {\n bi.wakeUp();\n bi.wakeUpAfterNarrowphase = false;\n }\n } // Add user-added constraints\n\n\n Nconstraints = constraints.length;\n\n for (i = 0; i !== Nconstraints; i++) {\n const c = constraints[i];\n c.update();\n\n for (let j = 0, Neq = c.equations.length; j !== Neq; j++) {\n const eq = c.equations[j];\n solver.addEquation(eq);\n }\n } // Solve the constrained system\n\n\n solver.solve(dt, this);\n\n if (doProfiling) {\n profile.solve = performance.now() - profilingStart;\n } // Remove all contacts from solver\n\n\n solver.removeAllEquations(); // Apply damping, see http://code.google.com/p/bullet/issues/detail?id=74 for details\n\n const pow = Math.pow;\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n\n if (bi.type & DYNAMIC) {\n // Only for dynamic bodies\n const ld = pow(1.0 - bi.linearDamping, dt);\n const v = bi.velocity;\n v.scale(ld, v);\n const av = bi.angularVelocity;\n\n if (av) {\n const ad = pow(1.0 - bi.angularDamping, dt);\n av.scale(ad, av);\n }\n }\n }\n\n this.dispatchEvent(World_step_preStepEvent); // Leap frog\n // vnew = v + h*f/m\n // xnew = x + h*vnew\n\n if (doProfiling) {\n profilingStart = performance.now();\n }\n\n const stepnumber = this.stepnumber;\n const quatNormalize = stepnumber % (this.quatNormalizeSkip + 1) === 0;\n const quatNormalizeFast = this.quatNormalizeFast;\n\n for (i = 0; i !== N; i++) {\n bodies[i].integrate(dt, quatNormalize, quatNormalizeFast);\n }\n\n this.clearForces();\n this.broadphase.dirty = true;\n\n if (doProfiling) {\n profile.integrate = performance.now() - profilingStart;\n } // Update step number\n\n\n this.stepnumber += 1;\n this.dispatchEvent(World_step_postStepEvent); // Sleeping update\n\n let hasActiveBodies = true;\n\n if (this.allowSleep) {\n hasActiveBodies = false;\n\n for (i = 0; i !== N; i++) {\n const bi = bodies[i];\n bi.sleepTick(this.time);\n\n if (bi.sleepState !== Body.SLEEPING) {\n hasActiveBodies = true;\n }\n }\n }\n\n this.hasActiveBodies = hasActiveBodies;\n }\n\n emitContactEvents() {\n const hasBeginContact = this.hasAnyEventListener('beginContact');\n const hasEndContact = this.hasAnyEventListener('endContact');\n\n if (hasBeginContact || hasEndContact) {\n this.bodyOverlapKeeper.getDiff(additions, removals);\n }\n\n if (hasBeginContact) {\n for (let i = 0, l = additions.length; i < l; i += 2) {\n beginContactEvent.bodyA = this.getBodyById(additions[i]);\n beginContactEvent.bodyB = this.getBodyById(additions[i + 1]);\n this.dispatchEvent(beginContactEvent);\n }\n\n beginContactEvent.bodyA = beginContactEvent.bodyB = null;\n }\n\n if (hasEndContact) {\n for (let i = 0, l = removals.length; i < l; i += 2) {\n endContactEvent.bodyA = this.getBodyById(removals[i]);\n endContactEvent.bodyB = this.getBodyById(removals[i + 1]);\n this.dispatchEvent(endContactEvent);\n }\n\n endContactEvent.bodyA = endContactEvent.bodyB = null;\n }\n\n additions.length = removals.length = 0;\n const hasBeginShapeContact = this.hasAnyEventListener('beginShapeContact');\n const hasEndShapeContact = this.hasAnyEventListener('endShapeContact');\n\n if (hasBeginShapeContact || hasEndShapeContact) {\n this.shapeOverlapKeeper.getDiff(additions, removals);\n }\n\n if (hasBeginShapeContact) {\n for (let i = 0, l = additions.length; i < l; i += 2) {\n const shapeA = this.getShapeById(additions[i]);\n const shapeB = this.getShapeById(additions[i + 1]);\n beginShapeContactEvent.shapeA = shapeA;\n beginShapeContactEvent.shapeB = shapeB;\n if (shapeA) beginShapeContactEvent.bodyA = shapeA.body;\n if (shapeB) beginShapeContactEvent.bodyB = shapeB.body;\n this.dispatchEvent(beginShapeContactEvent);\n }\n\n beginShapeContactEvent.bodyA = beginShapeContactEvent.bodyB = beginShapeContactEvent.shapeA = beginShapeContactEvent.shapeB = null;\n }\n\n if (hasEndShapeContact) {\n for (let i = 0, l = removals.length; i < l; i += 2) {\n const shapeA = this.getShapeById(removals[i]);\n const shapeB = this.getShapeById(removals[i + 1]);\n endShapeContactEvent.shapeA = shapeA;\n endShapeContactEvent.shapeB = shapeB;\n if (shapeA) endShapeContactEvent.bodyA = shapeA.body;\n if (shapeB) endShapeContactEvent.bodyB = shapeB.body;\n this.dispatchEvent(endShapeContactEvent);\n }\n\n endShapeContactEvent.bodyA = endShapeContactEvent.bodyB = endShapeContactEvent.shapeA = endShapeContactEvent.shapeB = null;\n }\n }\n /**\n * Sets all body forces in the world to zero.\n */\n\n\n clearForces() {\n const bodies = this.bodies;\n const N = bodies.length;\n\n for (let i = 0; i !== N; i++) {\n const b = bodies[i];\n b.force;\n b.torque;\n b.force.set(0, 0, 0);\n b.torque.set(0, 0, 0);\n }\n }\n\n} // Temp stuff\n\nnew AABB();\nconst tmpRay = new Ray(); // performance.now() fallback on Date.now()\n\nconst performance = globalThis.performance || {};\n\nif (!performance.now) {\n let nowOffset = Date.now();\n\n if (performance.timing && performance.timing.navigationStart) {\n nowOffset = performance.timing.navigationStart;\n }\n\n performance.now = () => Date.now() - nowOffset;\n}\n\nnew Vec3(); // Dispatched after the world has stepped forward in time.\n// Reusable event objects to save memory.\n\nconst World_step_postStepEvent = {\n type: 'postStep'\n}; // Dispatched before the world steps forward in time.\n\nconst World_step_preStepEvent = {\n type: 'preStep'\n};\nconst World_step_collideEvent = {\n type: Body.COLLIDE_EVENT_NAME,\n body: null,\n contact: null\n}; // Pools for unused objects\n\nconst World_step_oldContacts = [];\nconst World_step_frictionEquationPool = []; // Reusable arrays for collision pairs\n\nconst World_step_p1 = [];\nconst World_step_p2 = []; // Stuff for emitContactEvents\n\nconst additions = [];\nconst removals = [];\nconst beginContactEvent = {\n type: 'beginContact',\n bodyA: null,\n bodyB: null\n};\nconst endContactEvent = {\n type: 'endContact',\n bodyA: null,\n bodyB: null\n};\nconst beginShapeContactEvent = {\n type: 'beginShapeContact',\n bodyA: null,\n bodyB: null,\n shapeA: null,\n shapeB: null\n};\nconst endShapeContactEvent = {\n type: 'endShapeContact',\n bodyA: null,\n bodyB: null,\n shapeA: null,\n shapeB: null\n};\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/cannon-es/dist/cannon-es.js?"); + +/***/ }), + +/***/ "./node_modules/perlin.js/perlin.js": +/*!******************************************!*\ + !*** ./node_modules/perlin.js/perlin.js ***! + \******************************************/ +/***/ (function(module, exports, __webpack_require__) { + +eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*\n * A speed-improved perlin and simplex noise algorithms for 2D.\n *\n * Based on example code by Stefan Gustavson (stegu@itn.liu.se).\n * Optimisations by Peter Eastman (peastman@drizzle.stanford.edu).\n * Better rank ordering method by Stefan Gustavson in 2012.\n * Converted to Javascript by Joseph Gentle.\n *\n * Version 2012-03-09\n *\n * This code was placed in the public domain by its original author,\n * Stefan Gustavson. You may use it as you see fit, but\n * attribution is appreciated.\n *\n * refactor to UMD by TyrealGray\n * 2016-09-28\n */\n\n(function (root, factory) {\n if (true) {\n // AMD\n !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :\n\t\t__WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else {}\n} (this, function () {\n var Perlin = {};\n\n function Grad(x, y, z) {\n this.x = x; this.y = y; this.z = z;\n }\n\n Grad.prototype.dot2 = function (x, y) {\n return this.x * x + this.y * y;\n };\n\n Grad.prototype.dot3 = function (x, y, z) {\n return this.x * x + this.y * y + this.z * z;\n };\n\n var grad3 = [new Grad(1, 1, 0), new Grad(-1, 1, 0), new Grad(1, -1, 0), new Grad(-1, -1, 0),\n new Grad(1, 0, 1), new Grad(-1, 0, 1), new Grad(1, 0, -1), new Grad(-1, 0, -1),\n new Grad(0, 1, 1), new Grad(0, -1, 1), new Grad(0, 1, -1), new Grad(0, -1, -1)];\n\n var p = [151, 160, 137, 91, 90, 15,\n 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, 23,\n 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33,\n 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166,\n 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244,\n 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196,\n 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123,\n 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42,\n 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9,\n 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228,\n 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, 14, 239, 107,\n 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254,\n 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180];\n // To remove the need for index wrapping, double the permutation table length\n var perm = new Array(512);\n var gradP = new Array(512);\n\n // This isn't a very good seeding function, but it works ok. It supports 2^16\n // different seed values. Write something better if you need more seeds.\n Perlin.seed = function (seed) {\n if (seed > 0 && seed < 1) {\n // Scale the seed out\n seed *= 65536;\n }\n\n seed = Math.floor(seed);\n if (seed < 256) {\n seed |= seed << 8;\n }\n\n for (var i = 0; i < 256; i++) {\n var v;\n if (i & 1) {\n v = p[i] ^ (seed & 255);\n } else {\n v = p[i] ^ ((seed >> 8) & 255);\n }\n\n perm[i] = perm[i + 256] = v;\n gradP[i] = gradP[i + 256] = grad3[v % 12];\n }\n };\n\n Perlin.seed(0);\n\n /*\n for(var i=0; i<256; i++) {\n perm[i] = perm[i + 256] = p[i];\n gradP[i] = gradP[i + 256] = grad3[perm[i] % 12];\n }*/\n\n // Skewing and unskewing factors for 2, 3, and 4 dimensions\n var F2 = 0.5 * (Math.sqrt(3) - 1);\n var G2 = (3 - Math.sqrt(3)) / 6;\n\n var F3 = 1 / 3;\n var G3 = 1 / 6;\n\n // 2D simplex noise\n Perlin.simplex2 = function (xin, yin) {\n var n0, n1, n2; // Noise contributions from the three corners\n // Skew the input space to determine which simplex cell we're in\n var s = (xin + yin) * F2; // Hairy factor for 2D\n var i = Math.floor(xin + s);\n var j = Math.floor(yin + s);\n var t = (i + j) * G2;\n var x0 = xin - i + t; // The x,y distances from the cell origin, unskewed.\n var y0 = yin - j + t;\n // For the 2D case, the simplex shape is an equilateral triangle.\n // Determine which simplex we are in.\n var i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords\n if (x0 > y0) { // lower triangle, XY order: (0,0)->(1,0)->(1,1)\n i1 = 1; j1 = 0;\n } else { // upper triangle, YX order: (0,0)->(0,1)->(1,1)\n i1 = 0; j1 = 1;\n }\n // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and\n // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where\n // c = (3-sqrt(3))/6\n var x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords\n var y1 = y0 - j1 + G2;\n var x2 = x0 - 1 + 2 * G2; // Offsets for last corner in (x,y) unskewed coords\n var y2 = y0 - 1 + 2 * G2;\n // Work out the hashed gradient indices of the three simplex corners\n i &= 255;\n j &= 255;\n var gi0 = gradP[i + perm[j]];\n var gi1 = gradP[i + i1 + perm[j + j1]];\n var gi2 = gradP[i + 1 + perm[j + 1]];\n // Calculate the contribution from the three corners\n var t0 = 0.5 - x0 * x0 - y0 * y0;\n if (t0 < 0) {\n n0 = 0;\n } else {\n t0 *= t0;\n n0 = t0 * t0 * gi0.dot2(x0, y0); // (x,y) of grad3 used for 2D gradient\n }\n var t1 = 0.5 - x1 * x1 - y1 * y1;\n if (t1 < 0) {\n n1 = 0;\n } else {\n t1 *= t1;\n n1 = t1 * t1 * gi1.dot2(x1, y1);\n }\n var t2 = 0.5 - x2 * x2 - y2 * y2;\n if (t2 < 0) {\n n2 = 0;\n } else {\n t2 *= t2;\n n2 = t2 * t2 * gi2.dot2(x2, y2);\n }\n // Add contributions from each corner to get the final noise value.\n // The result is scaled to return values in the interval [-1,1].\n return 70 * (n0 + n1 + n2);\n };\n\n // 3D simplex noise\n Perlin.simplex3 = function (xin, yin, zin) {\n var n0, n1, n2, n3; // Noise contributions from the four corners\n\n // Skew the input space to determine which simplex cell we're in\n var s = (xin + yin + zin) * F3; // Hairy factor for 2D\n var i = Math.floor(xin + s);\n var j = Math.floor(yin + s);\n var k = Math.floor(zin + s);\n\n var t = (i + j + k) * G3;\n var x0 = xin - i + t; // The x,y distances from the cell origin, unskewed.\n var y0 = yin - j + t;\n var z0 = zin - k + t;\n\n // For the 3D case, the simplex shape is a slightly irregular tetrahedron.\n // Determine which simplex we are in.\n var i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords\n var i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords\n if (x0 >= y0) {\n if (y0 >= z0) { i1 = 1; j1 = 0; k1 = 0; i2 = 1; j2 = 1; k2 = 0; }\n else if (x0 >= z0) { i1 = 1; j1 = 0; k1 = 0; i2 = 1; j2 = 0; k2 = 1; }\n else { i1 = 0; j1 = 0; k1 = 1; i2 = 1; j2 = 0; k2 = 1; }\n } else {\n if (y0 < z0) { i1 = 0; j1 = 0; k1 = 1; i2 = 0; j2 = 1; k2 = 1; }\n else if (x0 < z0) { i1 = 0; j1 = 1; k1 = 0; i2 = 0; j2 = 1; k2 = 1; }\n else { i1 = 0; j1 = 1; k1 = 0; i2 = 1; j2 = 1; k2 = 0; }\n }\n // A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in (x,y,z),\n // a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and\n // a step of (0,0,1) in (i,j,k) means a step of (-c,-c,1-c) in (x,y,z), where\n // c = 1/6.\n var x1 = x0 - i1 + G3; // Offsets for second corner\n var y1 = y0 - j1 + G3;\n var z1 = z0 - k1 + G3;\n\n var x2 = x0 - i2 + 2 * G3; // Offsets for third corner\n var y2 = y0 - j2 + 2 * G3;\n var z2 = z0 - k2 + 2 * G3;\n\n var x3 = x0 - 1 + 3 * G3; // Offsets for fourth corner\n var y3 = y0 - 1 + 3 * G3;\n var z3 = z0 - 1 + 3 * G3;\n\n // Work out the hashed gradient indices of the four simplex corners\n i &= 255;\n j &= 255;\n k &= 255;\n var gi0 = gradP[i + perm[j + perm[k]]];\n var gi1 = gradP[i + i1 + perm[j + j1 + perm[k + k1]]];\n var gi2 = gradP[i + i2 + perm[j + j2 + perm[k + k2]]];\n var gi3 = gradP[i + 1 + perm[j + 1 + perm[k + 1]]];\n\n // Calculate the contribution from the four corners\n var t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0;\n if (t0 < 0) {\n n0 = 0;\n } else {\n t0 *= t0;\n n0 = t0 * t0 * gi0.dot3(x0, y0, z0); // (x,y) of grad3 used for 2D gradient\n }\n var t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1;\n if (t1 < 0) {\n n1 = 0;\n } else {\n t1 *= t1;\n n1 = t1 * t1 * gi1.dot3(x1, y1, z1);\n }\n var t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2;\n if (t2 < 0) {\n n2 = 0;\n } else {\n t2 *= t2;\n n2 = t2 * t2 * gi2.dot3(x2, y2, z2);\n }\n var t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3;\n if (t3 < 0) {\n n3 = 0;\n } else {\n t3 *= t3;\n n3 = t3 * t3 * gi3.dot3(x3, y3, z3);\n }\n // Add contributions from each corner to get the final noise value.\n // The result is scaled to return values in the interval [-1,1].\n return 32 * (n0 + n1 + n2 + n3);\n\n };\n\n // ##### Perlin noise stuff\n\n function fade(t) {\n return t * t * t * (t * (t * 6 - 15) + 10);\n }\n\n function lerp(a, b, t) {\n return (1 - t) * a + t * b;\n }\n\n // 2D Perlin Noise\n Perlin.perlin2 = function (x, y) {\n // Find unit grid cell containing point\n var X = Math.floor(x), Y = Math.floor(y);\n // Get relative xy coordinates of point within that cell\n x = x - X; y = y - Y;\n // Wrap the integer cells at 255 (smaller integer period can be introduced here)\n X = X & 255; Y = Y & 255;\n\n // Calculate noise contributions from each of the four corners\n var n00 = gradP[X + perm[Y]].dot2(x, y);\n var n01 = gradP[X + perm[Y + 1]].dot2(x, y - 1);\n var n10 = gradP[X + 1 + perm[Y]].dot2(x - 1, y);\n var n11 = gradP[X + 1 + perm[Y + 1]].dot2(x - 1, y - 1);\n\n // Compute the fade curve value for x\n var u = fade(x);\n\n // Interpolate the four results\n return lerp(\n lerp(n00, n10, u),\n lerp(n01, n11, u),\n fade(y));\n };\n\n // 3D Perlin Noise\n Perlin.perlin3 = function (x, y, z) {\n // Find unit grid cell containing point\n var X = Math.floor(x), Y = Math.floor(y), Z = Math.floor(z);\n // Get relative xyz coordinates of point within that cell\n x = x - X; y = y - Y; z = z - Z;\n // Wrap the integer cells at 255 (smaller integer period can be introduced here)\n X = X & 255; Y = Y & 255; Z = Z & 255;\n\n // Calculate noise contributions from each of the eight corners\n var n000 = gradP[X + perm[Y + perm[Z]]].dot3(x, y, z);\n var n001 = gradP[X + perm[Y + perm[Z + 1]]].dot3(x, y, z - 1);\n var n010 = gradP[X + perm[Y + 1 + perm[Z]]].dot3(x, y - 1, z);\n var n011 = gradP[X + perm[Y + 1 + perm[Z + 1]]].dot3(x, y - 1, z - 1);\n var n100 = gradP[X + 1 + perm[Y + perm[Z]]].dot3(x - 1, y, z);\n var n101 = gradP[X + 1 + perm[Y + perm[Z + 1]]].dot3(x - 1, y, z - 1);\n var n110 = gradP[X + 1 + perm[Y + 1 + perm[Z]]].dot3(x - 1, y - 1, z);\n var n111 = gradP[X + 1 + perm[Y + 1 + perm[Z + 1]]].dot3(x - 1, y - 1, z - 1);\n\n // Compute the fade curve value for x, y, z\n var u = fade(x);\n var v = fade(y);\n var w = fade(z);\n\n // Interpolate\n return lerp(\n lerp(\n lerp(n000, n100, u),\n lerp(n001, n101, u), w),\n lerp(\n lerp(n010, n110, u),\n lerp(n011, n111, u), w),\n v);\n };\n\n return Perlin;\n\n}));\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/perlin.js/perlin.js?"); + +/***/ }), + +/***/ "./src/init.js": +/*!*********************!*\ + !*** ./src/init.js ***! + \*********************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _game_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./game.mjs */ \"./src/game.mjs\");\n/* harmony import */ var _asset_loading_asset_loader2d_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./asset_loading/asset_loader2d.mjs */ \"./src/asset_loading/asset_loader2d.mjs\");\n/* harmony import */ var _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./asset_loading/assets_3d.mjs */ \"./src/asset_loading/assets_3d.mjs\");\n/* harmony import */ var _asset_loading_asset_loader_sounds_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./asset_loading/asset_loader_sounds.mjs */ \"./src/asset_loading/asset_loader_sounds.mjs\");\n/* harmony import */ var _LevelEditor_ObjectAdd_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./LevelEditor/ObjectAdd.mjs */ \"./src/LevelEditor/ObjectAdd.mjs\");\n\n\n\n\n\n\ndocument.body.onload = () => {\n console.log(\"Front end scripts starting.\");\n\n // Init sound for game\n (0,_asset_loading_asset_loader_sounds_mjs__WEBPACK_IMPORTED_MODULE_4__.initSounds)();\n\n // 2d canvas image loading (from code.zip)\n (0,_asset_loading_asset_loader2d_mjs__WEBPACK_IMPORTED_MODULE_2__.initGlobalImages)();\n\n // 3d assets loading (materials)\n (0,_asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_3__.loadLiminalTextureLib)();\n \n // initGLobalSounds();\n\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.init();\n\n _game_mjs__WEBPACK_IMPORTED_MODULE_1__.game.init();\n\n (0,_LevelEditor_ObjectAdd_mjs__WEBPACK_IMPORTED_MODULE_5__.UIAddObj)();\n};\n\n//# sourceURL=webpack://gamedev-engine/./src/init.js?"); + +/***/ }), + +/***/ "./node_modules/three/build/three.module.js": +/*!**************************************************!*\ + !*** ./node_modules/three/build/three.module.js ***! + \**************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ACESFilmicToneMapping: () => (/* binding */ ACESFilmicToneMapping),\n/* harmony export */ AddEquation: () => (/* binding */ AddEquation),\n/* harmony export */ AddOperation: () => (/* binding */ AddOperation),\n/* harmony export */ AdditiveAnimationBlendMode: () => (/* binding */ AdditiveAnimationBlendMode),\n/* harmony export */ AdditiveBlending: () => (/* binding */ AdditiveBlending),\n/* harmony export */ AgXToneMapping: () => (/* binding */ AgXToneMapping),\n/* harmony export */ AlphaFormat: () => (/* binding */ AlphaFormat),\n/* harmony export */ AlwaysCompare: () => (/* binding */ AlwaysCompare),\n/* harmony export */ AlwaysDepth: () => (/* binding */ AlwaysDepth),\n/* harmony export */ AlwaysStencilFunc: () => (/* binding */ AlwaysStencilFunc),\n/* harmony export */ AmbientLight: () => (/* binding */ AmbientLight),\n/* harmony export */ AnimationAction: () => (/* binding */ AnimationAction),\n/* harmony export */ AnimationClip: () => (/* binding */ AnimationClip),\n/* harmony export */ AnimationLoader: () => (/* binding */ AnimationLoader),\n/* harmony export */ AnimationMixer: () => (/* binding */ AnimationMixer),\n/* harmony export */ AnimationObjectGroup: () => (/* binding */ AnimationObjectGroup),\n/* harmony export */ AnimationUtils: () => (/* binding */ AnimationUtils),\n/* harmony export */ ArcCurve: () => (/* binding */ ArcCurve),\n/* harmony export */ ArrayCamera: () => (/* binding */ ArrayCamera),\n/* harmony export */ ArrowHelper: () => (/* binding */ ArrowHelper),\n/* harmony export */ AttachedBindMode: () => (/* binding */ AttachedBindMode),\n/* harmony export */ Audio: () => (/* binding */ Audio),\n/* harmony export */ AudioAnalyser: () => (/* binding */ AudioAnalyser),\n/* harmony export */ AudioContext: () => (/* binding */ AudioContext),\n/* harmony export */ AudioListener: () => (/* binding */ AudioListener),\n/* harmony export */ AudioLoader: () => (/* binding */ AudioLoader),\n/* harmony export */ AxesHelper: () => (/* binding */ AxesHelper),\n/* harmony export */ BackSide: () => (/* binding */ BackSide),\n/* harmony export */ BasicDepthPacking: () => (/* binding */ BasicDepthPacking),\n/* harmony export */ BasicShadowMap: () => (/* binding */ BasicShadowMap),\n/* harmony export */ BatchedMesh: () => (/* binding */ BatchedMesh),\n/* harmony export */ Bone: () => (/* binding */ Bone),\n/* harmony export */ BooleanKeyframeTrack: () => (/* binding */ BooleanKeyframeTrack),\n/* harmony export */ Box2: () => (/* binding */ Box2),\n/* harmony export */ Box3: () => (/* binding */ Box3),\n/* harmony export */ Box3Helper: () => (/* binding */ Box3Helper),\n/* harmony export */ BoxGeometry: () => (/* binding */ BoxGeometry),\n/* harmony export */ BoxHelper: () => (/* binding */ BoxHelper),\n/* harmony export */ BufferAttribute: () => (/* binding */ BufferAttribute),\n/* harmony export */ BufferGeometry: () => (/* binding */ BufferGeometry),\n/* harmony export */ BufferGeometryLoader: () => (/* binding */ BufferGeometryLoader),\n/* harmony export */ ByteType: () => (/* binding */ ByteType),\n/* harmony export */ Cache: () => (/* binding */ Cache),\n/* harmony export */ Camera: () => (/* binding */ Camera),\n/* harmony export */ CameraHelper: () => (/* binding */ CameraHelper),\n/* harmony export */ CanvasTexture: () => (/* binding */ CanvasTexture),\n/* harmony export */ CapsuleGeometry: () => (/* binding */ CapsuleGeometry),\n/* harmony export */ CatmullRomCurve3: () => (/* binding */ CatmullRomCurve3),\n/* harmony export */ CineonToneMapping: () => (/* binding */ CineonToneMapping),\n/* harmony export */ CircleGeometry: () => (/* binding */ CircleGeometry),\n/* harmony export */ ClampToEdgeWrapping: () => (/* binding */ ClampToEdgeWrapping),\n/* harmony export */ Clock: () => (/* binding */ Clock),\n/* harmony export */ Color: () => (/* binding */ Color),\n/* harmony export */ ColorKeyframeTrack: () => (/* binding */ ColorKeyframeTrack),\n/* harmony export */ ColorManagement: () => (/* binding */ ColorManagement),\n/* harmony export */ CompressedArrayTexture: () => (/* binding */ CompressedArrayTexture),\n/* harmony export */ CompressedCubeTexture: () => (/* binding */ CompressedCubeTexture),\n/* harmony export */ CompressedTexture: () => (/* binding */ CompressedTexture),\n/* harmony export */ CompressedTextureLoader: () => (/* binding */ CompressedTextureLoader),\n/* harmony export */ ConeGeometry: () => (/* binding */ ConeGeometry),\n/* harmony export */ ConstantAlphaFactor: () => (/* binding */ ConstantAlphaFactor),\n/* harmony export */ ConstantColorFactor: () => (/* binding */ ConstantColorFactor),\n/* harmony export */ CubeCamera: () => (/* binding */ CubeCamera),\n/* harmony export */ CubeReflectionMapping: () => (/* binding */ CubeReflectionMapping),\n/* harmony export */ CubeRefractionMapping: () => (/* binding */ CubeRefractionMapping),\n/* harmony export */ CubeTexture: () => (/* binding */ CubeTexture),\n/* harmony export */ CubeTextureLoader: () => (/* binding */ CubeTextureLoader),\n/* harmony export */ CubeUVReflectionMapping: () => (/* binding */ CubeUVReflectionMapping),\n/* harmony export */ CubicBezierCurve: () => (/* binding */ CubicBezierCurve),\n/* harmony export */ CubicBezierCurve3: () => (/* binding */ CubicBezierCurve3),\n/* harmony export */ CubicInterpolant: () => (/* binding */ CubicInterpolant),\n/* harmony export */ CullFaceBack: () => (/* binding */ CullFaceBack),\n/* harmony export */ CullFaceFront: () => (/* binding */ CullFaceFront),\n/* harmony export */ CullFaceFrontBack: () => (/* binding */ CullFaceFrontBack),\n/* harmony export */ CullFaceNone: () => (/* binding */ CullFaceNone),\n/* harmony export */ Curve: () => (/* binding */ Curve),\n/* harmony export */ CurvePath: () => (/* binding */ CurvePath),\n/* harmony export */ CustomBlending: () => (/* binding */ CustomBlending),\n/* harmony export */ CustomToneMapping: () => (/* binding */ CustomToneMapping),\n/* harmony export */ CylinderGeometry: () => (/* binding */ CylinderGeometry),\n/* harmony export */ Cylindrical: () => (/* binding */ Cylindrical),\n/* harmony export */ Data3DTexture: () => (/* binding */ Data3DTexture),\n/* harmony export */ DataArrayTexture: () => (/* binding */ DataArrayTexture),\n/* harmony export */ DataTexture: () => (/* binding */ DataTexture),\n/* harmony export */ DataTextureLoader: () => (/* binding */ DataTextureLoader),\n/* harmony export */ DataUtils: () => (/* binding */ DataUtils),\n/* harmony export */ DecrementStencilOp: () => (/* binding */ DecrementStencilOp),\n/* harmony export */ DecrementWrapStencilOp: () => (/* binding */ DecrementWrapStencilOp),\n/* harmony export */ DefaultLoadingManager: () => (/* binding */ DefaultLoadingManager),\n/* harmony export */ DepthFormat: () => (/* binding */ DepthFormat),\n/* harmony export */ DepthStencilFormat: () => (/* binding */ DepthStencilFormat),\n/* harmony export */ DepthTexture: () => (/* binding */ DepthTexture),\n/* harmony export */ DetachedBindMode: () => (/* binding */ DetachedBindMode),\n/* harmony export */ DirectionalLight: () => (/* binding */ DirectionalLight),\n/* harmony export */ DirectionalLightHelper: () => (/* binding */ DirectionalLightHelper),\n/* harmony export */ DiscreteInterpolant: () => (/* binding */ DiscreteInterpolant),\n/* harmony export */ DisplayP3ColorSpace: () => (/* binding */ DisplayP3ColorSpace),\n/* harmony export */ DodecahedronGeometry: () => (/* binding */ DodecahedronGeometry),\n/* harmony export */ DoubleSide: () => (/* binding */ DoubleSide),\n/* harmony export */ DstAlphaFactor: () => (/* binding */ DstAlphaFactor),\n/* harmony export */ DstColorFactor: () => (/* binding */ DstColorFactor),\n/* harmony export */ DynamicCopyUsage: () => (/* binding */ DynamicCopyUsage),\n/* harmony export */ DynamicDrawUsage: () => (/* binding */ DynamicDrawUsage),\n/* harmony export */ DynamicReadUsage: () => (/* binding */ DynamicReadUsage),\n/* harmony export */ EdgesGeometry: () => (/* binding */ EdgesGeometry),\n/* harmony export */ EllipseCurve: () => (/* binding */ EllipseCurve),\n/* harmony export */ EqualCompare: () => (/* binding */ EqualCompare),\n/* harmony export */ EqualDepth: () => (/* binding */ EqualDepth),\n/* harmony export */ EqualStencilFunc: () => (/* binding */ EqualStencilFunc),\n/* harmony export */ EquirectangularReflectionMapping: () => (/* binding */ EquirectangularReflectionMapping),\n/* harmony export */ EquirectangularRefractionMapping: () => (/* binding */ EquirectangularRefractionMapping),\n/* harmony export */ Euler: () => (/* binding */ Euler),\n/* harmony export */ EventDispatcher: () => (/* binding */ EventDispatcher),\n/* harmony export */ ExtrudeGeometry: () => (/* binding */ ExtrudeGeometry),\n/* harmony export */ FileLoader: () => (/* binding */ FileLoader),\n/* harmony export */ Float16BufferAttribute: () => (/* binding */ Float16BufferAttribute),\n/* harmony export */ Float32BufferAttribute: () => (/* binding */ Float32BufferAttribute),\n/* harmony export */ FloatType: () => (/* binding */ FloatType),\n/* harmony export */ Fog: () => (/* binding */ Fog),\n/* harmony export */ FogExp2: () => (/* binding */ FogExp2),\n/* harmony export */ FramebufferTexture: () => (/* binding */ FramebufferTexture),\n/* harmony export */ FrontSide: () => (/* binding */ FrontSide),\n/* harmony export */ Frustum: () => (/* binding */ Frustum),\n/* harmony export */ GLBufferAttribute: () => (/* binding */ GLBufferAttribute),\n/* harmony export */ GLSL1: () => (/* binding */ GLSL1),\n/* harmony export */ GLSL3: () => (/* binding */ GLSL3),\n/* harmony export */ GreaterCompare: () => (/* binding */ GreaterCompare),\n/* harmony export */ GreaterDepth: () => (/* binding */ GreaterDepth),\n/* harmony export */ GreaterEqualCompare: () => (/* binding */ GreaterEqualCompare),\n/* harmony export */ GreaterEqualDepth: () => (/* binding */ GreaterEqualDepth),\n/* harmony export */ GreaterEqualStencilFunc: () => (/* binding */ GreaterEqualStencilFunc),\n/* harmony export */ GreaterStencilFunc: () => (/* binding */ GreaterStencilFunc),\n/* harmony export */ GridHelper: () => (/* binding */ GridHelper),\n/* harmony export */ Group: () => (/* binding */ Group),\n/* harmony export */ HalfFloatType: () => (/* binding */ HalfFloatType),\n/* harmony export */ HemisphereLight: () => (/* binding */ HemisphereLight),\n/* harmony export */ HemisphereLightHelper: () => (/* binding */ HemisphereLightHelper),\n/* harmony export */ IcosahedronGeometry: () => (/* binding */ IcosahedronGeometry),\n/* harmony export */ ImageBitmapLoader: () => (/* binding */ ImageBitmapLoader),\n/* harmony export */ ImageLoader: () => (/* binding */ ImageLoader),\n/* harmony export */ ImageUtils: () => (/* binding */ ImageUtils),\n/* harmony export */ IncrementStencilOp: () => (/* binding */ IncrementStencilOp),\n/* harmony export */ IncrementWrapStencilOp: () => (/* binding */ IncrementWrapStencilOp),\n/* harmony export */ InstancedBufferAttribute: () => (/* binding */ InstancedBufferAttribute),\n/* harmony export */ InstancedBufferGeometry: () => (/* binding */ InstancedBufferGeometry),\n/* harmony export */ InstancedInterleavedBuffer: () => (/* binding */ InstancedInterleavedBuffer),\n/* harmony export */ InstancedMesh: () => (/* binding */ InstancedMesh),\n/* harmony export */ Int16BufferAttribute: () => (/* binding */ Int16BufferAttribute),\n/* harmony export */ Int32BufferAttribute: () => (/* binding */ Int32BufferAttribute),\n/* harmony export */ Int8BufferAttribute: () => (/* binding */ Int8BufferAttribute),\n/* harmony export */ IntType: () => (/* binding */ IntType),\n/* harmony export */ InterleavedBuffer: () => (/* binding */ InterleavedBuffer),\n/* harmony export */ InterleavedBufferAttribute: () => (/* binding */ InterleavedBufferAttribute),\n/* harmony export */ Interpolant: () => (/* binding */ Interpolant),\n/* harmony export */ InterpolateDiscrete: () => (/* binding */ InterpolateDiscrete),\n/* harmony export */ InterpolateLinear: () => (/* binding */ InterpolateLinear),\n/* harmony export */ InterpolateSmooth: () => (/* binding */ InterpolateSmooth),\n/* harmony export */ InvertStencilOp: () => (/* binding */ InvertStencilOp),\n/* harmony export */ KeepStencilOp: () => (/* binding */ KeepStencilOp),\n/* harmony export */ KeyframeTrack: () => (/* binding */ KeyframeTrack),\n/* harmony export */ LOD: () => (/* binding */ LOD),\n/* harmony export */ LatheGeometry: () => (/* binding */ LatheGeometry),\n/* harmony export */ Layers: () => (/* binding */ Layers),\n/* harmony export */ LessCompare: () => (/* binding */ LessCompare),\n/* harmony export */ LessDepth: () => (/* binding */ LessDepth),\n/* harmony export */ LessEqualCompare: () => (/* binding */ LessEqualCompare),\n/* harmony export */ LessEqualDepth: () => (/* binding */ LessEqualDepth),\n/* harmony export */ LessEqualStencilFunc: () => (/* binding */ LessEqualStencilFunc),\n/* harmony export */ LessStencilFunc: () => (/* binding */ LessStencilFunc),\n/* harmony export */ Light: () => (/* binding */ Light),\n/* harmony export */ LightProbe: () => (/* binding */ LightProbe),\n/* harmony export */ Line: () => (/* binding */ Line),\n/* harmony export */ Line3: () => (/* binding */ Line3),\n/* harmony export */ LineBasicMaterial: () => (/* binding */ LineBasicMaterial),\n/* harmony export */ LineCurve: () => (/* binding */ LineCurve),\n/* harmony export */ LineCurve3: () => (/* binding */ LineCurve3),\n/* harmony export */ LineDashedMaterial: () => (/* binding */ LineDashedMaterial),\n/* harmony export */ LineLoop: () => (/* binding */ LineLoop),\n/* harmony export */ LineSegments: () => (/* binding */ LineSegments),\n/* harmony export */ LinearDisplayP3ColorSpace: () => (/* binding */ LinearDisplayP3ColorSpace),\n/* harmony export */ LinearFilter: () => (/* binding */ LinearFilter),\n/* harmony export */ LinearInterpolant: () => (/* binding */ LinearInterpolant),\n/* harmony export */ LinearMipMapLinearFilter: () => (/* binding */ LinearMipMapLinearFilter),\n/* harmony export */ LinearMipMapNearestFilter: () => (/* binding */ LinearMipMapNearestFilter),\n/* harmony export */ LinearMipmapLinearFilter: () => (/* binding */ LinearMipmapLinearFilter),\n/* harmony export */ LinearMipmapNearestFilter: () => (/* binding */ LinearMipmapNearestFilter),\n/* harmony export */ LinearSRGBColorSpace: () => (/* binding */ LinearSRGBColorSpace),\n/* harmony export */ LinearToneMapping: () => (/* binding */ LinearToneMapping),\n/* harmony export */ LinearTransfer: () => (/* binding */ LinearTransfer),\n/* harmony export */ Loader: () => (/* binding */ Loader),\n/* harmony export */ LoaderUtils: () => (/* binding */ LoaderUtils),\n/* harmony export */ LoadingManager: () => (/* binding */ LoadingManager),\n/* harmony export */ LoopOnce: () => (/* binding */ LoopOnce),\n/* harmony export */ LoopPingPong: () => (/* binding */ LoopPingPong),\n/* harmony export */ LoopRepeat: () => (/* binding */ LoopRepeat),\n/* harmony export */ LuminanceAlphaFormat: () => (/* binding */ LuminanceAlphaFormat),\n/* harmony export */ LuminanceFormat: () => (/* binding */ LuminanceFormat),\n/* harmony export */ MOUSE: () => (/* binding */ MOUSE),\n/* harmony export */ Material: () => (/* binding */ Material),\n/* harmony export */ MaterialLoader: () => (/* binding */ MaterialLoader),\n/* harmony export */ MathUtils: () => (/* binding */ MathUtils),\n/* harmony export */ Matrix3: () => (/* binding */ Matrix3),\n/* harmony export */ Matrix4: () => (/* binding */ Matrix4),\n/* harmony export */ MaxEquation: () => (/* binding */ MaxEquation),\n/* harmony export */ Mesh: () => (/* binding */ Mesh),\n/* harmony export */ MeshBasicMaterial: () => (/* binding */ MeshBasicMaterial),\n/* harmony export */ MeshDepthMaterial: () => (/* binding */ MeshDepthMaterial),\n/* harmony export */ MeshDistanceMaterial: () => (/* binding */ MeshDistanceMaterial),\n/* harmony export */ MeshLambertMaterial: () => (/* binding */ MeshLambertMaterial),\n/* harmony export */ MeshMatcapMaterial: () => (/* binding */ MeshMatcapMaterial),\n/* harmony export */ MeshNormalMaterial: () => (/* binding */ MeshNormalMaterial),\n/* harmony export */ MeshPhongMaterial: () => (/* binding */ MeshPhongMaterial),\n/* harmony export */ MeshPhysicalMaterial: () => (/* binding */ MeshPhysicalMaterial),\n/* harmony export */ MeshStandardMaterial: () => (/* binding */ MeshStandardMaterial),\n/* harmony export */ MeshToonMaterial: () => (/* binding */ MeshToonMaterial),\n/* harmony export */ MinEquation: () => (/* binding */ MinEquation),\n/* harmony export */ MirroredRepeatWrapping: () => (/* binding */ MirroredRepeatWrapping),\n/* harmony export */ MixOperation: () => (/* binding */ MixOperation),\n/* harmony export */ MultiplyBlending: () => (/* binding */ MultiplyBlending),\n/* harmony export */ MultiplyOperation: () => (/* binding */ MultiplyOperation),\n/* harmony export */ NearestFilter: () => (/* binding */ NearestFilter),\n/* harmony export */ NearestMipMapLinearFilter: () => (/* binding */ NearestMipMapLinearFilter),\n/* harmony export */ NearestMipMapNearestFilter: () => (/* binding */ NearestMipMapNearestFilter),\n/* harmony export */ NearestMipmapLinearFilter: () => (/* binding */ NearestMipmapLinearFilter),\n/* harmony export */ NearestMipmapNearestFilter: () => (/* binding */ NearestMipmapNearestFilter),\n/* harmony export */ NeutralToneMapping: () => (/* binding */ NeutralToneMapping),\n/* harmony export */ NeverCompare: () => (/* binding */ NeverCompare),\n/* harmony export */ NeverDepth: () => (/* binding */ NeverDepth),\n/* harmony export */ NeverStencilFunc: () => (/* binding */ NeverStencilFunc),\n/* harmony export */ NoBlending: () => (/* binding */ NoBlending),\n/* harmony export */ NoColorSpace: () => (/* binding */ NoColorSpace),\n/* harmony export */ NoToneMapping: () => (/* binding */ NoToneMapping),\n/* harmony export */ NormalAnimationBlendMode: () => (/* binding */ NormalAnimationBlendMode),\n/* harmony export */ NormalBlending: () => (/* binding */ NormalBlending),\n/* harmony export */ NotEqualCompare: () => (/* binding */ NotEqualCompare),\n/* harmony export */ NotEqualDepth: () => (/* binding */ NotEqualDepth),\n/* harmony export */ NotEqualStencilFunc: () => (/* binding */ NotEqualStencilFunc),\n/* harmony export */ NumberKeyframeTrack: () => (/* binding */ NumberKeyframeTrack),\n/* harmony export */ Object3D: () => (/* binding */ Object3D),\n/* harmony export */ ObjectLoader: () => (/* binding */ ObjectLoader),\n/* harmony export */ ObjectSpaceNormalMap: () => (/* binding */ ObjectSpaceNormalMap),\n/* harmony export */ OctahedronGeometry: () => (/* binding */ OctahedronGeometry),\n/* harmony export */ OneFactor: () => (/* binding */ OneFactor),\n/* harmony export */ OneMinusConstantAlphaFactor: () => (/* binding */ OneMinusConstantAlphaFactor),\n/* harmony export */ OneMinusConstantColorFactor: () => (/* binding */ OneMinusConstantColorFactor),\n/* harmony export */ OneMinusDstAlphaFactor: () => (/* binding */ OneMinusDstAlphaFactor),\n/* harmony export */ OneMinusDstColorFactor: () => (/* binding */ OneMinusDstColorFactor),\n/* harmony export */ OneMinusSrcAlphaFactor: () => (/* binding */ OneMinusSrcAlphaFactor),\n/* harmony export */ OneMinusSrcColorFactor: () => (/* binding */ OneMinusSrcColorFactor),\n/* harmony export */ OrthographicCamera: () => (/* binding */ OrthographicCamera),\n/* harmony export */ P3Primaries: () => (/* binding */ P3Primaries),\n/* harmony export */ PCFShadowMap: () => (/* binding */ PCFShadowMap),\n/* harmony export */ PCFSoftShadowMap: () => (/* binding */ PCFSoftShadowMap),\n/* harmony export */ PMREMGenerator: () => (/* binding */ PMREMGenerator),\n/* harmony export */ Path: () => (/* binding */ Path),\n/* harmony export */ PerspectiveCamera: () => (/* binding */ PerspectiveCamera),\n/* harmony export */ Plane: () => (/* binding */ Plane),\n/* harmony export */ PlaneGeometry: () => (/* binding */ PlaneGeometry),\n/* harmony export */ PlaneHelper: () => (/* binding */ PlaneHelper),\n/* harmony export */ PointLight: () => (/* binding */ PointLight),\n/* harmony export */ PointLightHelper: () => (/* binding */ PointLightHelper),\n/* harmony export */ Points: () => (/* binding */ Points),\n/* harmony export */ PointsMaterial: () => (/* binding */ PointsMaterial),\n/* harmony export */ PolarGridHelper: () => (/* binding */ PolarGridHelper),\n/* harmony export */ PolyhedronGeometry: () => (/* binding */ PolyhedronGeometry),\n/* harmony export */ PositionalAudio: () => (/* binding */ PositionalAudio),\n/* harmony export */ PropertyBinding: () => (/* binding */ PropertyBinding),\n/* harmony export */ PropertyMixer: () => (/* binding */ PropertyMixer),\n/* harmony export */ QuadraticBezierCurve: () => (/* binding */ QuadraticBezierCurve),\n/* harmony export */ QuadraticBezierCurve3: () => (/* binding */ QuadraticBezierCurve3),\n/* harmony export */ Quaternion: () => (/* binding */ Quaternion),\n/* harmony export */ QuaternionKeyframeTrack: () => (/* binding */ QuaternionKeyframeTrack),\n/* harmony export */ QuaternionLinearInterpolant: () => (/* binding */ QuaternionLinearInterpolant),\n/* harmony export */ RED_GREEN_RGTC2_Format: () => (/* binding */ RED_GREEN_RGTC2_Format),\n/* harmony export */ RED_RGTC1_Format: () => (/* binding */ RED_RGTC1_Format),\n/* harmony export */ REVISION: () => (/* binding */ REVISION),\n/* harmony export */ RGBADepthPacking: () => (/* binding */ RGBADepthPacking),\n/* harmony export */ RGBAFormat: () => (/* binding */ RGBAFormat),\n/* harmony export */ RGBAIntegerFormat: () => (/* binding */ RGBAIntegerFormat),\n/* harmony export */ RGBA_ASTC_10x10_Format: () => (/* binding */ RGBA_ASTC_10x10_Format),\n/* harmony export */ RGBA_ASTC_10x5_Format: () => (/* binding */ RGBA_ASTC_10x5_Format),\n/* harmony export */ RGBA_ASTC_10x6_Format: () => (/* binding */ RGBA_ASTC_10x6_Format),\n/* harmony export */ RGBA_ASTC_10x8_Format: () => (/* binding */ RGBA_ASTC_10x8_Format),\n/* harmony export */ RGBA_ASTC_12x10_Format: () => (/* binding */ RGBA_ASTC_12x10_Format),\n/* harmony export */ RGBA_ASTC_12x12_Format: () => (/* binding */ RGBA_ASTC_12x12_Format),\n/* harmony export */ RGBA_ASTC_4x4_Format: () => (/* binding */ RGBA_ASTC_4x4_Format),\n/* harmony export */ RGBA_ASTC_5x4_Format: () => (/* binding */ RGBA_ASTC_5x4_Format),\n/* harmony export */ RGBA_ASTC_5x5_Format: () => (/* binding */ RGBA_ASTC_5x5_Format),\n/* harmony export */ RGBA_ASTC_6x5_Format: () => (/* binding */ RGBA_ASTC_6x5_Format),\n/* harmony export */ RGBA_ASTC_6x6_Format: () => (/* binding */ RGBA_ASTC_6x6_Format),\n/* harmony export */ RGBA_ASTC_8x5_Format: () => (/* binding */ RGBA_ASTC_8x5_Format),\n/* harmony export */ RGBA_ASTC_8x6_Format: () => (/* binding */ RGBA_ASTC_8x6_Format),\n/* harmony export */ RGBA_ASTC_8x8_Format: () => (/* binding */ RGBA_ASTC_8x8_Format),\n/* harmony export */ RGBA_BPTC_Format: () => (/* binding */ RGBA_BPTC_Format),\n/* harmony export */ RGBA_ETC2_EAC_Format: () => (/* binding */ RGBA_ETC2_EAC_Format),\n/* harmony export */ RGBA_PVRTC_2BPPV1_Format: () => (/* binding */ RGBA_PVRTC_2BPPV1_Format),\n/* harmony export */ RGBA_PVRTC_4BPPV1_Format: () => (/* binding */ RGBA_PVRTC_4BPPV1_Format),\n/* harmony export */ RGBA_S3TC_DXT1_Format: () => (/* binding */ RGBA_S3TC_DXT1_Format),\n/* harmony export */ RGBA_S3TC_DXT3_Format: () => (/* binding */ RGBA_S3TC_DXT3_Format),\n/* harmony export */ RGBA_S3TC_DXT5_Format: () => (/* binding */ RGBA_S3TC_DXT5_Format),\n/* harmony export */ RGBFormat: () => (/* binding */ RGBFormat),\n/* harmony export */ RGB_BPTC_SIGNED_Format: () => (/* binding */ RGB_BPTC_SIGNED_Format),\n/* harmony export */ RGB_BPTC_UNSIGNED_Format: () => (/* binding */ RGB_BPTC_UNSIGNED_Format),\n/* harmony export */ RGB_ETC1_Format: () => (/* binding */ RGB_ETC1_Format),\n/* harmony export */ RGB_ETC2_Format: () => (/* binding */ RGB_ETC2_Format),\n/* harmony export */ RGB_PVRTC_2BPPV1_Format: () => (/* binding */ RGB_PVRTC_2BPPV1_Format),\n/* harmony export */ RGB_PVRTC_4BPPV1_Format: () => (/* binding */ RGB_PVRTC_4BPPV1_Format),\n/* harmony export */ RGB_S3TC_DXT1_Format: () => (/* binding */ RGB_S3TC_DXT1_Format),\n/* harmony export */ RGFormat: () => (/* binding */ RGFormat),\n/* harmony export */ RGIntegerFormat: () => (/* binding */ RGIntegerFormat),\n/* harmony export */ RawShaderMaterial: () => (/* binding */ RawShaderMaterial),\n/* harmony export */ Ray: () => (/* binding */ Ray),\n/* harmony export */ Raycaster: () => (/* binding */ Raycaster),\n/* harmony export */ Rec709Primaries: () => (/* binding */ Rec709Primaries),\n/* harmony export */ RectAreaLight: () => (/* binding */ RectAreaLight),\n/* harmony export */ RedFormat: () => (/* binding */ RedFormat),\n/* harmony export */ RedIntegerFormat: () => (/* binding */ RedIntegerFormat),\n/* harmony export */ ReinhardToneMapping: () => (/* binding */ ReinhardToneMapping),\n/* harmony export */ RenderTarget: () => (/* binding */ RenderTarget),\n/* harmony export */ RepeatWrapping: () => (/* binding */ RepeatWrapping),\n/* harmony export */ ReplaceStencilOp: () => (/* binding */ ReplaceStencilOp),\n/* harmony export */ ReverseSubtractEquation: () => (/* binding */ ReverseSubtractEquation),\n/* harmony export */ RingGeometry: () => (/* binding */ RingGeometry),\n/* harmony export */ SIGNED_RED_GREEN_RGTC2_Format: () => (/* binding */ SIGNED_RED_GREEN_RGTC2_Format),\n/* harmony export */ SIGNED_RED_RGTC1_Format: () => (/* binding */ SIGNED_RED_RGTC1_Format),\n/* harmony export */ SRGBColorSpace: () => (/* binding */ SRGBColorSpace),\n/* harmony export */ SRGBTransfer: () => (/* binding */ SRGBTransfer),\n/* harmony export */ Scene: () => (/* binding */ Scene),\n/* harmony export */ ShaderChunk: () => (/* binding */ ShaderChunk),\n/* harmony export */ ShaderLib: () => (/* binding */ ShaderLib),\n/* harmony export */ ShaderMaterial: () => (/* binding */ ShaderMaterial),\n/* harmony export */ ShadowMaterial: () => (/* binding */ ShadowMaterial),\n/* harmony export */ Shape: () => (/* binding */ Shape),\n/* harmony export */ ShapeGeometry: () => (/* binding */ ShapeGeometry),\n/* harmony export */ ShapePath: () => (/* binding */ ShapePath),\n/* harmony export */ ShapeUtils: () => (/* binding */ ShapeUtils),\n/* harmony export */ ShortType: () => (/* binding */ ShortType),\n/* harmony export */ Skeleton: () => (/* binding */ Skeleton),\n/* harmony export */ SkeletonHelper: () => (/* binding */ SkeletonHelper),\n/* harmony export */ SkinnedMesh: () => (/* binding */ SkinnedMesh),\n/* harmony export */ Source: () => (/* binding */ Source),\n/* harmony export */ Sphere: () => (/* binding */ Sphere),\n/* harmony export */ SphereGeometry: () => (/* binding */ SphereGeometry),\n/* harmony export */ Spherical: () => (/* binding */ Spherical),\n/* harmony export */ SphericalHarmonics3: () => (/* binding */ SphericalHarmonics3),\n/* harmony export */ SplineCurve: () => (/* binding */ SplineCurve),\n/* harmony export */ SpotLight: () => (/* binding */ SpotLight),\n/* harmony export */ SpotLightHelper: () => (/* binding */ SpotLightHelper),\n/* harmony export */ Sprite: () => (/* binding */ Sprite),\n/* harmony export */ SpriteMaterial: () => (/* binding */ SpriteMaterial),\n/* harmony export */ SrcAlphaFactor: () => (/* binding */ SrcAlphaFactor),\n/* harmony export */ SrcAlphaSaturateFactor: () => (/* binding */ SrcAlphaSaturateFactor),\n/* harmony export */ SrcColorFactor: () => (/* binding */ SrcColorFactor),\n/* harmony export */ StaticCopyUsage: () => (/* binding */ StaticCopyUsage),\n/* harmony export */ StaticDrawUsage: () => (/* binding */ StaticDrawUsage),\n/* harmony export */ StaticReadUsage: () => (/* binding */ StaticReadUsage),\n/* harmony export */ StereoCamera: () => (/* binding */ StereoCamera),\n/* harmony export */ StreamCopyUsage: () => (/* binding */ StreamCopyUsage),\n/* harmony export */ StreamDrawUsage: () => (/* binding */ StreamDrawUsage),\n/* harmony export */ StreamReadUsage: () => (/* binding */ StreamReadUsage),\n/* harmony export */ StringKeyframeTrack: () => (/* binding */ StringKeyframeTrack),\n/* harmony export */ SubtractEquation: () => (/* binding */ SubtractEquation),\n/* harmony export */ SubtractiveBlending: () => (/* binding */ SubtractiveBlending),\n/* harmony export */ TOUCH: () => (/* binding */ TOUCH),\n/* harmony export */ TangentSpaceNormalMap: () => (/* binding */ TangentSpaceNormalMap),\n/* harmony export */ TetrahedronGeometry: () => (/* binding */ TetrahedronGeometry),\n/* harmony export */ Texture: () => (/* binding */ Texture),\n/* harmony export */ TextureLoader: () => (/* binding */ TextureLoader),\n/* harmony export */ TorusGeometry: () => (/* binding */ TorusGeometry),\n/* harmony export */ TorusKnotGeometry: () => (/* binding */ TorusKnotGeometry),\n/* harmony export */ Triangle: () => (/* binding */ Triangle),\n/* harmony export */ TriangleFanDrawMode: () => (/* binding */ TriangleFanDrawMode),\n/* harmony export */ TriangleStripDrawMode: () => (/* binding */ TriangleStripDrawMode),\n/* harmony export */ TrianglesDrawMode: () => (/* binding */ TrianglesDrawMode),\n/* harmony export */ TubeGeometry: () => (/* binding */ TubeGeometry),\n/* harmony export */ UVMapping: () => (/* binding */ UVMapping),\n/* harmony export */ Uint16BufferAttribute: () => (/* binding */ Uint16BufferAttribute),\n/* harmony export */ Uint32BufferAttribute: () => (/* binding */ Uint32BufferAttribute),\n/* harmony export */ Uint8BufferAttribute: () => (/* binding */ Uint8BufferAttribute),\n/* harmony export */ Uint8ClampedBufferAttribute: () => (/* binding */ Uint8ClampedBufferAttribute),\n/* harmony export */ Uniform: () => (/* binding */ Uniform),\n/* harmony export */ UniformsGroup: () => (/* binding */ UniformsGroup),\n/* harmony export */ UniformsLib: () => (/* binding */ UniformsLib),\n/* harmony export */ UniformsUtils: () => (/* binding */ UniformsUtils),\n/* harmony export */ UnsignedByteType: () => (/* binding */ UnsignedByteType),\n/* harmony export */ UnsignedInt248Type: () => (/* binding */ UnsignedInt248Type),\n/* harmony export */ UnsignedInt5999Type: () => (/* binding */ UnsignedInt5999Type),\n/* harmony export */ UnsignedIntType: () => (/* binding */ UnsignedIntType),\n/* harmony export */ UnsignedShort4444Type: () => (/* binding */ UnsignedShort4444Type),\n/* harmony export */ UnsignedShort5551Type: () => (/* binding */ UnsignedShort5551Type),\n/* harmony export */ UnsignedShortType: () => (/* binding */ UnsignedShortType),\n/* harmony export */ VSMShadowMap: () => (/* binding */ VSMShadowMap),\n/* harmony export */ Vector2: () => (/* binding */ Vector2),\n/* harmony export */ Vector3: () => (/* binding */ Vector3),\n/* harmony export */ Vector4: () => (/* binding */ Vector4),\n/* harmony export */ VectorKeyframeTrack: () => (/* binding */ VectorKeyframeTrack),\n/* harmony export */ VideoTexture: () => (/* binding */ VideoTexture),\n/* harmony export */ WebGL3DRenderTarget: () => (/* binding */ WebGL3DRenderTarget),\n/* harmony export */ WebGLArrayRenderTarget: () => (/* binding */ WebGLArrayRenderTarget),\n/* harmony export */ WebGLCoordinateSystem: () => (/* binding */ WebGLCoordinateSystem),\n/* harmony export */ WebGLCubeRenderTarget: () => (/* binding */ WebGLCubeRenderTarget),\n/* harmony export */ WebGLMultipleRenderTargets: () => (/* binding */ WebGLMultipleRenderTargets),\n/* harmony export */ WebGLRenderTarget: () => (/* binding */ WebGLRenderTarget),\n/* harmony export */ WebGLRenderer: () => (/* binding */ WebGLRenderer),\n/* harmony export */ WebGLUtils: () => (/* binding */ WebGLUtils),\n/* harmony export */ WebGPUCoordinateSystem: () => (/* binding */ WebGPUCoordinateSystem),\n/* harmony export */ WireframeGeometry: () => (/* binding */ WireframeGeometry),\n/* harmony export */ WrapAroundEnding: () => (/* binding */ WrapAroundEnding),\n/* harmony export */ ZeroCurvatureEnding: () => (/* binding */ ZeroCurvatureEnding),\n/* harmony export */ ZeroFactor: () => (/* binding */ ZeroFactor),\n/* harmony export */ ZeroSlopeEnding: () => (/* binding */ ZeroSlopeEnding),\n/* harmony export */ ZeroStencilOp: () => (/* binding */ ZeroStencilOp),\n/* harmony export */ createCanvasElement: () => (/* binding */ createCanvasElement)\n/* harmony export */ });\n/**\n * @license\n * Copyright 2010-2023 Three.js Authors\n * SPDX-License-Identifier: MIT\n */\nconst REVISION = '163';\n\nconst MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };\nconst TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };\nconst CullFaceNone = 0;\nconst CullFaceBack = 1;\nconst CullFaceFront = 2;\nconst CullFaceFrontBack = 3;\nconst BasicShadowMap = 0;\nconst PCFShadowMap = 1;\nconst PCFSoftShadowMap = 2;\nconst VSMShadowMap = 3;\nconst FrontSide = 0;\nconst BackSide = 1;\nconst DoubleSide = 2;\nconst NoBlending = 0;\nconst NormalBlending = 1;\nconst AdditiveBlending = 2;\nconst SubtractiveBlending = 3;\nconst MultiplyBlending = 4;\nconst CustomBlending = 5;\nconst AddEquation = 100;\nconst SubtractEquation = 101;\nconst ReverseSubtractEquation = 102;\nconst MinEquation = 103;\nconst MaxEquation = 104;\nconst ZeroFactor = 200;\nconst OneFactor = 201;\nconst SrcColorFactor = 202;\nconst OneMinusSrcColorFactor = 203;\nconst SrcAlphaFactor = 204;\nconst OneMinusSrcAlphaFactor = 205;\nconst DstAlphaFactor = 206;\nconst OneMinusDstAlphaFactor = 207;\nconst DstColorFactor = 208;\nconst OneMinusDstColorFactor = 209;\nconst SrcAlphaSaturateFactor = 210;\nconst ConstantColorFactor = 211;\nconst OneMinusConstantColorFactor = 212;\nconst ConstantAlphaFactor = 213;\nconst OneMinusConstantAlphaFactor = 214;\nconst NeverDepth = 0;\nconst AlwaysDepth = 1;\nconst LessDepth = 2;\nconst LessEqualDepth = 3;\nconst EqualDepth = 4;\nconst GreaterEqualDepth = 5;\nconst GreaterDepth = 6;\nconst NotEqualDepth = 7;\nconst MultiplyOperation = 0;\nconst MixOperation = 1;\nconst AddOperation = 2;\nconst NoToneMapping = 0;\nconst LinearToneMapping = 1;\nconst ReinhardToneMapping = 2;\nconst CineonToneMapping = 3;\nconst ACESFilmicToneMapping = 4;\nconst CustomToneMapping = 5;\nconst AgXToneMapping = 6;\nconst NeutralToneMapping = 7;\nconst AttachedBindMode = 'attached';\nconst DetachedBindMode = 'detached';\n\nconst UVMapping = 300;\nconst CubeReflectionMapping = 301;\nconst CubeRefractionMapping = 302;\nconst EquirectangularReflectionMapping = 303;\nconst EquirectangularRefractionMapping = 304;\nconst CubeUVReflectionMapping = 306;\nconst RepeatWrapping = 1000;\nconst ClampToEdgeWrapping = 1001;\nconst MirroredRepeatWrapping = 1002;\nconst NearestFilter = 1003;\nconst NearestMipmapNearestFilter = 1004;\nconst NearestMipMapNearestFilter = 1004;\nconst NearestMipmapLinearFilter = 1005;\nconst NearestMipMapLinearFilter = 1005;\nconst LinearFilter = 1006;\nconst LinearMipmapNearestFilter = 1007;\nconst LinearMipMapNearestFilter = 1007;\nconst LinearMipmapLinearFilter = 1008;\nconst LinearMipMapLinearFilter = 1008;\nconst UnsignedByteType = 1009;\nconst ByteType = 1010;\nconst ShortType = 1011;\nconst UnsignedShortType = 1012;\nconst IntType = 1013;\nconst UnsignedIntType = 1014;\nconst FloatType = 1015;\nconst HalfFloatType = 1016;\nconst UnsignedShort4444Type = 1017;\nconst UnsignedShort5551Type = 1018;\nconst UnsignedInt248Type = 1020;\nconst UnsignedInt5999Type = 35902;\nconst AlphaFormat = 1021;\nconst RGBFormat = 1022;\nconst RGBAFormat = 1023;\nconst LuminanceFormat = 1024;\nconst LuminanceAlphaFormat = 1025;\nconst DepthFormat = 1026;\nconst DepthStencilFormat = 1027;\nconst RedFormat = 1028;\nconst RedIntegerFormat = 1029;\nconst RGFormat = 1030;\nconst RGIntegerFormat = 1031;\nconst RGBAIntegerFormat = 1033;\n\nconst RGB_S3TC_DXT1_Format = 33776;\nconst RGBA_S3TC_DXT1_Format = 33777;\nconst RGBA_S3TC_DXT3_Format = 33778;\nconst RGBA_S3TC_DXT5_Format = 33779;\nconst RGB_PVRTC_4BPPV1_Format = 35840;\nconst RGB_PVRTC_2BPPV1_Format = 35841;\nconst RGBA_PVRTC_4BPPV1_Format = 35842;\nconst RGBA_PVRTC_2BPPV1_Format = 35843;\nconst RGB_ETC1_Format = 36196;\nconst RGB_ETC2_Format = 37492;\nconst RGBA_ETC2_EAC_Format = 37496;\nconst RGBA_ASTC_4x4_Format = 37808;\nconst RGBA_ASTC_5x4_Format = 37809;\nconst RGBA_ASTC_5x5_Format = 37810;\nconst RGBA_ASTC_6x5_Format = 37811;\nconst RGBA_ASTC_6x6_Format = 37812;\nconst RGBA_ASTC_8x5_Format = 37813;\nconst RGBA_ASTC_8x6_Format = 37814;\nconst RGBA_ASTC_8x8_Format = 37815;\nconst RGBA_ASTC_10x5_Format = 37816;\nconst RGBA_ASTC_10x6_Format = 37817;\nconst RGBA_ASTC_10x8_Format = 37818;\nconst RGBA_ASTC_10x10_Format = 37819;\nconst RGBA_ASTC_12x10_Format = 37820;\nconst RGBA_ASTC_12x12_Format = 37821;\nconst RGBA_BPTC_Format = 36492;\nconst RGB_BPTC_SIGNED_Format = 36494;\nconst RGB_BPTC_UNSIGNED_Format = 36495;\nconst RED_RGTC1_Format = 36283;\nconst SIGNED_RED_RGTC1_Format = 36284;\nconst RED_GREEN_RGTC2_Format = 36285;\nconst SIGNED_RED_GREEN_RGTC2_Format = 36286;\nconst LoopOnce = 2200;\nconst LoopRepeat = 2201;\nconst LoopPingPong = 2202;\nconst InterpolateDiscrete = 2300;\nconst InterpolateLinear = 2301;\nconst InterpolateSmooth = 2302;\nconst ZeroCurvatureEnding = 2400;\nconst ZeroSlopeEnding = 2401;\nconst WrapAroundEnding = 2402;\nconst NormalAnimationBlendMode = 2500;\nconst AdditiveAnimationBlendMode = 2501;\nconst TrianglesDrawMode = 0;\nconst TriangleStripDrawMode = 1;\nconst TriangleFanDrawMode = 2;\nconst BasicDepthPacking = 3200;\nconst RGBADepthPacking = 3201;\nconst TangentSpaceNormalMap = 0;\nconst ObjectSpaceNormalMap = 1;\n\n// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.\nconst NoColorSpace = '';\nconst SRGBColorSpace = 'srgb';\nconst LinearSRGBColorSpace = 'srgb-linear';\nconst DisplayP3ColorSpace = 'display-p3';\nconst LinearDisplayP3ColorSpace = 'display-p3-linear';\n\nconst LinearTransfer = 'linear';\nconst SRGBTransfer = 'srgb';\n\nconst Rec709Primaries = 'rec709';\nconst P3Primaries = 'p3';\n\nconst ZeroStencilOp = 0;\nconst KeepStencilOp = 7680;\nconst ReplaceStencilOp = 7681;\nconst IncrementStencilOp = 7682;\nconst DecrementStencilOp = 7683;\nconst IncrementWrapStencilOp = 34055;\nconst DecrementWrapStencilOp = 34056;\nconst InvertStencilOp = 5386;\n\nconst NeverStencilFunc = 512;\nconst LessStencilFunc = 513;\nconst EqualStencilFunc = 514;\nconst LessEqualStencilFunc = 515;\nconst GreaterStencilFunc = 516;\nconst NotEqualStencilFunc = 517;\nconst GreaterEqualStencilFunc = 518;\nconst AlwaysStencilFunc = 519;\n\nconst NeverCompare = 512;\nconst LessCompare = 513;\nconst EqualCompare = 514;\nconst LessEqualCompare = 515;\nconst GreaterCompare = 516;\nconst NotEqualCompare = 517;\nconst GreaterEqualCompare = 518;\nconst AlwaysCompare = 519;\n\nconst StaticDrawUsage = 35044;\nconst DynamicDrawUsage = 35048;\nconst StreamDrawUsage = 35040;\nconst StaticReadUsage = 35045;\nconst DynamicReadUsage = 35049;\nconst StreamReadUsage = 35041;\nconst StaticCopyUsage = 35046;\nconst DynamicCopyUsage = 35050;\nconst StreamCopyUsage = 35042;\n\nconst GLSL1 = '100';\nconst GLSL3 = '300 es';\n\nconst WebGLCoordinateSystem = 2000;\nconst WebGPUCoordinateSystem = 2001;\n\n/**\n * https://github.com/mrdoob/eventdispatcher.js/\n */\n\nclass EventDispatcher {\n\n\taddEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) this._listeners = {};\n\n\t\tconst listeners = this._listeners;\n\n\t\tif ( listeners[ type ] === undefined ) {\n\n\t\t\tlisteners[ type ] = [];\n\n\t\t}\n\n\t\tif ( listeners[ type ].indexOf( listener ) === - 1 ) {\n\n\t\t\tlisteners[ type ].push( listener );\n\n\t\t}\n\n\t}\n\n\thasEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return false;\n\n\t\tconst listeners = this._listeners;\n\n\t\treturn listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;\n\n\t}\n\n\tremoveEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tconst index = listenerArray.indexOf( listener );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\tlistenerArray.splice( index, 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ event.type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tevent.target = this;\n\n\t\t\t// Make a copy, in case listeners are removed while iterating.\n\t\t\tconst array = listenerArray.slice( 0 );\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tarray[ i ].call( this, event );\n\n\t\t\t}\n\n\t\t\tevent.target = null;\n\n\t\t}\n\n\t}\n\n}\n\nconst _lut = [ '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff' ];\n\nlet _seed = 1234567;\n\n\nconst DEG2RAD = Math.PI / 180;\nconst RAD2DEG = 180 / Math.PI;\n\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\nfunction generateUUID() {\n\n\tconst d0 = Math.random() * 0xffffffff | 0;\n\tconst d1 = Math.random() * 0xffffffff | 0;\n\tconst d2 = Math.random() * 0xffffffff | 0;\n\tconst d3 = Math.random() * 0xffffffff | 0;\n\tconst uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +\n\t\t\t_lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];\n\n\t// .toLowerCase() here flattens concatenated strings to save heap memory space.\n\treturn uuid.toLowerCase();\n\n}\n\nfunction clamp( value, min, max ) {\n\n\treturn Math.max( min, Math.min( max, value ) );\n\n}\n\n// compute euclidean modulo of m % n\n// https://en.wikipedia.org/wiki/Modulo_operation\nfunction euclideanModulo( n, m ) {\n\n\treturn ( ( n % m ) + m ) % m;\n\n}\n\n// Linear mapping from range to range \nfunction mapLinear( x, a1, a2, b1, b2 ) {\n\n\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\n\n}\n\n// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\nfunction inverseLerp( x, y, value ) {\n\n\tif ( x !== y ) {\n\n\t\treturn ( value - x ) / ( y - x );\n\n\t} else {\n\n\t\treturn 0;\n\n\t}\n\n}\n\n// https://en.wikipedia.org/wiki/Linear_interpolation\nfunction lerp( x, y, t ) {\n\n\treturn ( 1 - t ) * x + t * y;\n\n}\n\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nfunction damp( x, y, lambda, dt ) {\n\n\treturn lerp( x, y, 1 - Math.exp( - lambda * dt ) );\n\n}\n\n// https://www.desmos.com/calculator/vcsjnyz7x4\nfunction pingpong( x, length = 1 ) {\n\n\treturn length - Math.abs( euclideanModulo( x, length * 2 ) - length );\n\n}\n\n// http://en.wikipedia.org/wiki/Smoothstep\nfunction smoothstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * ( 3 - 2 * x );\n\n}\n\nfunction smootherstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\n\n}\n\n// Random integer from interval\nfunction randInt( low, high ) {\n\n\treturn low + Math.floor( Math.random() * ( high - low + 1 ) );\n\n}\n\n// Random float from interval\nfunction randFloat( low, high ) {\n\n\treturn low + Math.random() * ( high - low );\n\n}\n\n// Random float from <-range/2, range/2> interval\nfunction randFloatSpread( range ) {\n\n\treturn range * ( 0.5 - Math.random() );\n\n}\n\n// Deterministic pseudo-random float in the interval [ 0, 1 ]\nfunction seededRandom( s ) {\n\n\tif ( s !== undefined ) _seed = s;\n\n\t// Mulberry32 generator\n\n\tlet t = _seed += 0x6D2B79F5;\n\n\tt = Math.imul( t ^ t >>> 15, t | 1 );\n\n\tt ^= t + Math.imul( t ^ t >>> 7, t | 61 );\n\n\treturn ( ( t ^ t >>> 14 ) >>> 0 ) / 4294967296;\n\n}\n\nfunction degToRad( degrees ) {\n\n\treturn degrees * DEG2RAD;\n\n}\n\nfunction radToDeg( radians ) {\n\n\treturn radians * RAD2DEG;\n\n}\n\nfunction isPowerOfTwo( value ) {\n\n\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\n\n}\n\nfunction ceilPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction floorPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction setQuaternionFromProperEuler( q, a, b, c, order ) {\n\n\t// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\n\n\t// rotations are applied to the axes in the order specified by 'order'\n\t// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\n\t// angles are in radians\n\n\tconst cos = Math.cos;\n\tconst sin = Math.sin;\n\n\tconst c2 = cos( b / 2 );\n\tconst s2 = sin( b / 2 );\n\n\tconst c13 = cos( ( a + c ) / 2 );\n\tconst s13 = sin( ( a + c ) / 2 );\n\n\tconst c1_3 = cos( ( a - c ) / 2 );\n\tconst s1_3 = sin( ( a - c ) / 2 );\n\n\tconst c3_1 = cos( ( c - a ) / 2 );\n\tconst s3_1 = sin( ( c - a ) / 2 );\n\n\tswitch ( order ) {\n\n\t\tcase 'XYX':\n\t\t\tq.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YZY':\n\t\t\tq.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZXZ':\n\t\t\tq.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'XZX':\n\t\t\tq.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YXY':\n\t\t\tq.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZYZ':\n\t\t\tq.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );\n\n\t}\n\n}\n\nfunction denormalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn value / 4294967295.0;\n\n\t\tcase Uint16Array:\n\n\t\t\treturn value / 65535.0;\n\n\t\tcase Uint8Array:\n\n\t\t\treturn value / 255.0;\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.max( value / 2147483647.0, - 1.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.max( value / 32767.0, - 1.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.max( value / 127.0, - 1.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nfunction normalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn Math.round( value * 4294967295.0 );\n\n\t\tcase Uint16Array:\n\n\t\t\treturn Math.round( value * 65535.0 );\n\n\t\tcase Uint8Array:\n\n\t\t\treturn Math.round( value * 255.0 );\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.round( value * 2147483647.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.round( value * 32767.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.round( value * 127.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nconst MathUtils = {\n\tDEG2RAD: DEG2RAD,\n\tRAD2DEG: RAD2DEG,\n\tgenerateUUID: generateUUID,\n\tclamp: clamp,\n\teuclideanModulo: euclideanModulo,\n\tmapLinear: mapLinear,\n\tinverseLerp: inverseLerp,\n\tlerp: lerp,\n\tdamp: damp,\n\tpingpong: pingpong,\n\tsmoothstep: smoothstep,\n\tsmootherstep: smootherstep,\n\trandInt: randInt,\n\trandFloat: randFloat,\n\trandFloatSpread: randFloatSpread,\n\tseededRandom: seededRandom,\n\tdegToRad: degToRad,\n\tradToDeg: radToDeg,\n\tisPowerOfTwo: isPowerOfTwo,\n\tceilPowerOfTwo: ceilPowerOfTwo,\n\tfloorPowerOfTwo: floorPowerOfTwo,\n\tsetQuaternionFromProperEuler: setQuaternionFromProperEuler,\n\tnormalize: normalize,\n\tdenormalize: denormalize\n};\n\nclass Vector2 {\n\n\tconstructor( x = 0, y = 0 ) {\n\n\t\tVector2.prototype.isVector2 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.x;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.x = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.y;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.y = value;\n\n\t}\n\n\tset( x, y ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.x * v.y - this.y * v.x;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tangle() {\n\n\t\t// computes the angle in radians with respect to the positive x-axis\n\n\t\tconst angle = Math.atan2( - this.y, - this.x ) + Math.PI;\n\n\t\treturn angle;\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y;\n\t\treturn dx * dx + dy * dy;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\n\t\treturn this;\n\n\t}\n\n\trotateAround( center, angle ) {\n\n\t\tconst c = Math.cos( angle ), s = Math.sin( angle );\n\n\t\tconst x = this.x - center.x;\n\t\tconst y = this.y - center.y;\n\n\t\tthis.x = x * c - y * s + center.x;\n\t\tthis.y = x * s + y * c + center.y;\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\n\t}\n\n}\n\nclass Matrix3 {\n\n\tconstructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tMatrix3.prototype.isMatrix3 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n21, n22, n23, n31, n32, n33 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;\n\t\tte[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;\n\t\tte[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];\n\t\tte[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];\n\t\tte[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrix3Column( this, 0 );\n\t\tyAxis.setFromMatrix3Column( this, 1 );\n\t\tzAxis.setFromMatrix3Column( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix4( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 4 ], me[ 8 ],\n\t\t\tme[ 1 ], me[ 5 ], me[ 9 ],\n\t\t\tme[ 2 ], me[ 6 ], me[ 10 ]\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;\n\t\tte[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;\n\t\tte[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;\n\t\tte[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;\n\t\tte[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;\n\t\tte[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;\n\t\tte[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\n\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n\n\t}\n\n\tinvert() {\n\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ],\n\t\t\tn12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ],\n\t\t\tn13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ],\n\n\t\t\tt11 = n33 * n22 - n32 * n23,\n\t\t\tt12 = n32 * n13 - n33 * n12,\n\t\t\tt13 = n23 * n12 - n22 * n13,\n\n\t\t\tdet = n11 * t11 + n21 * t12 + n31 * t13;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;\n\t\tte[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;\n\n\t\tte[ 3 ] = t12 * detInv;\n\t\tte[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;\n\t\tte[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;\n\n\t\tte[ 6 ] = t13 * detInv;\n\t\tte[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;\n\t\tte[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\ttranspose() {\n\n\t\tlet tmp;\n\t\tconst m = this.elements;\n\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tgetNormalMatrix( matrix4 ) {\n\n\t\treturn this.setFromMatrix4( matrix4 ).invert().transpose();\n\n\t}\n\n\ttransposeIntoArray( r ) {\n\n\t\tconst m = this.elements;\n\n\t\tr[ 0 ] = m[ 0 ];\n\t\tr[ 1 ] = m[ 3 ];\n\t\tr[ 2 ] = m[ 6 ];\n\t\tr[ 3 ] = m[ 1 ];\n\t\tr[ 4 ] = m[ 4 ];\n\t\tr[ 5 ] = m[ 7 ];\n\t\tr[ 6 ] = m[ 2 ];\n\t\tr[ 7 ] = m[ 5 ];\n\t\tr[ 8 ] = m[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetUvTransform( tx, ty, sx, sy, rotation, cx, cy ) {\n\n\t\tconst c = Math.cos( rotation );\n\t\tconst s = Math.sin( rotation );\n\n\t\tthis.set(\n\t\t\tsx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,\n\t\t\t- sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,\n\t\t\t0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tscale( sx, sy ) {\n\n\t\tthis.premultiply( _m3.makeScale( sx, sy ) );\n\n\t\treturn this;\n\n\t}\n\n\trotate( theta ) {\n\n\t\tthis.premultiply( _m3.makeRotation( - theta ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( tx, ty ) {\n\n\t\tthis.premultiply( _m3.makeTranslation( tx, ty ) );\n\n\t\treturn this;\n\n\t}\n\n\t// for 2D Transforms\n\n\tmakeTranslation( x, y ) {\n\n\t\tif ( x.isVector2 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x.x,\n\t\t\t\t0, 1, x.y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x,\n\t\t\t\t0, 1, y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotation( theta ) {\n\n\t\t// counterclockwise\n\n\t\tconst c = Math.cos( theta );\n\t\tconst s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0,\n\t\t\ts, c, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0,\n\t\t\t0, y, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\n\t\treturn array;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().fromArray( this.elements );\n\n\t}\n\n}\n\nconst _m3 = /*@__PURE__*/ new Matrix3();\n\nfunction arrayNeedsUint32( array ) {\n\n\t// assumes larger values usually on last\n\n\tfor ( let i = array.length - 1; i >= 0; -- i ) {\n\n\t\tif ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\n\n\t}\n\n\treturn false;\n\n}\n\nconst TYPED_ARRAYS = {\n\tInt8Array: Int8Array,\n\tUint8Array: Uint8Array,\n\tUint8ClampedArray: Uint8ClampedArray,\n\tInt16Array: Int16Array,\n\tUint16Array: Uint16Array,\n\tInt32Array: Int32Array,\n\tUint32Array: Uint32Array,\n\tFloat32Array: Float32Array,\n\tFloat64Array: Float64Array\n};\n\nfunction getTypedArray( type, buffer ) {\n\n\treturn new TYPED_ARRAYS[ type ]( buffer );\n\n}\n\nfunction createElementNS( name ) {\n\n\treturn document.createElementNS( 'http://www.w3.org/1999/xhtml', name );\n\n}\n\nfunction createCanvasElement() {\n\n\tconst canvas = createElementNS( 'canvas' );\n\tcanvas.style.display = 'block';\n\treturn canvas;\n\n}\n\nconst _cache = {};\n\nfunction warnOnce( message ) {\n\n\tif ( message in _cache ) return;\n\n\t_cache[ message ] = true;\n\n\tconsole.warn( message );\n\n}\n\n/**\n * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping\n * or clipping. Based on W3C specifications for sRGB and Display P3,\n * and ICC specifications for the D50 connection space. Values in/out\n * are _linear_ sRGB and _linear_ Display P3.\n *\n * Note that both sRGB and Display P3 use the sRGB transfer functions.\n *\n * Reference:\n * - http://www.russellcottrell.com/photo/matrixCalculator.htm\n */\n\nconst LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().set(\n\t0.8224621, 0.177538, 0.0,\n\t0.0331941, 0.9668058, 0.0,\n\t0.0170827, 0.0723974, 0.9105199,\n);\n\nconst LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(\n\t1.2249401, - 0.2249404, 0.0,\n\t- 0.0420569, 1.0420571, 0.0,\n\t- 0.0196376, - 0.0786361, 1.0982735\n);\n\n/**\n * Defines supported color spaces by transfer function and primaries,\n * and provides conversions to/from the Linear-sRGB reference space.\n */\nconst COLOR_SPACES = {\n\t[ LinearSRGBColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\ttoReference: ( color ) => color,\n\t\tfromReference: ( color ) => color,\n\t},\n\t[ SRGBColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\ttoReference: ( color ) => color.convertSRGBToLinear(),\n\t\tfromReference: ( color ) => color.convertLinearToSRGB(),\n\t},\n\t[ LinearDisplayP3ColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: P3Primaries,\n\t\ttoReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),\n\t},\n\t[ DisplayP3ColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: P3Primaries,\n\t\ttoReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),\n\t},\n};\n\nconst SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );\n\nconst ColorManagement = {\n\n\tenabled: true,\n\n\t_workingColorSpace: LinearSRGBColorSpace,\n\n\tget workingColorSpace() {\n\n\t\treturn this._workingColorSpace;\n\n\t},\n\n\tset workingColorSpace( colorSpace ) {\n\n\t\tif ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {\n\n\t\t\tthrow new Error( `Unsupported working color space, \"${ colorSpace }\".` );\n\n\t\t}\n\n\t\tthis._workingColorSpace = colorSpace;\n\n\t},\n\n\tconvert: function ( color, sourceColorSpace, targetColorSpace ) {\n\n\t\tif ( this.enabled === false || sourceColorSpace === targetColorSpace || ! sourceColorSpace || ! targetColorSpace ) {\n\n\t\t\treturn color;\n\n\t\t}\n\n\t\tconst sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;\n\t\tconst targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;\n\n\t\treturn targetFromReference( sourceToReference( color ) );\n\n\t},\n\n\tfromWorkingColorSpace: function ( color, targetColorSpace ) {\n\n\t\treturn this.convert( color, this._workingColorSpace, targetColorSpace );\n\n\t},\n\n\ttoWorkingColorSpace: function ( color, sourceColorSpace ) {\n\n\t\treturn this.convert( color, sourceColorSpace, this._workingColorSpace );\n\n\t},\n\n\tgetPrimaries: function ( colorSpace ) {\n\n\t\treturn COLOR_SPACES[ colorSpace ].primaries;\n\n\t},\n\n\tgetTransfer: function ( colorSpace ) {\n\n\t\tif ( colorSpace === NoColorSpace ) return LinearTransfer;\n\n\t\treturn COLOR_SPACES[ colorSpace ].transfer;\n\n\t},\n\n};\n\n\nfunction SRGBToLinear( c ) {\n\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n\n}\n\nfunction LinearToSRGB( c ) {\n\n\treturn ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;\n\n}\n\nlet _canvas;\n\nclass ImageUtils {\n\n\tstatic getDataURL( image ) {\n\n\t\tif ( /^data:/i.test( image.src ) ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tif ( typeof HTMLCanvasElement === 'undefined' ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tlet canvas;\n\n\t\tif ( image instanceof HTMLCanvasElement ) {\n\n\t\t\tcanvas = image;\n\n\t\t} else {\n\n\t\t\tif ( _canvas === undefined ) _canvas = createElementNS( 'canvas' );\n\n\t\t\t_canvas.width = image.width;\n\t\t\t_canvas.height = image.height;\n\n\t\t\tconst context = _canvas.getContext( '2d' );\n\n\t\t\tif ( image instanceof ImageData ) {\n\n\t\t\t\tcontext.putImageData( image, 0, 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\t}\n\n\t\t\tcanvas = _canvas;\n\n\t\t}\n\n\t\tif ( canvas.width > 2048 || canvas.height > 2048 ) {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image );\n\n\t\t\treturn canvas.toDataURL( 'image/jpeg', 0.6 );\n\n\t\t} else {\n\n\t\t\treturn canvas.toDataURL( 'image/png' );\n\n\t\t}\n\n\t}\n\n\tstatic sRGBToLinear( image ) {\n\n\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\tconst canvas = createElementNS( 'canvas' );\n\n\t\t\tcanvas.width = image.width;\n\t\t\tcanvas.height = image.height;\n\n\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\tconst imageData = context.getImageData( 0, 0, image.width, image.height );\n\t\t\tconst data = imageData.data;\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] / 255 ) * 255;\n\n\t\t\t}\n\n\t\t\tcontext.putImageData( imageData, 0, 0 );\n\n\t\t\treturn canvas;\n\n\t\t} else if ( image.data ) {\n\n\t\t\tconst data = image.data.slice( 0 );\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tif ( data instanceof Uint8Array || data instanceof Uint8ClampedArray ) {\n\n\t\t\t\t\tdata[ i ] = Math.floor( SRGBToLinear( data[ i ] / 255 ) * 255 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// assuming float\n\n\t\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tdata: data,\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );\n\t\t\treturn image;\n\n\t\t}\n\n\t}\n\n}\n\nlet _sourceId = 0;\n\nclass Source {\n\n\tconstructor( data = null ) {\n\n\t\tthis.isSource = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _sourceId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.data = data;\n\t\tthis.dataReady = true;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.images[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.images[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\t\t\tuuid: this.uuid,\n\t\t\turl: ''\n\t\t};\n\n\t\tconst data = this.data;\n\n\t\tif ( data !== null ) {\n\n\t\t\tlet url;\n\n\t\t\tif ( Array.isArray( data ) ) {\n\n\t\t\t\t// cube texture\n\n\t\t\t\turl = [];\n\n\t\t\t\tfor ( let i = 0, l = data.length; i < l; i ++ ) {\n\n\t\t\t\t\tif ( data[ i ].isDataTexture ) {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ].image ) );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ] ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// texture\n\n\t\t\t\turl = serializeImage( data );\n\n\t\t\t}\n\n\t\t\toutput.url = url;\n\n\t\t}\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.images[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n}\n\nfunction serializeImage( image ) {\n\n\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t// default images\n\n\t\treturn ImageUtils.getDataURL( image );\n\n\t} else {\n\n\t\tif ( image.data ) {\n\n\t\t\t// images of DataTexture\n\n\t\t\treturn {\n\t\t\t\tdata: Array.from( image.data ),\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height,\n\t\t\t\ttype: image.data.constructor.name\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Texture: Unable to serialize Texture.' );\n\t\t\treturn {};\n\n\t\t}\n\n\t}\n\n}\n\nlet _textureId = 0;\n\nclass Texture extends EventDispatcher {\n\n\tconstructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace ) {\n\n\t\tsuper();\n\n\t\tthis.isTexture = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _textureId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\n\t\tthis.source = new Source( image );\n\t\tthis.mipmaps = [];\n\n\t\tthis.mapping = mapping;\n\t\tthis.channel = 0;\n\n\t\tthis.wrapS = wrapS;\n\t\tthis.wrapT = wrapT;\n\n\t\tthis.magFilter = magFilter;\n\t\tthis.minFilter = minFilter;\n\n\t\tthis.anisotropy = anisotropy;\n\n\t\tthis.format = format;\n\t\tthis.internalFormat = null;\n\t\tthis.type = type;\n\n\t\tthis.offset = new Vector2( 0, 0 );\n\t\tthis.repeat = new Vector2( 1, 1 );\n\t\tthis.center = new Vector2( 0, 0 );\n\t\tthis.rotation = 0;\n\n\t\tthis.matrixAutoUpdate = true;\n\t\tthis.matrix = new Matrix3();\n\n\t\tthis.generateMipmaps = true;\n\t\tthis.premultiplyAlpha = false;\n\t\tthis.flipY = true;\n\t\tthis.unpackAlignment = 4;\t// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n\n\t\tthis.colorSpace = colorSpace;\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\t\tthis.onUpdate = null;\n\n\t\tthis.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not\n\t\tthis.pmremVersion = 0; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)\n\n\t}\n\n\tget image() {\n\n\t\treturn this.source.data;\n\n\t}\n\n\tset image( value = null ) {\n\n\t\tthis.source.data = value;\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.source = source.source;\n\t\tthis.mipmaps = source.mipmaps.slice( 0 );\n\n\t\tthis.mapping = source.mapping;\n\t\tthis.channel = source.channel;\n\n\t\tthis.wrapS = source.wrapS;\n\t\tthis.wrapT = source.wrapT;\n\n\t\tthis.magFilter = source.magFilter;\n\t\tthis.minFilter = source.minFilter;\n\n\t\tthis.anisotropy = source.anisotropy;\n\n\t\tthis.format = source.format;\n\t\tthis.internalFormat = source.internalFormat;\n\t\tthis.type = source.type;\n\n\t\tthis.offset.copy( source.offset );\n\t\tthis.repeat.copy( source.repeat );\n\t\tthis.center.copy( source.center );\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrix.copy( source.matrix );\n\n\t\tthis.generateMipmaps = source.generateMipmaps;\n\t\tthis.premultiplyAlpha = source.premultiplyAlpha;\n\t\tthis.flipY = source.flipY;\n\t\tthis.unpackAlignment = source.unpackAlignment;\n\t\tthis.colorSpace = source.colorSpace;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tthis.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.textures[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Texture',\n\t\t\t\tgenerator: 'Texture.toJSON'\n\t\t\t},\n\n\t\t\tuuid: this.uuid,\n\t\t\tname: this.name,\n\n\t\t\timage: this.source.toJSON( meta ).uuid,\n\n\t\t\tmapping: this.mapping,\n\t\t\tchannel: this.channel,\n\n\t\t\trepeat: [ this.repeat.x, this.repeat.y ],\n\t\t\toffset: [ this.offset.x, this.offset.y ],\n\t\t\tcenter: [ this.center.x, this.center.y ],\n\t\t\trotation: this.rotation,\n\n\t\t\twrap: [ this.wrapS, this.wrapT ],\n\n\t\t\tformat: this.format,\n\t\t\tinternalFormat: this.internalFormat,\n\t\t\ttype: this.type,\n\t\t\tcolorSpace: this.colorSpace,\n\n\t\t\tminFilter: this.minFilter,\n\t\t\tmagFilter: this.magFilter,\n\t\t\tanisotropy: this.anisotropy,\n\n\t\t\tflipY: this.flipY,\n\n\t\t\tgenerateMipmaps: this.generateMipmaps,\n\t\t\tpremultiplyAlpha: this.premultiplyAlpha,\n\t\t\tunpackAlignment: this.unpackAlignment\n\n\t\t};\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) output.userData = this.userData;\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.textures[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\ttransformUv( uv ) {\n\n\t\tif ( this.mapping !== UVMapping ) return uv;\n\n\t\tuv.applyMatrix3( this.matrix );\n\n\t\tif ( uv.x < 0 || uv.x > 1 ) {\n\n\t\t\tswitch ( this.wrapS ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.x = uv.x < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.x = Math.ceil( uv.x ) - uv.x;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( uv.y < 0 || uv.y > 1 ) {\n\n\t\t\tswitch ( this.wrapT ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.y = uv.y < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.y = Math.ceil( uv.y ) - uv.y;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.flipY ) {\n\n\t\t\tuv.y = 1 - uv.y;\n\n\t\t}\n\n\t\treturn uv;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.version ++;\n\t\t\tthis.source.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tset needsPMREMUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.pmremVersion ++;\n\n\t\t}\n\n\t}\n\n}\n\nTexture.DEFAULT_IMAGE = null;\nTexture.DEFAULT_MAPPING = UVMapping;\nTexture.DEFAULT_ANISOTROPY = 1;\n\nclass Vector4 {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tVector4.prototype.isVector4 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.z;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.z = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.w;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.w = value;\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\t\tthis.w = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( w ) {\n\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tcase 3: this.w = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tcase 3: return this.w;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\t\tthis.w += v.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\t\tthis.w += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\t\tthis.w = a.w + b.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\t\tthis.w += v.w * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\t\tthis.w -= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\t\tthis.w -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\t\tthis.w = a.w - b.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\t\tthis.w *= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\t\tthis.w *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z, w = this.w;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tsetAxisAngleFromQuaternion( q ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n\n\t\t// q is assumed to be normalized\n\n\t\tthis.w = 2 * Math.acos( q.w );\n\n\t\tconst s = Math.sqrt( 1 - q.w * q.w );\n\n\t\tif ( s < 0.0001 ) {\n\n\t\t\tthis.x = 1;\n\t\t\tthis.y = 0;\n\t\t\tthis.z = 0;\n\n\t\t} else {\n\n\t\t\tthis.x = q.x / s;\n\t\t\tthis.y = q.y / s;\n\t\t\tthis.z = q.z / s;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetAxisAngleFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tlet angle, x, y, z; // variables for result\n\t\tconst epsilon = 0.01,\t\t// margin to allow for rounding errors\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\n\n\t\t\tte = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon ) &&\n\t\t ( Math.abs( m13 - m31 ) < epsilon ) &&\n\t\t ( Math.abs( m23 - m32 ) < epsilon ) ) {\n\n\t\t\t// singularity found\n\t\t\t// first check for identity matrix which must have +1 for all terms\n\t\t\t// in leading diagonal and zero in other terms\n\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m13 + m31 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m23 + m32 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\n\n\t\t\t\t// this singularity is identity matrix so angle = 0\n\n\t\t\t\tthis.set( 1, 0, 0, 0 );\n\n\t\t\t\treturn this; // zero angle, arbitrary axis\n\n\t\t\t}\n\n\t\t\t// otherwise this singularity is angle = 180\n\n\t\t\tangle = Math.PI;\n\n\t\t\tconst xx = ( m11 + 1 ) / 2;\n\t\t\tconst yy = ( m22 + 1 ) / 2;\n\t\t\tconst zz = ( m33 + 1 ) / 2;\n\t\t\tconst xy = ( m12 + m21 ) / 4;\n\t\t\tconst xz = ( m13 + m31 ) / 4;\n\t\t\tconst yz = ( m23 + m32 ) / 4;\n\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\n\n\t\t\t\t// m11 is the largest diagonal term\n\n\t\t\t\tif ( xx < epsilon ) {\n\n\t\t\t\t\tx = 0;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tx = Math.sqrt( xx );\n\t\t\t\t\ty = xy / x;\n\t\t\t\t\tz = xz / x;\n\n\t\t\t\t}\n\n\t\t\t} else if ( yy > zz ) {\n\n\t\t\t\t// m22 is the largest diagonal term\n\n\t\t\t\tif ( yy < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ty = Math.sqrt( yy );\n\t\t\t\t\tx = xy / y;\n\t\t\t\t\tz = yz / y;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// m33 is the largest diagonal term so base result on this\n\n\t\t\t\tif ( zz < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tz = Math.sqrt( zz );\n\t\t\t\t\tx = xz / z;\n\t\t\t\t\ty = yz / z;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.set( x, y, z, angle );\n\n\t\t\treturn this; // return 180 deg rotation\n\n\t\t}\n\n\t\t// as we have reached here there are no singularities so we can handle normally\n\n\t\tlet s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +\n\t\t\t( m13 - m31 ) * ( m13 - m31 ) +\n\t\t\t( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\n\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\n\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\n\t\t// caught by singularity test above, but I've left it in just in case\n\n\t\tthis.x = ( m32 - m23 ) / s;\n\t\tthis.y = ( m13 - m31 ) / s;\n\t\tthis.z = ( m21 - m12 ) / s;\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\t\tthis.w = Math.min( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\t\tthis.w = Math.max( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\t\tthis.w = Math.max( min.w, Math.min( max.w, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\t\tthis.w = Math.max( minVal, Math.min( maxVal, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\t\tthis.w = Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\t\tthis.w = Math.ceil( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\t\tthis.w = Math.round( this.w );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\t\tthis.w = Math.trunc( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\t\tthis.w = - this.w;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\t\tthis.w += ( v.w - this.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\t\tthis.w = v1.w + ( v2.w - v1.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\t\tthis.w = array[ offset + 3 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\t\tarray[ offset + 3 ] = this.w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\t\tthis.w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\t\tthis.w = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\t\tyield this.w;\n\n\t}\n\n}\n\n/*\n In options, we can specify:\n * Texture parameters for an auto-generated target texture\n * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers\n*/\nclass RenderTarget extends EventDispatcher {\n\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.isRenderTarget = true;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t\tthis.depth = 1;\n\n\t\tthis.scissor = new Vector4( 0, 0, width, height );\n\t\tthis.scissorTest = false;\n\n\t\tthis.viewport = new Vector4( 0, 0, width, height );\n\n\t\tconst image = { width: width, height: height, depth: 1 };\n\n\t\toptions = Object.assign( {\n\t\t\tgenerateMipmaps: false,\n\t\t\tinternalFormat: null,\n\t\t\tminFilter: LinearFilter,\n\t\t\tdepthBuffer: true,\n\t\t\tstencilBuffer: false,\n\t\t\tdepthTexture: null,\n\t\t\tsamples: 0,\n\t\t\tcount: 1\n\t\t}, options );\n\n\t\tconst texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\n\t\ttexture.flipY = false;\n\t\ttexture.generateMipmaps = options.generateMipmaps;\n\t\ttexture.internalFormat = options.internalFormat;\n\n\t\tthis.textures = [];\n\n\t\tconst count = options.count;\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.textures[ i ] = texture.clone();\n\t\t\tthis.textures[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t\tthis.depthBuffer = options.depthBuffer;\n\t\tthis.stencilBuffer = options.stencilBuffer;\n\n\t\tthis.depthTexture = options.depthTexture;\n\n\t\tthis.samples = options.samples;\n\n\t}\n\n\tget texture() {\n\n\t\treturn this.textures[ 0 ];\n\n\t}\n\n\tset texture( value ) {\n\n\t\tthis.textures[ 0 ] = value;\n\n\t}\n\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tfor ( let i = 0, il = this.textures.length; i < il; i ++ ) {\n\n\t\t\t\tthis.textures[ i ].image.width = width;\n\t\t\t\tthis.textures[ i ].image.height = height;\n\t\t\t\tthis.textures[ i ].image.depth = depth;\n\n\t\t\t}\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.scissor.copy( source.scissor );\n\t\tthis.scissorTest = source.scissorTest;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.textures.length = 0;\n\n\t\tfor ( let i = 0, il = source.textures.length; i < il; i ++ ) {\n\n\t\t\tthis.textures[ i ] = source.textures[ i ].clone();\n\t\t\tthis.textures[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t\t// ensure image object is not shared, see #20328\n\n\t\tconst image = Object.assign( {}, source.texture.image );\n\t\tthis.texture.source = new Source( image );\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\n\t\tif ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();\n\n\t\tthis.samples = source.samples;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nclass WebGLRenderTarget extends RenderTarget {\n\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLRenderTarget = true;\n\n\t}\n\n}\n\nclass DataArrayTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( null );\n\n\t\tthis.isDataArrayTexture = true;\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nclass WebGLArrayRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLArrayRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\tthis.texture = new DataArrayTexture( null, width, height, depth );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\nclass Data3DTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\t// We're going to add .setXXX() methods for setting properties later.\n\t\t// Users can still set in DataTexture3D directly.\n\t\t//\n\t\t//\tconst texture = new THREE.DataTexture3D( data, width, height, depth );\n\t\t// \ttexture.anisotropy = 16;\n\t\t//\n\t\t// See #14839\n\n\t\tsuper( null );\n\n\t\tthis.isData3DTexture = true;\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nclass WebGL3DRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGL3DRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\tthis.texture = new Data3DTexture( null, width, height, depth );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\nclass Quaternion {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tthis.isQuaternion = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t}\n\n\tstatic slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {\n\n\t\t// fuzz-free, array-based Quaternion SLERP operation\n\n\t\tlet x0 = src0[ srcOffset0 + 0 ],\n\t\t\ty0 = src0[ srcOffset0 + 1 ],\n\t\t\tz0 = src0[ srcOffset0 + 2 ],\n\t\t\tw0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 + 0 ],\n\t\t\ty1 = src1[ srcOffset1 + 1 ],\n\t\t\tz1 = src1[ srcOffset1 + 2 ],\n\t\t\tw1 = src1[ srcOffset1 + 3 ];\n\n\t\tif ( t === 0 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x0;\n\t\t\tdst[ dstOffset + 1 ] = y0;\n\t\t\tdst[ dstOffset + 2 ] = z0;\n\t\t\tdst[ dstOffset + 3 ] = w0;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( t === 1 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x1;\n\t\t\tdst[ dstOffset + 1 ] = y1;\n\t\t\tdst[ dstOffset + 2 ] = z1;\n\t\t\tdst[ dstOffset + 3 ] = w1;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {\n\n\t\t\tlet s = 1 - t;\n\t\t\tconst cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,\n\t\t\t\tdir = ( cos >= 0 ? 1 : - 1 ),\n\t\t\t\tsqrSin = 1 - cos * cos;\n\n\t\t\t// Skip the Slerp for tiny steps to avoid numeric problems:\n\t\t\tif ( sqrSin > Number.EPSILON ) {\n\n\t\t\t\tconst sin = Math.sqrt( sqrSin ),\n\t\t\t\t\tlen = Math.atan2( sin, cos * dir );\n\n\t\t\t\ts = Math.sin( s * len ) / sin;\n\t\t\t\tt = Math.sin( t * len ) / sin;\n\n\t\t\t}\n\n\t\t\tconst tDir = t * dir;\n\n\t\t\tx0 = x0 * s + x1 * tDir;\n\t\t\ty0 = y0 * s + y1 * tDir;\n\t\t\tz0 = z0 * s + z1 * tDir;\n\t\t\tw0 = w0 * s + w1 * tDir;\n\n\t\t\t// Normalize in case we just did a lerp:\n\t\t\tif ( s === 1 - t ) {\n\n\t\t\t\tconst f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );\n\n\t\t\t\tx0 *= f;\n\t\t\t\ty0 *= f;\n\t\t\t\tz0 *= f;\n\t\t\t\tw0 *= f;\n\n\t\t\t}\n\n\t\t}\n\n\t\tdst[ dstOffset ] = x0;\n\t\tdst[ dstOffset + 1 ] = y0;\n\t\tdst[ dstOffset + 2 ] = z0;\n\t\tdst[ dstOffset + 3 ] = w0;\n\n\t}\n\n\tstatic multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {\n\n\t\tconst x0 = src0[ srcOffset0 ];\n\t\tconst y0 = src0[ srcOffset0 + 1 ];\n\t\tconst z0 = src0[ srcOffset0 + 2 ];\n\t\tconst w0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 ];\n\t\tconst y1 = src1[ srcOffset1 + 1 ];\n\t\tconst z1 = src1[ srcOffset1 + 2 ];\n\t\tconst w1 = src1[ srcOffset1 + 3 ];\n\n\t\tdst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\n\t\tdst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\n\t\tdst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\n\t\tdst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\n\n\t\treturn dst;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget w() {\n\n\t\treturn this._w;\n\n\t}\n\n\tset w( value ) {\n\n\t\tthis._w = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._w );\n\n\t}\n\n\tcopy( quaternion ) {\n\n\t\tthis._x = quaternion.x;\n\t\tthis._y = quaternion.y;\n\t\tthis._z = quaternion.z;\n\t\tthis._w = quaternion.w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromEuler( euler, update = true ) {\n\n\t\tconst x = euler._x, y = euler._y, z = euler._z, order = euler._order;\n\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n\t\t//\tcontent/SpinCalc.m\n\n\t\tconst cos = Math.cos;\n\t\tconst sin = Math.sin;\n\n\t\tconst c1 = cos( x / 2 );\n\t\tconst c2 = cos( y / 2 );\n\t\tconst c3 = cos( z / 2 );\n\n\t\tconst s1 = sin( x / 2 );\n\t\tconst s2 = sin( y / 2 );\n\t\tconst s3 = sin( z / 2 );\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAxisAngle( axis, angle ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n\n\t\t// assumes axis is normalized\n\n\t\tconst halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n\t\tthis._x = axis.x * s;\n\t\tthis._y = axis.y * s;\n\t\tthis._z = axis.z * s;\n\t\tthis._w = Math.cos( halfAngle );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\n\n\t\t\ttrace = m11 + m22 + m33;\n\n\t\tif ( trace > 0 ) {\n\n\t\t\tconst s = 0.5 / Math.sqrt( trace + 1.0 );\n\n\t\t\tthis._w = 0.25 / s;\n\t\t\tthis._x = ( m32 - m23 ) * s;\n\t\t\tthis._y = ( m13 - m31 ) * s;\n\t\t\tthis._z = ( m21 - m12 ) * s;\n\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\n\n\t\t\tthis._w = ( m32 - m23 ) / s;\n\t\t\tthis._x = 0.25 * s;\n\t\t\tthis._y = ( m12 + m21 ) / s;\n\t\t\tthis._z = ( m13 + m31 ) / s;\n\n\t\t} else if ( m22 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\n\n\t\t\tthis._w = ( m13 - m31 ) / s;\n\t\t\tthis._x = ( m12 + m21 ) / s;\n\t\t\tthis._y = 0.25 * s;\n\t\t\tthis._z = ( m23 + m32 ) / s;\n\n\t\t} else {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\n\n\t\t\tthis._w = ( m21 - m12 ) / s;\n\t\t\tthis._x = ( m13 + m31 ) / s;\n\t\t\tthis._y = ( m23 + m32 ) / s;\n\t\t\tthis._z = 0.25 * s;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromUnitVectors( vFrom, vTo ) {\n\n\t\t// assumes direction vectors vFrom and vTo are normalized\n\n\t\tlet r = vFrom.dot( vTo ) + 1;\n\n\t\tif ( r < Number.EPSILON ) {\n\n\t\t\t// vFrom and vTo point in opposite directions\n\n\t\t\tr = 0;\n\n\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n\n\t\t\t\tthis._x = - vFrom.y;\n\t\t\t\tthis._y = vFrom.x;\n\t\t\t\tthis._z = 0;\n\t\t\t\tthis._w = r;\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = 0;\n\t\t\t\tthis._y = - vFrom.z;\n\t\t\t\tthis._z = vFrom.y;\n\t\t\t\tthis._w = r;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n\n\t\t\tthis._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n\t\t\tthis._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n\t\t\tthis._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n\t\t\tthis._w = r;\n\n\t\t}\n\n\t\treturn this.normalize();\n\n\t}\n\n\tangleTo( q ) {\n\n\t\treturn 2 * Math.acos( Math.abs( clamp( this.dot( q ), - 1, 1 ) ) );\n\n\t}\n\n\trotateTowards( q, step ) {\n\n\t\tconst angle = this.angleTo( q );\n\n\t\tif ( angle === 0 ) return this;\n\n\t\tconst t = Math.min( 1, step / angle );\n\n\t\tthis.slerp( q, t );\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\treturn this.set( 0, 0, 0, 1 );\n\n\t}\n\n\tinvert() {\n\n\t\t// quaternion is assumed to have unit length\n\n\t\treturn this.conjugate();\n\n\t}\n\n\tconjugate() {\n\n\t\tthis._x *= - 1;\n\t\tthis._y *= - 1;\n\t\tthis._z *= - 1;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\n\n\t}\n\n\tnormalize() {\n\n\t\tlet l = this.length();\n\n\t\tif ( l === 0 ) {\n\n\t\t\tthis._x = 0;\n\t\t\tthis._y = 0;\n\t\t\tthis._z = 0;\n\t\t\tthis._w = 1;\n\n\t\t} else {\n\n\t\t\tl = 1 / l;\n\n\t\t\tthis._x = this._x * l;\n\t\t\tthis._y = this._y * l;\n\t\t\tthis._z = this._z * l;\n\t\t\tthis._w = this._w * l;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( this, q );\n\n\t}\n\n\tpremultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( q, this );\n\n\t}\n\n\tmultiplyQuaternions( a, b ) {\n\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n\t\tconst qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\n\t\tconst qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\n\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerp( qb, t ) {\n\n\t\tif ( t === 0 ) return this;\n\t\tif ( t === 1 ) return this.copy( qb );\n\n\t\tconst x = this._x, y = this._y, z = this._z, w = this._w;\n\n\t\t// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n\t\tlet cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\n\n\t\tif ( cosHalfTheta < 0 ) {\n\n\t\t\tthis._w = - qb._w;\n\t\t\tthis._x = - qb._x;\n\t\t\tthis._y = - qb._y;\n\t\t\tthis._z = - qb._z;\n\n\t\t\tcosHalfTheta = - cosHalfTheta;\n\n\t\t} else {\n\n\t\t\tthis.copy( qb );\n\n\t\t}\n\n\t\tif ( cosHalfTheta >= 1.0 ) {\n\n\t\t\tthis._w = w;\n\t\t\tthis._x = x;\n\t\t\tthis._y = y;\n\t\t\tthis._z = z;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\n\n\t\tif ( sqrSinHalfTheta <= Number.EPSILON ) {\n\n\t\t\tconst s = 1 - t;\n\t\t\tthis._w = s * w + t * this._w;\n\t\t\tthis._x = s * x + t * this._x;\n\t\t\tthis._y = s * y + t * this._y;\n\t\t\tthis._z = s * z + t * this._z;\n\n\t\t\tthis.normalize(); // normalize calls _onChangeCallback()\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sinHalfTheta = Math.sqrt( sqrSinHalfTheta );\n\t\tconst halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );\n\t\tconst ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n\t\t\tratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n\t\tthis._w = ( w * ratioA + this._w * ratioB );\n\t\tthis._x = ( x * ratioA + this._x * ratioB );\n\t\tthis._y = ( y * ratioA + this._y * ratioB );\n\t\tthis._z = ( z * ratioA + this._z * ratioB );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerpQuaternions( qa, qb, t ) {\n\n\t\treturn this.copy( qa ).slerp( qb, t );\n\n\t}\n\n\trandom() {\n\n\t\t// sets this quaternion to a uniform random unit quaternnion\n\n\t\t// Ken Shoemake\n\t\t// Uniform random rotations\n\t\t// D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.\n\n\t\tconst theta1 = 2 * Math.PI * Math.random();\n\t\tconst theta2 = 2 * Math.PI * Math.random();\n\n\t\tconst x0 = Math.random();\n\t\tconst r1 = Math.sqrt( 1 - x0 );\n\t\tconst r2 = Math.sqrt( x0 );\n\n\t\treturn this.set(\n\t\t\tr1 * Math.sin( theta1 ),\n\t\t\tr1 * Math.cos( theta1 ),\n\t\t\tr2 * Math.sin( theta2 ),\n\t\t\tr2 * Math.cos( theta2 ),\n\t\t);\n\n\t}\n\n\tequals( quaternion ) {\n\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis._x = array[ offset ];\n\t\tthis._y = array[ offset + 1 ];\n\t\tthis._z = array[ offset + 2 ];\n\t\tthis._w = array[ offset + 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis._x = attribute.getX( index );\n\t\tthis._y = attribute.getY( index );\n\t\tthis._z = attribute.getZ( index );\n\t\tthis._w = attribute.getW( index );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.toArray();\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._w;\n\n\t}\n\n}\n\nclass Vector3 {\n\n\tconstructor( x = 0, y = 0, z = 0 ) {\n\n\t\tVector3.prototype.isVector3 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t}\n\n\tset( x, y, z ) {\n\n\t\tif ( z === undefined ) z = this.z; // sprite.scale.set(x,y)\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyVectors( a, b ) {\n\n\t\tthis.x = a.x * b.x;\n\t\tthis.y = a.y * b.y;\n\t\tthis.z = a.z * b.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyEuler( euler ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromEuler( euler ) );\n\n\t}\n\n\tapplyAxisAngle( axis, angle ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromAxisAngle( axis, angle ) );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\treturn this.applyMatrix3( m ).normalize();\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tconst w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );\n\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t// quaternion q is assumed to have unit length\n\n\t\tconst vx = this.x, vy = this.y, vz = this.z;\n\t\tconst qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n\n\t\t// t = 2 * cross( q.xyz, v );\n\t\tconst tx = 2 * ( qy * vz - qz * vy );\n\t\tconst ty = 2 * ( qz * vx - qx * vz );\n\t\tconst tz = 2 * ( qx * vy - qy * vx );\n\n\t\t// v + q.w * t + cross( q.xyz, t );\n\t\tthis.x = vx + qw * tx + qy * tz - qz * ty;\n\t\tthis.y = vy + qw * ty + qz * tx - qx * tz;\n\t\tthis.z = vz + qw * tz + qx * ty - qy * tx;\n\n\t\treturn this;\n\n\t}\n\n\tproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );\n\n\t}\n\n\tunproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\t// input: THREE.Matrix4 affine matrix\n\t\t// vector interpreted as a direction\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\n\n\t\treturn this.normalize();\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\n\n\t}\n\n\t// TODO lengthSquared?\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.crossVectors( this, v );\n\n\t}\n\n\tcrossVectors( a, b ) {\n\n\t\tconst ax = a.x, ay = a.y, az = a.z;\n\t\tconst bx = b.x, by = b.y, bz = b.z;\n\n\t\tthis.x = ay * bz - az * by;\n\t\tthis.y = az * bx - ax * bz;\n\t\tthis.z = ax * by - ay * bx;\n\n\t\treturn this;\n\n\t}\n\n\tprojectOnVector( v ) {\n\n\t\tconst denominator = v.lengthSq();\n\n\t\tif ( denominator === 0 ) return this.set( 0, 0, 0 );\n\n\t\tconst scalar = v.dot( this ) / denominator;\n\n\t\treturn this.copy( v ).multiplyScalar( scalar );\n\n\t}\n\n\tprojectOnPlane( planeNormal ) {\n\n\t\t_vector$c.copy( this ).projectOnVector( planeNormal );\n\n\t\treturn this.sub( _vector$c );\n\n\t}\n\n\treflect( normal ) {\n\n\t\t// reflect incident vector off plane orthogonal to normal\n\t\t// normal is assumed to have unit length\n\n\t\treturn this.sub( _vector$c.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\n\n\t\treturn dx * dx + dy * dy + dz * dz;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );\n\n\t}\n\n\tsetFromSpherical( s ) {\n\n\t\treturn this.setFromSphericalCoords( s.radius, s.phi, s.theta );\n\n\t}\n\n\tsetFromSphericalCoords( radius, phi, theta ) {\n\n\t\tconst sinPhiRadius = Math.sin( phi ) * radius;\n\n\t\tthis.x = sinPhiRadius * Math.sin( theta );\n\t\tthis.y = Math.cos( phi ) * radius;\n\t\tthis.z = sinPhiRadius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCylindrical( c ) {\n\n\t\treturn this.setFromCylindricalCoords( c.radius, c.theta, c.y );\n\n\t}\n\n\tsetFromCylindricalCoords( radius, theta, y ) {\n\n\t\tthis.x = radius * Math.sin( theta );\n\t\tthis.y = y;\n\t\tthis.z = radius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixScale( m ) {\n\n\t\tconst sx = this.setFromMatrixColumn( m, 0 ).length();\n\t\tconst sy = this.setFromMatrixColumn( m, 1 ).length();\n\t\tconst sz = this.setFromMatrixColumn( m, 2 ).length();\n\n\t\tthis.x = sx;\n\t\tthis.y = sy;\n\t\tthis.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixColumn( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 4 );\n\n\t}\n\n\tsetFromMatrix3Column( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 3 );\n\n\t}\n\n\tsetFromEuler( e ) {\n\n\t\tthis.x = e._x;\n\t\tthis.y = e._y;\n\t\tthis.z = e._z;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromColor( c ) {\n\n\t\tthis.x = c.r;\n\t\tthis.y = c.g;\n\t\tthis.z = c.b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\trandomDirection() {\n\n\t\t// https://mathworld.wolfram.com/SpherePointPicking.html\n\n\t\tconst theta = Math.random() * Math.PI * 2;\n\t\tconst u = Math.random() * 2 - 1;\n\t\tconst c = Math.sqrt( 1 - u * u );\n\n\t\tthis.x = c * Math.cos( theta );\n\t\tthis.y = u;\n\t\tthis.z = c * Math.sin( theta );\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\n\t}\n\n}\n\nconst _vector$c = /*@__PURE__*/ new Vector3();\nconst _quaternion$4 = /*@__PURE__*/ new Quaternion();\n\nclass Box3 {\n\n\tconstructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox3 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromArray( array ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = array.length; i < il; i += 3 ) {\n\n\t\t\tthis.expandByPoint( _vector$b.fromArray( array, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromBufferAttribute( attribute ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = attribute.count; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( _vector$b.fromBufferAttribute( attribute, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$b.copy( size ).multiplyScalar( 0.5 );\n\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromObject( object, precise = false ) {\n\n\t\tthis.makeEmpty();\n\n\t\treturn this.expandByObject( object, precise );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = this.min.z = + Infinity;\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\texpandByObject( object, precise = false ) {\n\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\n\t\t// accounting for both the object's, and children's, world transforms\n\n\t\tobject.updateWorldMatrix( false, false );\n\n\t\tconst geometry = object.geometry;\n\n\t\tif ( geometry !== undefined ) {\n\n\t\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\t\t// precise AABB computation based on vertex data requires at least a position attribute.\n\t\t\t// instancing isn't supported so far and uses the normal (conservative) code path.\n\n\t\t\tif ( precise === true && positionAttribute !== undefined && object.isInstancedMesh !== true ) {\n\n\t\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t\tif ( object.isMesh === true ) {\n\n\t\t\t\t\t\tobject.getVertexPosition( i, _vector$b );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_vector$b.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_vector$b.applyMatrix4( object.matrixWorld );\n\t\t\t\t\tthis.expandByPoint( _vector$b );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( object.boundingBox !== undefined ) {\n\n\t\t\t\t\t// object-level bounding box\n\n\t\t\t\t\tif ( object.boundingBox === null ) {\n\n\t\t\t\t\t\tobject.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$4.copy( object.boundingBox );\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// geometry-level bounding box\n\n\t\t\t\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\t\t\t\tgeometry.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$4.copy( geometry.boundingBox );\n\n\t\t\t\t}\n\n\t\t\t\t_box$4.applyMatrix4( object.matrixWorld );\n\n\t\t\t\tthis.union( _box$4 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tthis.expandByObject( children[ i ], precise );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ||\n\t\t\tpoint.z < this.min.z || point.z > this.max.z ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y &&\n\t\t\tthis.min.z <= box.min.z && box.max.z <= this.max.z;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 6 splitting planes to rule out intersections.\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ||\n\t\t\tbox.max.z < this.min.z || box.min.z > this.max.z ? false : true;\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\t// Find the point on the AABB closest to the sphere center.\n\t\tthis.clampPoint( sphere.center, _vector$b );\n\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\n\t\treturn _vector$b.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// We compute the minimum and maximum dot product values. If those values\n\t\t// are on the same side (back or front) of the plane, then there is no intersection.\n\n\t\tlet min, max;\n\n\t\tif ( plane.normal.x > 0 ) {\n\n\t\t\tmin = plane.normal.x * this.min.x;\n\t\t\tmax = plane.normal.x * this.max.x;\n\n\t\t} else {\n\n\t\t\tmin = plane.normal.x * this.max.x;\n\t\t\tmax = plane.normal.x * this.min.x;\n\n\t\t}\n\n\t\tif ( plane.normal.y > 0 ) {\n\n\t\t\tmin += plane.normal.y * this.min.y;\n\t\t\tmax += plane.normal.y * this.max.y;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.y * this.max.y;\n\t\t\tmax += plane.normal.y * this.min.y;\n\n\t\t}\n\n\t\tif ( plane.normal.z > 0 ) {\n\n\t\t\tmin += plane.normal.z * this.min.z;\n\t\t\tmax += plane.normal.z * this.max.z;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.z * this.max.z;\n\t\t\tmax += plane.normal.z * this.min.z;\n\n\t\t}\n\n\t\treturn ( min <= - plane.constant && max >= - plane.constant );\n\n\t}\n\n\tintersectsTriangle( triangle ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// compute box center and extents\n\t\tthis.getCenter( _center );\n\t\t_extents.subVectors( this.max, _center );\n\n\t\t// translate triangle to aabb origin\n\t\t_v0$2.subVectors( triangle.a, _center );\n\t\t_v1$7.subVectors( triangle.b, _center );\n\t\t_v2$4.subVectors( triangle.c, _center );\n\n\t\t// compute edge vectors for triangle\n\t\t_f0.subVectors( _v1$7, _v0$2 );\n\t\t_f1.subVectors( _v2$4, _v1$7 );\n\t\t_f2.subVectors( _v0$2, _v2$4 );\n\n\t\t// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n\t\t// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n\t\t// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n\t\tlet axes = [\n\t\t\t0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,\n\t\t\t_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,\n\t\t\t- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0\n\t\t];\n\t\tif ( ! satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// test 3 face normals from the aabb\n\t\taxes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];\n\t\tif ( ! satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// finally testing the face normal of the triangle\n\t\t// use already existing triangle edge vectors here\n\t\t_triangleNormal.crossVectors( _f0, _f1 );\n\t\taxes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];\n\n\t\treturn satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents );\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$b ).distanceTo( point );\n\n\t}\n\n\tgetBoundingSphere( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\ttarget.makeEmpty();\n\n\t\t} else {\n\n\t\t\tthis.getCenter( target.center );\n\n\t\t\ttarget.radius = this.getSize( _vector$b ).length() * 0.5;\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\t// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\t// transform of empty box is an empty box.\n\t\tif ( this.isEmpty() ) return this;\n\n\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\n\t\t_points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\n\t\t_points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\n\t\t_points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\n\t\t_points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\n\t\t_points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\n\t\t_points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\n\t\t_points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\n\t\t_points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\n\n\t\tthis.setFromPoints( _points );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _points = [\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3()\n];\n\nconst _vector$b = /*@__PURE__*/ new Vector3();\n\nconst _box$4 = /*@__PURE__*/ new Box3();\n\n// triangle centered vertices\n\nconst _v0$2 = /*@__PURE__*/ new Vector3();\nconst _v1$7 = /*@__PURE__*/ new Vector3();\nconst _v2$4 = /*@__PURE__*/ new Vector3();\n\n// triangle edge vectors\n\nconst _f0 = /*@__PURE__*/ new Vector3();\nconst _f1 = /*@__PURE__*/ new Vector3();\nconst _f2 = /*@__PURE__*/ new Vector3();\n\nconst _center = /*@__PURE__*/ new Vector3();\nconst _extents = /*@__PURE__*/ new Vector3();\nconst _triangleNormal = /*@__PURE__*/ new Vector3();\nconst _testAxis = /*@__PURE__*/ new Vector3();\n\nfunction satForAxes( axes, v0, v1, v2, extents ) {\n\n\tfor ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {\n\n\t\t_testAxis.fromArray( axes, i );\n\t\t// project the aabb onto the separating axis\n\t\tconst r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );\n\t\t// project all 3 vertices of the triangle onto the separating axis\n\t\tconst p0 = v0.dot( _testAxis );\n\t\tconst p1 = v1.dot( _testAxis );\n\t\tconst p2 = v2.dot( _testAxis );\n\t\t// actual test, basically see if either of the most extreme of the triangle points intersects r\n\t\tif ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {\n\n\t\t\t// points of the projected triangle are outside the projected half-length of the aabb\n\t\t\t// the axis is separating and we can exit\n\t\t\treturn false;\n\n\t\t}\n\n\t}\n\n\treturn true;\n\n}\n\nconst _box$3 = /*@__PURE__*/ new Box3();\nconst _v1$6 = /*@__PURE__*/ new Vector3();\nconst _v2$3 = /*@__PURE__*/ new Vector3();\n\nclass Sphere {\n\n\tconstructor( center = new Vector3(), radius = - 1 ) {\n\n\t\tthis.isSphere = true;\n\n\t\tthis.center = center;\n\t\tthis.radius = radius;\n\n\t}\n\n\tset( center, radius ) {\n\n\t\tthis.center.copy( center );\n\t\tthis.radius = radius;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points, optionalCenter ) {\n\n\t\tconst center = this.center;\n\n\t\tif ( optionalCenter !== undefined ) {\n\n\t\t\tcenter.copy( optionalCenter );\n\n\t\t} else {\n\n\t\t\t_box$3.setFromPoints( points ).getCenter( center );\n\n\t\t}\n\n\t\tlet maxRadiusSq = 0;\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\n\n\t\t}\n\n\t\tthis.radius = Math.sqrt( maxRadiusSq );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( sphere ) {\n\n\t\tthis.center.copy( sphere.center );\n\t\tthis.radius = sphere.radius;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\treturn ( this.radius < 0 );\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.center.set( 0, 0, 0 );\n\t\tthis.radius = - 1;\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst radiusSum = this.radius + sphere.radius;\n\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsSphere( this );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\treturn Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\tconst deltaLengthSq = this.center.distanceToSquared( point );\n\n\t\ttarget.copy( point );\n\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\ttarget.sub( this.center ).normalize();\n\t\t\ttarget.multiplyScalar( this.radius ).add( this.center );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\t// Empty sphere produces empty bounding box\n\t\t\ttarget.makeEmpty();\n\t\t\treturn target;\n\n\t\t}\n\n\t\ttarget.set( this.center, this.center );\n\t\ttarget.expandByScalar( this.radius );\n\n\t\treturn target;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.center.applyMatrix4( matrix );\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.center.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.center.copy( point );\n\n\t\t\tthis.radius = 0;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\t_v1$6.subVectors( point, this.center );\n\n\t\tconst lengthSq = _v1$6.lengthSq();\n\n\t\tif ( lengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\t// calculate the minimal sphere\n\n\t\t\tconst length = Math.sqrt( lengthSq );\n\n\t\t\tconst delta = ( length - this.radius ) * 0.5;\n\n\t\t\tthis.center.addScaledVector( _v1$6, delta / length );\n\n\t\t\tthis.radius += delta;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tunion( sphere ) {\n\n\t\tif ( sphere.isEmpty() ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.copy( sphere );\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.center.equals( sphere.center ) === true ) {\n\n\t\t\t this.radius = Math.max( this.radius, sphere.radius );\n\n\t\t} else {\n\n\t\t\t_v2$3.subVectors( sphere.center, this.center ).setLength( sphere.radius );\n\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).add( _v2$3 ) );\n\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).sub( _v2$3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sphere ) {\n\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$a = /*@__PURE__*/ new Vector3();\nconst _segCenter = /*@__PURE__*/ new Vector3();\nconst _segDir = /*@__PURE__*/ new Vector3();\nconst _diff = /*@__PURE__*/ new Vector3();\n\nconst _edge1 = /*@__PURE__*/ new Vector3();\nconst _edge2 = /*@__PURE__*/ new Vector3();\nconst _normal$1 = /*@__PURE__*/ new Vector3();\n\nclass Ray {\n\n\tconstructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) {\n\n\t\tthis.origin = origin;\n\t\tthis.direction = direction;\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\tthis.origin.copy( origin );\n\t\tthis.direction.copy( direction );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( ray ) {\n\n\t\tthis.origin.copy( ray.origin );\n\t\tthis.direction.copy( ray.direction );\n\n\t\treturn this;\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, t );\n\n\t}\n\n\tlookAt( v ) {\n\n\t\tthis.direction.copy( v ).sub( this.origin ).normalize();\n\n\t\treturn this;\n\n\t}\n\n\trecast( t ) {\n\n\t\tthis.origin.copy( this.at( t, _vector$a ) );\n\n\t\treturn this;\n\n\t}\n\n\tclosestPointToPoint( point, target ) {\n\n\t\ttarget.subVectors( point, this.origin );\n\n\t\tconst directionDistance = target.dot( this.direction );\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn target.copy( this.origin );\n\n\t\t}\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn Math.sqrt( this.distanceSqToPoint( point ) );\n\n\t}\n\n\tdistanceSqToPoint( point ) {\n\n\t\tconst directionDistance = _vector$a.subVectors( point, this.origin ).dot( this.direction );\n\n\t\t// point behind the ray\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn this.origin.distanceToSquared( point );\n\n\t\t}\n\n\t\t_vector$a.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t\treturn _vector$a.distanceToSquared( point );\n\n\t}\n\n\tdistanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h\n\t\t// It returns the min distance between the ray and the segment\n\t\t// defined by v0 and v1\n\t\t// It can also set two optional targets :\n\t\t// - The closest point on the ray\n\t\t// - The closest point on the segment\n\n\t\t_segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\n\t\t_segDir.copy( v1 ).sub( v0 ).normalize();\n\t\t_diff.copy( this.origin ).sub( _segCenter );\n\n\t\tconst segExtent = v0.distanceTo( v1 ) * 0.5;\n\t\tconst a01 = - this.direction.dot( _segDir );\n\t\tconst b0 = _diff.dot( this.direction );\n\t\tconst b1 = - _diff.dot( _segDir );\n\t\tconst c = _diff.lengthSq();\n\t\tconst det = Math.abs( 1 - a01 * a01 );\n\t\tlet s0, s1, sqrDist, extDet;\n\n\t\tif ( det > 0 ) {\n\n\t\t\t// The ray and segment are not parallel.\n\n\t\t\ts0 = a01 * b1 - b0;\n\t\t\ts1 = a01 * b0 - b1;\n\t\t\textDet = segExtent * det;\n\n\t\t\tif ( s0 >= 0 ) {\n\n\t\t\t\tif ( s1 >= - extDet ) {\n\n\t\t\t\t\tif ( s1 <= extDet ) {\n\n\t\t\t\t\t\t// region 0\n\t\t\t\t\t\t// Minimum at interior points of ray and segment.\n\n\t\t\t\t\t\tconst invDet = 1 / det;\n\t\t\t\t\t\ts0 *= invDet;\n\t\t\t\t\t\ts1 *= invDet;\n\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// region 1\n\n\t\t\t\t\t\ts1 = segExtent;\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 5\n\n\t\t\t\t\ts1 = - segExtent;\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( s1 <= - extDet ) {\n\n\t\t\t\t\t// region 4\n\n\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else if ( s1 <= extDet ) {\n\n\t\t\t\t\t// region 3\n\n\t\t\t\t\ts0 = 0;\n\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 2\n\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// Ray and segment are parallel.\n\n\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\n\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t}\n\n\t\tif ( optionalPointOnRay ) {\n\n\t\t\toptionalPointOnRay.copy( this.origin ).addScaledVector( this.direction, s0 );\n\n\t\t}\n\n\t\tif ( optionalPointOnSegment ) {\n\n\t\t\toptionalPointOnSegment.copy( _segCenter ).addScaledVector( _segDir, s1 );\n\n\t\t}\n\n\t\treturn sqrDist;\n\n\t}\n\n\tintersectSphere( sphere, target ) {\n\n\t\t_vector$a.subVectors( sphere.center, this.origin );\n\t\tconst tca = _vector$a.dot( this.direction );\n\t\tconst d2 = _vector$a.dot( _vector$a ) - tca * tca;\n\t\tconst radius2 = sphere.radius * sphere.radius;\n\n\t\tif ( d2 > radius2 ) return null;\n\n\t\tconst thc = Math.sqrt( radius2 - d2 );\n\n\t\t// t0 = first intersect point - entrance on front of sphere\n\t\tconst t0 = tca - thc;\n\n\t\t// t1 = second intersect point - exit point on back of sphere\n\t\tconst t1 = tca + thc;\n\n\t\t// test to see if t1 is behind the ray - if so, return null\n\t\tif ( t1 < 0 ) return null;\n\n\t\t// test to see if t0 is behind the ray:\n\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n\t\t// in order to always return an intersect point that is in front of the ray.\n\t\tif ( t0 < 0 ) return this.at( t1, target );\n\n\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0\n\t\treturn this.at( t0, target );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tdistanceToPlane( plane ) {\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( plane.distanceToPoint( this.origin ) === 0 ) {\n\n\t\t\t\treturn 0;\n\n\t\t\t}\n\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\n\n\t\t// Return if the ray never intersects the plane\n\n\t\treturn t >= 0 ? t : null;\n\n\t}\n\n\tintersectPlane( plane, target ) {\n\n\t\tconst t = this.distanceToPlane( plane );\n\n\t\tif ( t === null ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn this.at( t, target );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// check if the ray lies on the plane first\n\n\t\tconst distToPoint = plane.distanceToPoint( this.origin );\n\n\t\tif ( distToPoint === 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator * distToPoint < 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\t// ray origin is behind the plane (and is pointing behind it)\n\n\t\treturn false;\n\n\t}\n\n\tintersectBox( box, target ) {\n\n\t\tlet tmin, tmax, tymin, tymax, tzmin, tzmax;\n\n\t\tconst invdirx = 1 / this.direction.x,\n\t\t\tinvdiry = 1 / this.direction.y,\n\t\t\tinvdirz = 1 / this.direction.z;\n\n\t\tconst origin = this.origin;\n\n\t\tif ( invdirx >= 0 ) {\n\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\n\n\t\t} else {\n\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\n\n\t\t}\n\n\t\tif ( invdiry >= 0 ) {\n\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\n\n\t\t} else {\n\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\n\n\t\t}\n\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\n\n\t\tif ( tymin > tmin || isNaN( tmin ) ) tmin = tymin;\n\n\t\tif ( tymax < tmax || isNaN( tmax ) ) tmax = tymax;\n\n\t\tif ( invdirz >= 0 ) {\n\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\n\n\t\t} else {\n\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\n\n\t\t}\n\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\n\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\n\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\n\n\t\t//return point closest to the ray (positive side)\n\n\t\tif ( tmax < 0 ) return null;\n\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, target );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn this.intersectBox( box, _vector$a ) !== null;\n\n\t}\n\n\tintersectTriangle( a, b, c, backfaceCulling, target ) {\n\n\t\t// Compute the offset origin, edges, and normal.\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n\n\t\t_edge1.subVectors( b, a );\n\t\t_edge2.subVectors( c, a );\n\t\t_normal$1.crossVectors( _edge1, _edge2 );\n\n\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n\t\tlet DdN = this.direction.dot( _normal$1 );\n\t\tlet sign;\n\n\t\tif ( DdN > 0 ) {\n\n\t\t\tif ( backfaceCulling ) return null;\n\t\t\tsign = 1;\n\n\t\t} else if ( DdN < 0 ) {\n\n\t\t\tsign = - 1;\n\t\t\tDdN = - DdN;\n\n\t\t} else {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t_diff.subVectors( this.origin, a );\n\t\tconst DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );\n\n\t\t// b1 < 0, no intersection\n\t\tif ( DdQxE2 < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );\n\n\t\t// b2 < 0, no intersection\n\t\tif ( DdE1xQ < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// b1+b2 > 1, no intersection\n\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Line intersects triangle, check if ray does.\n\t\tconst QdN = - sign * _diff.dot( _normal$1 );\n\n\t\t// t < 0, no intersection\n\t\tif ( QdN < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Ray intersects triangle.\n\t\treturn this.at( QdN / DdN, target );\n\n\t}\n\n\tapplyMatrix4( matrix4 ) {\n\n\t\tthis.origin.applyMatrix4( matrix4 );\n\t\tthis.direction.transformDirection( matrix4 );\n\n\t\treturn this;\n\n\t}\n\n\tequals( ray ) {\n\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass Matrix4 {\n\n\tconstructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tMatrix4.prototype.isMatrix4 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Matrix4().fromArray( this.elements );\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];\n\t\tte[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];\n\t\tte[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];\n\t\tte[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\tcopyPosition( m ) {\n\n\t\tconst te = this.elements, me = m.elements;\n\n\t\tte[ 12 ] = me[ 12 ];\n\t\tte[ 13 ] = me[ 13 ];\n\t\tte[ 14 ] = me[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix3( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 3 ], me[ 6 ], 0,\n\t\t\tme[ 1 ], me[ 4 ], me[ 7 ], 0,\n\t\t\tme[ 2 ], me[ 5 ], me[ 8 ], 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrixColumn( this, 0 );\n\t\tyAxis.setFromMatrixColumn( this, 1 );\n\t\tzAxis.setFromMatrixColumn( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmakeBasis( xAxis, yAxis, zAxis ) {\n\n\t\tthis.set(\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\n\t\t\t0, 0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractRotation( m ) {\n\n\t\t// this method does not support reflection matrices\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tconst scaleX = 1 / _v1$5.setFromMatrixColumn( m, 0 ).length();\n\t\tconst scaleY = 1 / _v1$5.setFromMatrixColumn( m, 1 ).length();\n\t\tconst scaleZ = 1 / _v1$5.setFromMatrixColumn( m, 2 ).length();\n\n\t\tte[ 0 ] = me[ 0 ] * scaleX;\n\t\tte[ 1 ] = me[ 1 ] * scaleX;\n\t\tte[ 2 ] = me[ 2 ] * scaleX;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = me[ 4 ] * scaleY;\n\t\tte[ 5 ] = me[ 5 ] * scaleY;\n\t\tte[ 6 ] = me[ 6 ] * scaleY;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = me[ 8 ] * scaleZ;\n\t\tte[ 9 ] = me[ 9 ] * scaleZ;\n\t\tte[ 10 ] = me[ 10 ] * scaleZ;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromEuler( euler ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = euler.x, y = euler.y, z = euler.z;\n\t\tconst a = Math.cos( x ), b = Math.sin( x );\n\t\tconst c = Math.cos( y ), d = Math.sin( y );\n\t\tconst e = Math.cos( z ), f = Math.sin( z );\n\n\t\tif ( euler.order === 'XYZ' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - c * f;\n\t\t\tte[ 8 ] = d;\n\n\t\t\tte[ 1 ] = af + be * d;\n\t\t\tte[ 5 ] = ae - bf * d;\n\t\t\tte[ 9 ] = - b * c;\n\n\t\t\tte[ 2 ] = bf - ae * d;\n\t\t\tte[ 6 ] = be + af * d;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YXZ' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce + df * b;\n\t\t\tte[ 4 ] = de * b - cf;\n\t\t\tte[ 8 ] = a * d;\n\n\t\t\tte[ 1 ] = a * f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b;\n\n\t\t\tte[ 2 ] = cf * b - de;\n\t\t\tte[ 6 ] = df + ce * b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZXY' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce - df * b;\n\t\t\tte[ 4 ] = - a * f;\n\t\t\tte[ 8 ] = de + cf * b;\n\n\t\t\tte[ 1 ] = cf + de * b;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = df - ce * b;\n\n\t\t\tte[ 2 ] = - a * d;\n\t\t\tte[ 6 ] = b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZYX' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = be * d - af;\n\t\t\tte[ 8 ] = ae * d + bf;\n\n\t\t\tte[ 1 ] = c * f;\n\t\t\tte[ 5 ] = bf * d + ae;\n\t\t\tte[ 9 ] = af * d - be;\n\n\t\t\tte[ 2 ] = - d;\n\t\t\tte[ 6 ] = b * c;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YZX' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = bd - ac * f;\n\t\t\tte[ 8 ] = bc * f + ad;\n\n\t\t\tte[ 1 ] = f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b * e;\n\n\t\t\tte[ 2 ] = - d * e;\n\t\t\tte[ 6 ] = ad * f + bc;\n\t\t\tte[ 10 ] = ac - bd * f;\n\n\t\t} else if ( euler.order === 'XZY' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - f;\n\t\t\tte[ 8 ] = d * e;\n\n\t\t\tte[ 1 ] = ac * f + bd;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = ad * f - bc;\n\n\t\t\tte[ 2 ] = bc * f - ad;\n\t\t\tte[ 6 ] = b * e;\n\t\t\tte[ 10 ] = bd * f + ac;\n\n\t\t}\n\n\t\t// bottom row\n\t\tte[ 3 ] = 0;\n\t\tte[ 7 ] = 0;\n\t\tte[ 11 ] = 0;\n\n\t\t// last column\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromQuaternion( q ) {\n\n\t\treturn this.compose( _zero, q, _one );\n\n\t}\n\n\tlookAt( eye, target, up ) {\n\n\t\tconst te = this.elements;\n\n\t\t_z.subVectors( eye, target );\n\n\t\tif ( _z.lengthSq() === 0 ) {\n\n\t\t\t// eye and target are in the same position\n\n\t\t\t_z.z = 1;\n\n\t\t}\n\n\t\t_z.normalize();\n\t\t_x.crossVectors( up, _z );\n\n\t\tif ( _x.lengthSq() === 0 ) {\n\n\t\t\t// up and z are parallel\n\n\t\t\tif ( Math.abs( up.z ) === 1 ) {\n\n\t\t\t\t_z.x += 0.0001;\n\n\t\t\t} else {\n\n\t\t\t\t_z.z += 0.0001;\n\n\t\t\t}\n\n\t\t\t_z.normalize();\n\t\t\t_x.crossVectors( up, _z );\n\n\t\t}\n\n\t\t_x.normalize();\n\t\t_y.crossVectors( _z, _x );\n\n\t\tte[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;\n\t\tte[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;\n\t\tte[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\n\t\tconst a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\n\t\tconst b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\n\t\tconst n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\n\t\tconst n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\n\t\tconst n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\n\n\t\t//TODO: make this more efficient\n\t\t//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\n\n\t\treturn (\n\t\t\tn41 * (\n\t\t\t\t+ n14 * n23 * n32\n\t\t\t\t - n13 * n24 * n32\n\t\t\t\t - n14 * n22 * n33\n\t\t\t\t + n12 * n24 * n33\n\t\t\t\t + n13 * n22 * n34\n\t\t\t\t - n12 * n23 * n34\n\t\t\t) +\n\t\t\tn42 * (\n\t\t\t\t+ n11 * n23 * n34\n\t\t\t\t - n11 * n24 * n33\n\t\t\t\t + n14 * n21 * n33\n\t\t\t\t - n13 * n21 * n34\n\t\t\t\t + n13 * n24 * n31\n\t\t\t\t - n14 * n23 * n31\n\t\t\t) +\n\t\t\tn43 * (\n\t\t\t\t+ n11 * n24 * n32\n\t\t\t\t - n11 * n22 * n34\n\t\t\t\t - n14 * n21 * n32\n\t\t\t\t + n12 * n21 * n34\n\t\t\t\t + n14 * n22 * n31\n\t\t\t\t - n12 * n24 * n31\n\t\t\t) +\n\t\t\tn44 * (\n\t\t\t\t- n13 * n22 * n31\n\t\t\t\t - n11 * n23 * n32\n\t\t\t\t + n11 * n22 * n33\n\t\t\t\t + n13 * n21 * n32\n\t\t\t\t - n12 * n21 * n33\n\t\t\t\t + n12 * n23 * n31\n\t\t\t)\n\n\t\t);\n\n\t}\n\n\ttranspose() {\n\n\t\tconst te = this.elements;\n\t\tlet tmp;\n\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\n\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tsetPosition( x, y, z ) {\n\n\t\tconst te = this.elements;\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tte[ 12 ] = x.x;\n\t\t\tte[ 13 ] = x.y;\n\t\t\tte[ 14 ] = x.z;\n\n\t\t} else {\n\n\t\t\tte[ 12 ] = x;\n\t\t\tte[ 13 ] = y;\n\t\t\tte[ 14 ] = z;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tinvert() {\n\n\t\t// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],\n\t\t\tn12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],\n\t\t\tn13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],\n\t\t\tn14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],\n\n\t\t\tt11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,\n\t\t\tt12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,\n\t\t\tt13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,\n\t\t\tt14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\n\n\t\tconst det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;\n\t\tte[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;\n\t\tte[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;\n\n\t\tte[ 4 ] = t12 * detInv;\n\t\tte[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;\n\t\tte[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;\n\t\tte[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;\n\n\t\tte[ 8 ] = t13 * detInv;\n\t\tte[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;\n\t\tte[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;\n\t\tte[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;\n\n\t\tte[ 12 ] = t14 * detInv;\n\t\tte[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;\n\t\tte[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;\n\t\tte[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\tscale( v ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = v.x, y = v.y, z = v.z;\n\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxScaleOnAxis() {\n\n\t\tconst te = this.elements;\n\n\t\tconst scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\n\t\tconst scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\n\t\tconst scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\n\n\t\treturn Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );\n\n\t}\n\n\tmakeTranslation( x, y, z ) {\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x.x,\n\t\t\t\t0, 1, 0, x.y,\n\t\t\t\t0, 0, 1, x.z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x,\n\t\t\t\t0, 1, 0, y,\n\t\t\t\t0, 0, 1, z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationX( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, c, - s, 0,\n\t\t\t0, s, c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationY( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t c, 0, s, 0,\n\t\t\t 0, 1, 0, 0,\n\t\t\t- s, 0, c, 0,\n\t\t\t 0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationZ( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0, 0,\n\t\t\ts, c, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationAxis( axis, angle ) {\n\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\n\n\t\tconst c = Math.cos( angle );\n\t\tconst s = Math.sin( angle );\n\t\tconst t = 1 - c;\n\t\tconst x = axis.x, y = axis.y, z = axis.z;\n\t\tconst tx = t * x, ty = t * y;\n\n\t\tthis.set(\n\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0, 0,\n\t\t\t0, y, 0, 0,\n\t\t\t0, 0, z, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeShear( xy, xz, yx, yz, zx, zy ) {\n\n\t\tthis.set(\n\n\t\t\t1, yx, zx, 0,\n\t\t\txy, 1, zy, 0,\n\t\t\txz, yz, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\n\t\tconst x2 = x + x,\ty2 = y + y, z2 = z + z;\n\t\tconst xx = x * x2, xy = x * y2, xz = x * z2;\n\t\tconst yy = y * y2, yz = y * z2, zz = z * z2;\n\t\tconst wx = w * x2, wy = w * y2, wz = w * z2;\n\n\t\tconst sx = scale.x, sy = scale.y, sz = scale.z;\n\n\t\tte[ 0 ] = ( 1 - ( yy + zz ) ) * sx;\n\t\tte[ 1 ] = ( xy + wz ) * sx;\n\t\tte[ 2 ] = ( xz - wy ) * sx;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = ( xy - wz ) * sy;\n\t\tte[ 5 ] = ( 1 - ( xx + zz ) ) * sy;\n\t\tte[ 6 ] = ( yz + wx ) * sy;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = ( xz + wy ) * sz;\n\t\tte[ 9 ] = ( yz - wx ) * sz;\n\t\tte[ 10 ] = ( 1 - ( xx + yy ) ) * sz;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = position.x;\n\t\tte[ 13 ] = position.y;\n\t\tte[ 14 ] = position.z;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tdecompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tlet sx = _v1$5.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\n\t\tconst sy = _v1$5.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\n\t\tconst sz = _v1$5.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\n\n\t\t// if determine is negative, we need to invert one scale\n\t\tconst det = this.determinant();\n\t\tif ( det < 0 ) sx = - sx;\n\n\t\tposition.x = te[ 12 ];\n\t\tposition.y = te[ 13 ];\n\t\tposition.z = te[ 14 ];\n\n\t\t// scale the rotation part\n\t\t_m1$4.copy( this );\n\n\t\tconst invSX = 1 / sx;\n\t\tconst invSY = 1 / sy;\n\t\tconst invSZ = 1 / sz;\n\n\t\t_m1$4.elements[ 0 ] *= invSX;\n\t\t_m1$4.elements[ 1 ] *= invSX;\n\t\t_m1$4.elements[ 2 ] *= invSX;\n\n\t\t_m1$4.elements[ 4 ] *= invSY;\n\t\t_m1$4.elements[ 5 ] *= invSY;\n\t\t_m1$4.elements[ 6 ] *= invSY;\n\n\t\t_m1$4.elements[ 8 ] *= invSZ;\n\t\t_m1$4.elements[ 9 ] *= invSZ;\n\t\t_m1$4.elements[ 10 ] *= invSZ;\n\n\t\tquaternion.setFromRotationMatrix( _m1$4 );\n\n\t\tscale.x = sx;\n\t\tscale.y = sy;\n\t\tscale.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tmakePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = 2 * near / ( right - left );\n\t\tconst y = 2 * near / ( top - bottom );\n\n\t\tconst a = ( right + left ) / ( right - left );\n\t\tconst b = ( top + bottom ) / ( top - bottom );\n\n\t\tlet c, d;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tc = - ( far + near ) / ( far - near );\n\t\t\td = ( - 2 * far * near ) / ( far - near );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tc = - far / ( far - near );\n\t\t\td = ( - far * near ) / ( far - near );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a; \tte[ 12 ] = 0;\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b; \tte[ 13 ] = 0;\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c; \tte[ 14 ] = d;\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = - 1;\tte[ 15 ] = 0;\n\n\t\treturn this;\n\n\t}\n\n\tmakeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst w = 1.0 / ( right - left );\n\t\tconst h = 1.0 / ( top - bottom );\n\t\tconst p = 1.0 / ( far - near );\n\n\t\tconst x = ( right + left ) * w;\n\t\tconst y = ( top + bottom ) * h;\n\n\t\tlet z, zInv;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tz = ( far + near ) * p;\n\t\t\tzInv = - 2 * p;\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tz = near * p;\n\t\t\tzInv = - 1 * p;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = 2 * w;\tte[ 4 ] = 0;\t\tte[ 8 ] = 0; \t\tte[ 12 ] = - x;\n\t\tte[ 1 ] = 0; \t\tte[ 5 ] = 2 * h;\tte[ 9 ] = 0; \t\tte[ 13 ] = - y;\n\t\tte[ 2 ] = 0; \t\tte[ 6 ] = 0;\t\tte[ 10 ] = zInv;\tte[ 14 ] = - z;\n\t\tte[ 3 ] = 0; \t\tte[ 7 ] = 0;\t\tte[ 11 ] = 0;\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\t\tarray[ offset + 9 ] = te[ 9 ];\n\t\tarray[ offset + 10 ] = te[ 10 ];\n\t\tarray[ offset + 11 ] = te[ 11 ];\n\n\t\tarray[ offset + 12 ] = te[ 12 ];\n\t\tarray[ offset + 13 ] = te[ 13 ];\n\t\tarray[ offset + 14 ] = te[ 14 ];\n\t\tarray[ offset + 15 ] = te[ 15 ];\n\n\t\treturn array;\n\n\t}\n\n}\n\nconst _v1$5 = /*@__PURE__*/ new Vector3();\nconst _m1$4 = /*@__PURE__*/ new Matrix4();\nconst _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );\nconst _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );\nconst _x = /*@__PURE__*/ new Vector3();\nconst _y = /*@__PURE__*/ new Vector3();\nconst _z = /*@__PURE__*/ new Vector3();\n\nconst _matrix$2 = /*@__PURE__*/ new Matrix4();\nconst _quaternion$3 = /*@__PURE__*/ new Quaternion();\n\nclass Euler {\n\n\tconstructor( x = 0, y = 0, z = 0, order = Euler.DEFAULT_ORDER ) {\n\n\t\tthis.isEuler = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget order() {\n\n\t\treturn this._order;\n\n\t}\n\n\tset order( value ) {\n\n\t\tthis._order = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, order = this._order ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._order );\n\n\t}\n\n\tcopy( euler ) {\n\n\t\tthis._x = euler._x;\n\t\tthis._y = euler._y;\n\t\tthis._z = euler._z;\n\t\tthis._order = euler._order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m, order = this._order, update = true ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements;\n\t\tconst m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\n\t\tconst m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\n\t\tconst m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\n\t\t\t\tthis._y = Math.asin( clamp( m13, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m13 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\n\t\t\t\tthis._x = Math.asin( - clamp( m23, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m23 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\n\t\t\t\tthis._x = Math.asin( clamp( m32, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m32 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = 0;\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\n\t\t\t\tthis._y = Math.asin( - clamp( m31, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m31 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\n\t\t\t\tthis._z = Math.asin( clamp( m21, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m21 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m22 );\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\n\t\t\t\tthis._z = Math.asin( - clamp( m12, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m12 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._y = Math.atan2( m13, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._y = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tconsole.warn( 'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tthis._order = order;\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromQuaternion( q, order, update ) {\n\n\t\t_matrix$2.makeRotationFromQuaternion( q );\n\n\t\treturn this.setFromRotationMatrix( _matrix$2, order, update );\n\n\t}\n\n\tsetFromVector3( v, order = this._order ) {\n\n\t\treturn this.set( v.x, v.y, v.z, order );\n\n\t}\n\n\treorder( newOrder ) {\n\n\t\t// WARNING: this discards revolution information -bhouston\n\n\t\t_quaternion$3.setFromEuler( this );\n\n\t\treturn this.setFromQuaternion( _quaternion$3, newOrder );\n\n\t}\n\n\tequals( euler ) {\n\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\n\n\t}\n\n\tfromArray( array ) {\n\n\t\tthis._x = array[ 0 ];\n\t\tthis._y = array[ 1 ];\n\t\tthis._z = array[ 2 ];\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._order;\n\n\t\treturn array;\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._order;\n\n\t}\n\n}\n\nEuler.DEFAULT_ORDER = 'XYZ';\n\nclass Layers {\n\n\tconstructor() {\n\n\t\tthis.mask = 1 | 0;\n\n\t}\n\n\tset( channel ) {\n\n\t\tthis.mask = ( 1 << channel | 0 ) >>> 0;\n\n\t}\n\n\tenable( channel ) {\n\n\t\tthis.mask |= 1 << channel | 0;\n\n\t}\n\n\tenableAll() {\n\n\t\tthis.mask = 0xffffffff | 0;\n\n\t}\n\n\ttoggle( channel ) {\n\n\t\tthis.mask ^= 1 << channel | 0;\n\n\t}\n\n\tdisable( channel ) {\n\n\t\tthis.mask &= ~ ( 1 << channel | 0 );\n\n\t}\n\n\tdisableAll() {\n\n\t\tthis.mask = 0;\n\n\t}\n\n\ttest( layers ) {\n\n\t\treturn ( this.mask & layers.mask ) !== 0;\n\n\t}\n\n\tisEnabled( channel ) {\n\n\t\treturn ( this.mask & ( 1 << channel | 0 ) ) !== 0;\n\n\t}\n\n}\n\nlet _object3DId = 0;\n\nconst _v1$4 = /*@__PURE__*/ new Vector3();\nconst _q1 = /*@__PURE__*/ new Quaternion();\nconst _m1$3 = /*@__PURE__*/ new Matrix4();\nconst _target = /*@__PURE__*/ new Vector3();\n\nconst _position$3 = /*@__PURE__*/ new Vector3();\nconst _scale$2 = /*@__PURE__*/ new Vector3();\nconst _quaternion$2 = /*@__PURE__*/ new Quaternion();\n\nconst _xAxis = /*@__PURE__*/ new Vector3( 1, 0, 0 );\nconst _yAxis = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nconst _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );\n\nconst _addedEvent = { type: 'added' };\nconst _removedEvent = { type: 'removed' };\n\nconst _childaddedEvent = { type: 'childadded', child: null };\nconst _childremovedEvent = { type: 'childremoved', child: null };\n\nclass Object3D extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isObject3D = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _object3DId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Object3D';\n\n\t\tthis.parent = null;\n\t\tthis.children = [];\n\n\t\tthis.up = Object3D.DEFAULT_UP.clone();\n\n\t\tconst position = new Vector3();\n\t\tconst rotation = new Euler();\n\t\tconst quaternion = new Quaternion();\n\t\tconst scale = new Vector3( 1, 1, 1 );\n\n\t\tfunction onRotationChange() {\n\n\t\t\tquaternion.setFromEuler( rotation, false );\n\n\t\t}\n\n\t\tfunction onQuaternionChange() {\n\n\t\t\trotation.setFromQuaternion( quaternion, undefined, false );\n\n\t\t}\n\n\t\trotation._onChange( onRotationChange );\n\t\tquaternion._onChange( onQuaternionChange );\n\n\t\tObject.defineProperties( this, {\n\t\t\tposition: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: position\n\t\t\t},\n\t\t\trotation: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: rotation\n\t\t\t},\n\t\t\tquaternion: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: quaternion\n\t\t\t},\n\t\t\tscale: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: scale\n\t\t\t},\n\t\t\tmodelViewMatrix: {\n\t\t\t\tvalue: new Matrix4()\n\t\t\t},\n\t\t\tnormalMatrix: {\n\t\t\t\tvalue: new Matrix3()\n\t\t\t}\n\t\t} );\n\n\t\tthis.matrix = new Matrix4();\n\t\tthis.matrixWorld = new Matrix4();\n\n\t\tthis.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;\n\n\t\tthis.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\tthis.layers = new Layers();\n\t\tthis.visible = true;\n\n\t\tthis.castShadow = false;\n\t\tthis.receiveShadow = false;\n\n\t\tthis.frustumCulled = true;\n\t\tthis.renderOrder = 0;\n\n\t\tthis.animations = [];\n\n\t\tthis.userData = {};\n\n\t}\n\n\tonBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\n\n\tonAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tonAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tthis.matrix.premultiply( matrix );\n\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\tthis.quaternion.premultiply( q );\n\n\t\treturn this;\n\n\t}\n\n\tsetRotationFromAxisAngle( axis, angle ) {\n\n\t\t// assumes axis is normalized\n\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\n\n\t}\n\n\tsetRotationFromEuler( euler ) {\n\n\t\tthis.quaternion.setFromEuler( euler, true );\n\n\t}\n\n\tsetRotationFromMatrix( m ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tthis.quaternion.setFromRotationMatrix( m );\n\n\t}\n\n\tsetRotationFromQuaternion( q ) {\n\n\t\t// assumes q is normalized\n\n\t\tthis.quaternion.copy( q );\n\n\t}\n\n\trotateOnAxis( axis, angle ) {\n\n\t\t// rotate object on axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.multiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateOnWorldAxis( axis, angle ) {\n\n\t\t// rotate object on axis in world space\n\t\t// axis is assumed to be normalized\n\t\t// method assumes no rotated parent\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.premultiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\treturn this.rotateOnAxis( _xAxis, angle );\n\n\t}\n\n\trotateY( angle ) {\n\n\t\treturn this.rotateOnAxis( _yAxis, angle );\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\treturn this.rotateOnAxis( _zAxis, angle );\n\n\t}\n\n\ttranslateOnAxis( axis, distance ) {\n\n\t\t// translate object by distance along axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_v1$4.copy( axis ).applyQuaternion( this.quaternion );\n\n\t\tthis.position.add( _v1$4.multiplyScalar( distance ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslateX( distance ) {\n\n\t\treturn this.translateOnAxis( _xAxis, distance );\n\n\t}\n\n\ttranslateY( distance ) {\n\n\t\treturn this.translateOnAxis( _yAxis, distance );\n\n\t}\n\n\ttranslateZ( distance ) {\n\n\t\treturn this.translateOnAxis( _zAxis, distance );\n\n\t}\n\n\tlocalToWorld( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( this.matrixWorld );\n\n\t}\n\n\tworldToLocal( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( _m1$3.copy( this.matrixWorld ).invert() );\n\n\t}\n\n\tlookAt( x, y, z ) {\n\n\t\t// This method does not support objects having non-uniformly-scaled parent(s)\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\t_target.copy( x );\n\n\t\t} else {\n\n\t\t\t_target.set( x, y, z );\n\n\t\t}\n\n\t\tconst parent = this.parent;\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_position$3.setFromMatrixPosition( this.matrixWorld );\n\n\t\tif ( this.isCamera || this.isLight ) {\n\n\t\t\t_m1$3.lookAt( _position$3, _target, this.up );\n\n\t\t} else {\n\n\t\t\t_m1$3.lookAt( _target, _position$3, this.up );\n\n\t\t}\n\n\t\tthis.quaternion.setFromRotationMatrix( _m1$3 );\n\n\t\tif ( parent ) {\n\n\t\t\t_m1$3.extractRotation( parent.matrixWorld );\n\t\t\t_q1.setFromRotationMatrix( _m1$3 );\n\t\t\tthis.quaternion.premultiply( _q1.invert() );\n\n\t\t}\n\n\t}\n\n\tadd( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.add( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object === this ) {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object can\\'t be added as a child of itself.', object );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object && object.isObject3D ) {\n\n\t\t\tobject.removeFromParent();\n\t\t\tobject.parent = this;\n\t\t\tthis.children.push( object );\n\n\t\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t\t_childaddedEvent.child = object;\n\t\t\tthis.dispatchEvent( _childaddedEvent );\n\t\t\t_childaddedEvent.child = null;\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.remove( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst index = this.children.indexOf( object );\n\n\t\tif ( index !== - 1 ) {\n\n\t\t\tobject.parent = null;\n\t\t\tthis.children.splice( index, 1 );\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t\t_childremovedEvent.child = object;\n\t\t\tthis.dispatchEvent( _childremovedEvent );\n\t\t\t_childremovedEvent.child = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremoveFromParent() {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tparent.remove( this );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclear() {\n\n\t\treturn this.remove( ... this.children );\n\n\t}\n\n\tattach( object ) {\n\n\t\t// adds object as a child of this, while maintaining the object's world transform\n\n\t\t// Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_m1$3.copy( this.matrixWorld ).invert();\n\n\t\tif ( object.parent !== null ) {\n\n\t\t\tobject.parent.updateWorldMatrix( true, false );\n\n\t\t\t_m1$3.multiply( object.parent.matrixWorld );\n\n\t\t}\n\n\t\tobject.applyMatrix4( _m1$3 );\n\n\t\tobject.removeFromParent();\n\t\tobject.parent = this;\n\t\tthis.children.push( object );\n\n\t\tobject.updateWorldMatrix( false, true );\n\n\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t_childaddedEvent.child = object;\n\t\tthis.dispatchEvent( _childaddedEvent );\n\t\t_childaddedEvent.child = null;\n\n\t\treturn this;\n\n\t}\n\n\tgetObjectById( id ) {\n\n\t\treturn this.getObjectByProperty( 'id', id );\n\n\t}\n\n\tgetObjectByName( name ) {\n\n\t\treturn this.getObjectByProperty( 'name', name );\n\n\t}\n\n\tgetObjectByProperty( name, value ) {\n\n\t\tif ( this[ name ] === value ) return this;\n\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tconst child = this.children[ i ];\n\t\t\tconst object = child.getObjectByProperty( name, value );\n\n\t\t\tif ( object !== undefined ) {\n\n\t\t\t\treturn object;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tgetObjectsByProperty( name, value, result = [] ) {\n\n\t\tif ( this[ name ] === value ) result.push( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].getObjectsByProperty( name, value, result );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tgetWorldPosition( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn target.setFromMatrixPosition( this.matrixWorld );\n\n\t}\n\n\tgetWorldQuaternion( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, target, _scale$2 );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldScale( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, _quaternion$2, target );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tconst e = this.matrixWorld.elements;\n\n\t\treturn target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize();\n\n\t}\n\n\traycast( /* raycaster, intersects */ ) {}\n\n\ttraverse( callback ) {\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverse( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseVisible( callback ) {\n\n\t\tif ( this.visible === false ) return;\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverseVisible( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseAncestors( callback ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tcallback( parent );\n\n\t\t\tparent.traverseAncestors( callback );\n\n\t\t}\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\n\n\t\tthis.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.matrixWorldNeedsUpdate || force ) {\n\n\t\t\tif ( this.parent === null ) {\n\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t}\n\n\t\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\t\tforce = true;\n\n\t\t}\n\n\t\t// update children\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tconst child = children[ i ];\n\n\t\t\tif ( child.matrixWorldAutoUpdate === true || force === true ) {\n\n\t\t\t\tchild.updateMatrixWorld( force );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true ) {\n\n\t\t\tparent.updateWorldMatrix( true, false );\n\n\t\t}\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.parent === null ) {\n\n\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t} else {\n\n\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t}\n\n\t\t// update children\n\n\t\tif ( updateChildren === true ) {\n\n\t\t\tconst children = this.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tconst child = children[ i ];\n\n\t\t\t\tif ( child.matrixWorldAutoUpdate === true ) {\n\n\t\t\t\t\tchild.updateWorldMatrix( false, true );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\t// meta is a string when called from JSON.stringify\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tconst output = {};\n\n\t\t// meta is a hash used to collect geometries, materials.\n\t\t// not providing it implies that this is the root object\n\t\t// being serialized.\n\t\tif ( isRootObject ) {\n\n\t\t\t// initialize meta obj\n\t\t\tmeta = {\n\t\t\t\tgeometries: {},\n\t\t\t\tmaterials: {},\n\t\t\t\ttextures: {},\n\t\t\t\timages: {},\n\t\t\t\tshapes: {},\n\t\t\t\tskeletons: {},\n\t\t\t\tanimations: {},\n\t\t\t\tnodes: {}\n\t\t\t};\n\n\t\t\toutput.metadata = {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Object',\n\t\t\t\tgenerator: 'Object3D.toJSON'\n\t\t\t};\n\n\t\t}\n\n\t\t// standard Object3D serialization\n\n\t\tconst object = {};\n\n\t\tobject.uuid = this.uuid;\n\t\tobject.type = this.type;\n\n\t\tif ( this.name !== '' ) object.name = this.name;\n\t\tif ( this.castShadow === true ) object.castShadow = true;\n\t\tif ( this.receiveShadow === true ) object.receiveShadow = true;\n\t\tif ( this.visible === false ) object.visible = false;\n\t\tif ( this.frustumCulled === false ) object.frustumCulled = false;\n\t\tif ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;\n\t\tif ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;\n\n\t\tobject.layers = this.layers.mask;\n\t\tobject.matrix = this.matrix.toArray();\n\t\tobject.up = this.up.toArray();\n\n\t\tif ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;\n\n\t\t// object specific properties\n\n\t\tif ( this.isInstancedMesh ) {\n\n\t\t\tobject.type = 'InstancedMesh';\n\t\t\tobject.count = this.count;\n\t\t\tobject.instanceMatrix = this.instanceMatrix.toJSON();\n\t\t\tif ( this.instanceColor !== null ) object.instanceColor = this.instanceColor.toJSON();\n\n\t\t}\n\n\t\tif ( this.isBatchedMesh ) {\n\n\t\t\tobject.type = 'BatchedMesh';\n\t\t\tobject.perObjectFrustumCulled = this.perObjectFrustumCulled;\n\t\t\tobject.sortObjects = this.sortObjects;\n\n\t\t\tobject.drawRanges = this._drawRanges;\n\t\t\tobject.reservedRanges = this._reservedRanges;\n\n\t\t\tobject.visibility = this._visibility;\n\t\t\tobject.active = this._active;\n\t\t\tobject.bounds = this._bounds.map( bound => ( {\n\t\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\t\tboxMin: bound.box.min.toArray(),\n\t\t\t\tboxMax: bound.box.max.toArray(),\n\n\t\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\t\tsphereRadius: bound.sphere.radius,\n\t\t\t\tsphereCenter: bound.sphere.center.toArray()\n\t\t\t} ) );\n\n\t\t\tobject.maxGeometryCount = this._maxGeometryCount;\n\t\t\tobject.maxVertexCount = this._maxVertexCount;\n\t\t\tobject.maxIndexCount = this._maxIndexCount;\n\n\t\t\tobject.geometryInitialized = this._geometryInitialized;\n\t\t\tobject.geometryCount = this._geometryCount;\n\n\t\t\tobject.matricesTexture = this._matricesTexture.toJSON( meta );\n\n\t\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\t\tobject.boundingSphere = {\n\t\t\t\t\tcenter: object.boundingSphere.center.toArray(),\n\t\t\t\t\tradius: object.boundingSphere.radius\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t\tif ( this.boundingBox !== null ) {\n\n\t\t\t\tobject.boundingBox = {\n\t\t\t\t\tmin: object.boundingBox.min.toArray(),\n\t\t\t\t\tmax: object.boundingBox.max.toArray()\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tfunction serialize( library, element ) {\n\n\t\t\tif ( library[ element.uuid ] === undefined ) {\n\n\t\t\t\tlibrary[ element.uuid ] = element.toJSON( meta );\n\n\t\t\t}\n\n\t\t\treturn element.uuid;\n\n\t\t}\n\n\t\tif ( this.isScene ) {\n\n\t\t\tif ( this.background ) {\n\n\t\t\t\tif ( this.background.isColor ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON();\n\n\t\t\t\t} else if ( this.background.isTexture ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON( meta ).uuid;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true ) {\n\n\t\t\t\tobject.environment = this.environment.toJSON( meta ).uuid;\n\n\t\t\t}\n\n\t\t} else if ( this.isMesh || this.isLine || this.isPoints ) {\n\n\t\t\tobject.geometry = serialize( meta.geometries, this.geometry );\n\n\t\t\tconst parameters = this.geometry.parameters;\n\n\t\t\tif ( parameters !== undefined && parameters.shapes !== undefined ) {\n\n\t\t\t\tconst shapes = parameters.shapes;\n\n\t\t\t\tif ( Array.isArray( shapes ) ) {\n\n\t\t\t\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst shape = shapes[ i ];\n\n\t\t\t\t\t\tserialize( meta.shapes, shape );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tserialize( meta.shapes, shapes );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.isSkinnedMesh ) {\n\n\t\t\tobject.bindMode = this.bindMode;\n\t\t\tobject.bindMatrix = this.bindMatrix.toArray();\n\n\t\t\tif ( this.skeleton !== undefined ) {\n\n\t\t\t\tserialize( meta.skeletons, this.skeleton );\n\n\t\t\t\tobject.skeleton = this.skeleton.uuid;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.material !== undefined ) {\n\n\t\t\tif ( Array.isArray( this.material ) ) {\n\n\t\t\t\tconst uuids = [];\n\n\t\t\t\tfor ( let i = 0, l = this.material.length; i < l; i ++ ) {\n\n\t\t\t\t\tuuids.push( serialize( meta.materials, this.material[ i ] ) );\n\n\t\t\t\t}\n\n\t\t\t\tobject.material = uuids;\n\n\t\t\t} else {\n\n\t\t\t\tobject.material = serialize( meta.materials, this.material );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.children.length > 0 ) {\n\n\t\t\tobject.children = [];\n\n\t\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\n\n\t\t\t\tobject.children.push( this.children[ i ].toJSON( meta ).object );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.animations.length > 0 ) {\n\n\t\t\tobject.animations = [];\n\n\t\t\tfor ( let i = 0; i < this.animations.length; i ++ ) {\n\n\t\t\t\tconst animation = this.animations[ i ];\n\n\t\t\t\tobject.animations.push( serialize( meta.animations, animation ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst geometries = extractFromCache( meta.geometries );\n\t\t\tconst materials = extractFromCache( meta.materials );\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\t\t\tconst shapes = extractFromCache( meta.shapes );\n\t\t\tconst skeletons = extractFromCache( meta.skeletons );\n\t\t\tconst animations = extractFromCache( meta.animations );\n\t\t\tconst nodes = extractFromCache( meta.nodes );\n\n\t\t\tif ( geometries.length > 0 ) output.geometries = geometries;\n\t\t\tif ( materials.length > 0 ) output.materials = materials;\n\t\t\tif ( textures.length > 0 ) output.textures = textures;\n\t\t\tif ( images.length > 0 ) output.images = images;\n\t\t\tif ( shapes.length > 0 ) output.shapes = shapes;\n\t\t\tif ( skeletons.length > 0 ) output.skeletons = skeletons;\n\t\t\tif ( animations.length > 0 ) output.animations = animations;\n\t\t\tif ( nodes.length > 0 ) output.nodes = nodes;\n\n\t\t}\n\n\t\toutput.object = object;\n\n\t\treturn output;\n\n\t\t// extract data from the cache hash\n\t\t// remove metadata on each item\n\t\t// and return as array\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t}\n\n\tclone( recursive ) {\n\n\t\treturn new this.constructor().copy( this, recursive );\n\n\t}\n\n\tcopy( source, recursive = true ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.up.copy( source.up );\n\n\t\tthis.position.copy( source.position );\n\t\tthis.rotation.order = source.rotation.order;\n\t\tthis.quaternion.copy( source.quaternion );\n\t\tthis.scale.copy( source.scale );\n\n\t\tthis.matrix.copy( source.matrix );\n\t\tthis.matrixWorld.copy( source.matrixWorld );\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\tthis.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n\n\t\tthis.layers.mask = source.layers.mask;\n\t\tthis.visible = source.visible;\n\n\t\tthis.castShadow = source.castShadow;\n\t\tthis.receiveShadow = source.receiveShadow;\n\n\t\tthis.frustumCulled = source.frustumCulled;\n\t\tthis.renderOrder = source.renderOrder;\n\n\t\tthis.animations = source.animations.slice();\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tif ( recursive === true ) {\n\n\t\t\tfor ( let i = 0; i < source.children.length; i ++ ) {\n\n\t\t\t\tconst child = source.children[ i ];\n\t\t\t\tthis.add( child.clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nObject3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nObject3D.DEFAULT_MATRIX_AUTO_UPDATE = true;\nObject3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;\n\nconst _v0$1 = /*@__PURE__*/ new Vector3();\nconst _v1$3 = /*@__PURE__*/ new Vector3();\nconst _v2$2 = /*@__PURE__*/ new Vector3();\nconst _v3$2 = /*@__PURE__*/ new Vector3();\n\nconst _vab = /*@__PURE__*/ new Vector3();\nconst _vac = /*@__PURE__*/ new Vector3();\nconst _vbc = /*@__PURE__*/ new Vector3();\nconst _vap = /*@__PURE__*/ new Vector3();\nconst _vbp = /*@__PURE__*/ new Vector3();\nconst _vcp = /*@__PURE__*/ new Vector3();\n\nclass Triangle {\n\n\tconstructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {\n\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\n\t}\n\n\tstatic getNormal( a, b, c, target ) {\n\n\t\ttarget.subVectors( c, b );\n\t\t_v0$1.subVectors( a, b );\n\t\ttarget.cross( _v0$1 );\n\n\t\tconst targetLengthSq = target.lengthSq();\n\t\tif ( targetLengthSq > 0 ) {\n\n\t\t\treturn target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );\n\n\t\t}\n\n\t\treturn target.set( 0, 0, 0 );\n\n\t}\n\n\t// static/instance method to calculate barycentric coordinates\n\t// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n\tstatic getBarycoord( point, a, b, c, target ) {\n\n\t\t_v0$1.subVectors( c, a );\n\t\t_v1$3.subVectors( b, a );\n\t\t_v2$2.subVectors( point, a );\n\n\t\tconst dot00 = _v0$1.dot( _v0$1 );\n\t\tconst dot01 = _v0$1.dot( _v1$3 );\n\t\tconst dot02 = _v0$1.dot( _v2$2 );\n\t\tconst dot11 = _v1$3.dot( _v1$3 );\n\t\tconst dot12 = _v1$3.dot( _v2$2 );\n\n\t\tconst denom = ( dot00 * dot11 - dot01 * dot01 );\n\n\t\t// collinear or singular triangle\n\t\tif ( denom === 0 ) {\n\n\t\t\ttarget.set( 0, 0, 0 );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst invDenom = 1 / denom;\n\t\tconst u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\n\t\tconst v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\n\n\t\t// barycentric coordinates must always sum to 1\n\t\treturn target.set( 1 - u - v, v, u );\n\n\t}\n\n\tstatic containsPoint( point, a, b, c ) {\n\n\t\t// if the triangle is degenerate then we can't contain a point\n\t\tif ( this.getBarycoord( point, a, b, c, _v3$2 ) === null ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn ( _v3$2.x >= 0 ) && ( _v3$2.y >= 0 ) && ( ( _v3$2.x + _v3$2.y ) <= 1 );\n\n\t}\n\n\tstatic getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {\n\n\t\tif ( this.getBarycoord( point, p1, p2, p3, _v3$2 ) === null ) {\n\n\t\t\ttarget.x = 0;\n\t\t\ttarget.y = 0;\n\t\t\tif ( 'z' in target ) target.z = 0;\n\t\t\tif ( 'w' in target ) target.w = 0;\n\t\t\treturn null;\n\n\t\t}\n\n\t\ttarget.setScalar( 0 );\n\t\ttarget.addScaledVector( v1, _v3$2.x );\n\t\ttarget.addScaledVector( v2, _v3$2.y );\n\t\ttarget.addScaledVector( v3, _v3$2.z );\n\n\t\treturn target;\n\n\t}\n\n\tstatic isFrontFacing( a, b, c, direction ) {\n\n\t\t_v0$1.subVectors( c, b );\n\t\t_v1$3.subVectors( a, b );\n\n\t\t// strictly front facing\n\t\treturn ( _v0$1.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false;\n\n\t}\n\n\tset( a, b, c ) {\n\n\t\tthis.a.copy( a );\n\t\tthis.b.copy( b );\n\t\tthis.c.copy( c );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPointsAndIndices( points, i0, i1, i2 ) {\n\n\t\tthis.a.copy( points[ i0 ] );\n\t\tthis.b.copy( points[ i1 ] );\n\t\tthis.c.copy( points[ i2 ] );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAttributeAndIndices( attribute, i0, i1, i2 ) {\n\n\t\tthis.a.fromBufferAttribute( attribute, i0 );\n\t\tthis.b.fromBufferAttribute( attribute, i1 );\n\t\tthis.c.fromBufferAttribute( attribute, i2 );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( triangle ) {\n\n\t\tthis.a.copy( triangle.a );\n\t\tthis.b.copy( triangle.b );\n\t\tthis.c.copy( triangle.c );\n\n\t\treturn this;\n\n\t}\n\n\tgetArea() {\n\n\t\t_v0$1.subVectors( this.c, this.b );\n\t\t_v1$3.subVectors( this.a, this.b );\n\n\t\treturn _v0$1.cross( _v1$3 ).length() * 0.5;\n\n\t}\n\n\tgetMidpoint( target ) {\n\n\t\treturn target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\n\n\t}\n\n\tgetNormal( target ) {\n\n\t\treturn Triangle.getNormal( this.a, this.b, this.c, target );\n\n\t}\n\n\tgetPlane( target ) {\n\n\t\treturn target.setFromCoplanarPoints( this.a, this.b, this.c );\n\n\t}\n\n\tgetBarycoord( point, target ) {\n\n\t\treturn Triangle.getBarycoord( point, this.a, this.b, this.c, target );\n\n\t}\n\n\tgetInterpolation( point, v1, v2, v3, target ) {\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn Triangle.containsPoint( point, this.a, this.b, this.c );\n\n\t}\n\n\tisFrontFacing( direction ) {\n\n\t\treturn Triangle.isFrontFacing( this.a, this.b, this.c, direction );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsTriangle( this );\n\n\t}\n\n\tclosestPointToPoint( p, target ) {\n\n\t\tconst a = this.a, b = this.b, c = this.c;\n\t\tlet v, w;\n\n\t\t// algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n\t\t// published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n\t\t// under the accompanying license; see chapter 5.1.5 for detailed explanation.\n\t\t// basically, we're distinguishing which of the voronoi regions of the triangle\n\t\t// the point lies in with the minimum amount of redundant computation.\n\n\t\t_vab.subVectors( b, a );\n\t\t_vac.subVectors( c, a );\n\t\t_vap.subVectors( p, a );\n\t\tconst d1 = _vab.dot( _vap );\n\t\tconst d2 = _vac.dot( _vap );\n\t\tif ( d1 <= 0 && d2 <= 0 ) {\n\n\t\t\t// vertex region of A; barycentric coords (1, 0, 0)\n\t\t\treturn target.copy( a );\n\n\t\t}\n\n\t\t_vbp.subVectors( p, b );\n\t\tconst d3 = _vab.dot( _vbp );\n\t\tconst d4 = _vac.dot( _vbp );\n\t\tif ( d3 >= 0 && d4 <= d3 ) {\n\n\t\t\t// vertex region of B; barycentric coords (0, 1, 0)\n\t\t\treturn target.copy( b );\n\n\t\t}\n\n\t\tconst vc = d1 * d4 - d3 * d2;\n\t\tif ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {\n\n\t\t\tv = d1 / ( d1 - d3 );\n\t\t\t// edge region of AB; barycentric coords (1-v, v, 0)\n\t\t\treturn target.copy( a ).addScaledVector( _vab, v );\n\n\t\t}\n\n\t\t_vcp.subVectors( p, c );\n\t\tconst d5 = _vab.dot( _vcp );\n\t\tconst d6 = _vac.dot( _vcp );\n\t\tif ( d6 >= 0 && d5 <= d6 ) {\n\n\t\t\t// vertex region of C; barycentric coords (0, 0, 1)\n\t\t\treturn target.copy( c );\n\n\t\t}\n\n\t\tconst vb = d5 * d2 - d1 * d6;\n\t\tif ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {\n\n\t\t\tw = d2 / ( d2 - d6 );\n\t\t\t// edge region of AC; barycentric coords (1-w, 0, w)\n\t\t\treturn target.copy( a ).addScaledVector( _vac, w );\n\n\t\t}\n\n\t\tconst va = d3 * d6 - d5 * d4;\n\t\tif ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {\n\n\t\t\t_vbc.subVectors( c, b );\n\t\t\tw = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );\n\t\t\t// edge region of BC; barycentric coords (0, 1-w, w)\n\t\t\treturn target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC\n\n\t\t}\n\n\t\t// face region\n\t\tconst denom = 1 / ( va + vb + vc );\n\t\t// u = va * denom\n\t\tv = vb * denom;\n\t\tw = vc * denom;\n\n\t\treturn target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );\n\n\t}\n\n\tequals( triangle ) {\n\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\n\n\t}\n\n}\n\nconst _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\n\t'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\n\t'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\n\t'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\n\t'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\n\t'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\n\t'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\n\t'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\n\t'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\n\t'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\n\t'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\n\t'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\n\t'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\n\t'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\n\t'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\n\t'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\n\t'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\n\t'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\n\t'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\n\t'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\n\t'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\n\t'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\n\t'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\n\t'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\n\nconst _hslA = { h: 0, s: 0, l: 0 };\nconst _hslB = { h: 0, s: 0, l: 0 };\n\nfunction hue2rgb( p, q, t ) {\n\n\tif ( t < 0 ) t += 1;\n\tif ( t > 1 ) t -= 1;\n\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\n\tif ( t < 1 / 2 ) return q;\n\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\n\treturn p;\n\n}\n\nclass Color {\n\n\tconstructor( r, g, b ) {\n\n\t\tthis.isColor = true;\n\n\t\tthis.r = 1;\n\t\tthis.g = 1;\n\t\tthis.b = 1;\n\n\t\treturn this.set( r, g, b );\n\n\t}\n\n\tset( r, g, b ) {\n\n\t\tif ( g === undefined && b === undefined ) {\n\n\t\t\t// r is THREE.Color, hex or string\n\n\t\t\tconst value = r;\n\n\t\t\tif ( value && value.isColor ) {\n\n\t\t\t\tthis.copy( value );\n\n\t\t\t} else if ( typeof value === 'number' ) {\n\n\t\t\t\tthis.setHex( value );\n\n\t\t\t} else if ( typeof value === 'string' ) {\n\n\t\t\t\tthis.setStyle( value );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.setRGB( r, g, b );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.r = scalar;\n\t\tthis.g = scalar;\n\t\tthis.b = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetHex( hex, colorSpace = SRGBColorSpace ) {\n\n\t\thex = Math.floor( hex );\n\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\n\t\tthis.b = ( hex & 255 ) / 255;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetRGB( r, g, b, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tthis.r = r;\n\t\tthis.g = g;\n\t\tthis.b = b;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetHSL( h, s, l, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\t\th = euclideanModulo( h, 1 );\n\t\ts = clamp( s, 0, 1 );\n\t\tl = clamp( l, 0, 1 );\n\n\t\tif ( s === 0 ) {\n\n\t\t\tthis.r = this.g = this.b = l;\n\n\t\t} else {\n\n\t\t\tconst p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\n\t\t\tconst q = ( 2 * l ) - p;\n\n\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\n\t\t\tthis.g = hue2rgb( q, p, h );\n\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\n\n\t\t}\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetStyle( style, colorSpace = SRGBColorSpace ) {\n\n\t\tfunction handleAlpha( string ) {\n\n\t\t\tif ( string === undefined ) return;\n\n\t\t\tif ( parseFloat( string ) < 1 ) {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\tlet m;\n\n\t\tif ( m = /^(\\w+)\\(([^\\)]*)\\)/.exec( style ) ) {\n\n\t\t\t// rgb / hsl\n\n\t\t\tlet color;\n\t\t\tconst name = m[ 1 ];\n\t\t\tconst components = m[ 2 ];\n\n\t\t\tswitch ( name ) {\n\n\t\t\t\tcase 'rgb':\n\t\t\t\tcase 'rgba':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(255,0,0) rgba(255,0,0,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 1 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 2 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 3 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 1 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 2 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 3 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'hsl':\n\t\t\t\tcase 'hsla':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setHSL(\n\t\t\t\t\t\t\tparseFloat( color[ 1 ] ) / 360,\n\t\t\t\t\t\t\tparseFloat( color[ 2 ] ) / 100,\n\t\t\t\t\t\t\tparseFloat( color[ 3 ] ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tconsole.warn( 'THREE.Color: Unknown color model ' + style );\n\n\t\t\t}\n\n\t\t} else if ( m = /^\\#([A-Fa-f\\d]+)$/.exec( style ) ) {\n\n\t\t\t// hex color\n\n\t\t\tconst hex = m[ 1 ];\n\t\t\tconst size = hex.length;\n\n\t\t\tif ( size === 3 ) {\n\n\t\t\t\t// #ff0\n\t\t\t\treturn this.setRGB(\n\t\t\t\t\tparseInt( hex.charAt( 0 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 1 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 2 ), 16 ) / 15,\n\t\t\t\t\tcolorSpace\n\t\t\t\t);\n\n\t\t\t} else if ( size === 6 ) {\n\n\t\t\t\t// #ff0000\n\t\t\t\treturn this.setHex( parseInt( hex, 16 ), colorSpace );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Invalid hex color ' + style );\n\n\t\t\t}\n\n\t\t} else if ( style && style.length > 0 ) {\n\n\t\t\treturn this.setColorName( style, colorSpace );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetColorName( style, colorSpace = SRGBColorSpace ) {\n\n\t\t// color keywords\n\t\tconst hex = _colorKeywords[ style.toLowerCase() ];\n\n\t\tif ( hex !== undefined ) {\n\n\t\t\t// red\n\t\t\tthis.setHex( hex, colorSpace );\n\n\t\t} else {\n\n\t\t\t// unknown color\n\t\t\tconsole.warn( 'THREE.Color: Unknown color ' + style );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.r, this.g, this.b );\n\n\t}\n\n\tcopy( color ) {\n\n\t\tthis.r = color.r;\n\t\tthis.g = color.g;\n\t\tthis.b = color.b;\n\n\t\treturn this;\n\n\t}\n\n\tcopySRGBToLinear( color ) {\n\n\t\tthis.r = SRGBToLinear( color.r );\n\t\tthis.g = SRGBToLinear( color.g );\n\t\tthis.b = SRGBToLinear( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tcopyLinearToSRGB( color ) {\n\n\t\tthis.r = LinearToSRGB( color.r );\n\t\tthis.g = LinearToSRGB( color.g );\n\t\tthis.b = LinearToSRGB( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tconvertSRGBToLinear() {\n\n\t\tthis.copySRGBToLinear( this );\n\n\t\treturn this;\n\n\t}\n\n\tconvertLinearToSRGB() {\n\n\t\tthis.copyLinearToSRGB( this );\n\n\t\treturn this;\n\n\t}\n\n\tgetHex( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\treturn Math.round( clamp( _color.r * 255, 0, 255 ) ) * 65536 + Math.round( clamp( _color.g * 255, 0, 255 ) ) * 256 + Math.round( clamp( _color.b * 255, 0, 255 ) );\n\n\t}\n\n\tgetHexString( colorSpace = SRGBColorSpace ) {\n\n\t\treturn ( '000000' + this.getHex( colorSpace ).toString( 16 ) ).slice( - 6 );\n\n\t}\n\n\tgetHSL( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tconst max = Math.max( r, g, b );\n\t\tconst min = Math.min( r, g, b );\n\n\t\tlet hue, saturation;\n\t\tconst lightness = ( min + max ) / 2.0;\n\n\t\tif ( min === max ) {\n\n\t\t\thue = 0;\n\t\t\tsaturation = 0;\n\n\t\t} else {\n\n\t\t\tconst delta = max - min;\n\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\n\n\t\t\tswitch ( max ) {\n\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\n\n\t\t\t}\n\n\t\t\thue /= 6;\n\n\t\t}\n\n\t\ttarget.h = hue;\n\t\ttarget.s = saturation;\n\t\ttarget.l = lightness;\n\n\t\treturn target;\n\n\t}\n\n\tgetRGB( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\ttarget.r = _color.r;\n\t\ttarget.g = _color.g;\n\t\ttarget.b = _color.b;\n\n\t\treturn target;\n\n\t}\n\n\tgetStyle( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tif ( colorSpace !== SRGBColorSpace ) {\n\n\t\t\t// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).\n\t\t\treturn `color(${ colorSpace } ${ r.toFixed( 3 ) } ${ g.toFixed( 3 ) } ${ b.toFixed( 3 ) })`;\n\n\t\t}\n\n\t\treturn `rgb(${ Math.round( r * 255 ) },${ Math.round( g * 255 ) },${ Math.round( b * 255 ) })`;\n\n\t}\n\n\toffsetHSL( h, s, l ) {\n\n\t\tthis.getHSL( _hslA );\n\n\t\treturn this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );\n\n\t}\n\n\tadd( color ) {\n\n\t\tthis.r += color.r;\n\t\tthis.g += color.g;\n\t\tthis.b += color.b;\n\n\t\treturn this;\n\n\t}\n\n\taddColors( color1, color2 ) {\n\n\t\tthis.r = color1.r + color2.r;\n\t\tthis.g = color1.g + color2.g;\n\t\tthis.b = color1.b + color2.b;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.r += s;\n\t\tthis.g += s;\n\t\tthis.b += s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( color ) {\n\n\t\tthis.r = Math.max( 0, this.r - color.r );\n\t\tthis.g = Math.max( 0, this.g - color.g );\n\t\tthis.b = Math.max( 0, this.b - color.b );\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( color ) {\n\n\t\tthis.r *= color.r;\n\t\tthis.g *= color.g;\n\t\tthis.b *= color.b;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tthis.r *= s;\n\t\tthis.g *= s;\n\t\tthis.b *= s;\n\n\t\treturn this;\n\n\t}\n\n\tlerp( color, alpha ) {\n\n\t\tthis.r += ( color.r - this.r ) * alpha;\n\t\tthis.g += ( color.g - this.g ) * alpha;\n\t\tthis.b += ( color.b - this.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpColors( color1, color2, alpha ) {\n\n\t\tthis.r = color1.r + ( color2.r - color1.r ) * alpha;\n\t\tthis.g = color1.g + ( color2.g - color1.g ) * alpha;\n\t\tthis.b = color1.b + ( color2.b - color1.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpHSL( color, alpha ) {\n\n\t\tthis.getHSL( _hslA );\n\t\tcolor.getHSL( _hslB );\n\n\t\tconst h = lerp( _hslA.h, _hslB.h, alpha );\n\t\tconst s = lerp( _hslA.s, _hslB.s, alpha );\n\t\tconst l = lerp( _hslA.l, _hslB.l, alpha );\n\n\t\tthis.setHSL( h, s, l );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\tthis.r = v.x;\n\t\tthis.g = v.y;\n\t\tthis.b = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst r = this.r, g = this.g, b = this.b;\n\t\tconst e = m.elements;\n\n\t\tthis.r = e[ 0 ] * r + e[ 3 ] * g + e[ 6 ] * b;\n\t\tthis.g = e[ 1 ] * r + e[ 4 ] * g + e[ 7 ] * b;\n\t\tthis.b = e[ 2 ] * r + e[ 5 ] * g + e[ 8 ] * b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( c ) {\n\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.r = array[ offset ];\n\t\tthis.g = array[ offset + 1 ];\n\t\tthis.b = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.r;\n\t\tarray[ offset + 1 ] = this.g;\n\t\tarray[ offset + 2 ] = this.b;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.r = attribute.getX( index );\n\t\tthis.g = attribute.getY( index );\n\t\tthis.b = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.getHex();\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.r;\n\t\tyield this.g;\n\t\tyield this.b;\n\n\t}\n\n}\n\nconst _color = /*@__PURE__*/ new Color();\n\nColor.NAMES = _colorKeywords;\n\nlet _materialId = 0;\n\nclass Material extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isMaterial = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _materialId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Material';\n\n\t\tthis.blending = NormalBlending;\n\t\tthis.side = FrontSide;\n\t\tthis.vertexColors = false;\n\n\t\tthis.opacity = 1;\n\t\tthis.transparent = false;\n\t\tthis.alphaHash = false;\n\n\t\tthis.blendSrc = SrcAlphaFactor;\n\t\tthis.blendDst = OneMinusSrcAlphaFactor;\n\t\tthis.blendEquation = AddEquation;\n\t\tthis.blendSrcAlpha = null;\n\t\tthis.blendDstAlpha = null;\n\t\tthis.blendEquationAlpha = null;\n\t\tthis.blendColor = new Color( 0, 0, 0 );\n\t\tthis.blendAlpha = 0;\n\n\t\tthis.depthFunc = LessEqualDepth;\n\t\tthis.depthTest = true;\n\t\tthis.depthWrite = true;\n\n\t\tthis.stencilWriteMask = 0xff;\n\t\tthis.stencilFunc = AlwaysStencilFunc;\n\t\tthis.stencilRef = 0;\n\t\tthis.stencilFuncMask = 0xff;\n\t\tthis.stencilFail = KeepStencilOp;\n\t\tthis.stencilZFail = KeepStencilOp;\n\t\tthis.stencilZPass = KeepStencilOp;\n\t\tthis.stencilWrite = false;\n\n\t\tthis.clippingPlanes = null;\n\t\tthis.clipIntersection = false;\n\t\tthis.clipShadows = false;\n\n\t\tthis.shadowSide = null;\n\n\t\tthis.colorWrite = true;\n\n\t\tthis.precision = null; // override the renderer's default precision for this material\n\n\t\tthis.polygonOffset = false;\n\t\tthis.polygonOffsetFactor = 0;\n\t\tthis.polygonOffsetUnits = 0;\n\n\t\tthis.dithering = false;\n\n\t\tthis.alphaToCoverage = false;\n\t\tthis.premultipliedAlpha = false;\n\t\tthis.forceSinglePass = false;\n\n\t\tthis.visible = true;\n\n\t\tthis.toneMapped = true;\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\n\t\tthis._alphaTest = 0;\n\n\t}\n\n\tget alphaTest() {\n\n\t\treturn this._alphaTest;\n\n\t}\n\n\tset alphaTest( value ) {\n\n\t\tif ( this._alphaTest > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._alphaTest = value;\n\n\t}\n\n\tonBuild( /* shaderobject, renderer */ ) {}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}\n\n\tonBeforeCompile( /* shaderobject, renderer */ ) {}\n\n\tcustomProgramCacheKey() {\n\n\t\treturn this.onBeforeCompile.toString();\n\n\t}\n\n\tsetValues( values ) {\n\n\t\tif ( values === undefined ) return;\n\n\t\tfor ( const key in values ) {\n\n\t\t\tconst newValue = values[ key ];\n\n\t\t\tif ( newValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: parameter '${ key }' has value of undefined.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst currentValue = this[ key ];\n\n\t\t\tif ( currentValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: '${ key }' is not a property of THREE.${ this.type }.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( currentValue && currentValue.isColor ) {\n\n\t\t\t\tcurrentValue.set( newValue );\n\n\t\t\t} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else {\n\n\t\t\t\tthis[ key ] = newValue;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( isRootObject ) {\n\n\t\t\tmeta = {\n\t\t\t\ttextures: {},\n\t\t\t\timages: {}\n\t\t\t};\n\n\t\t}\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Material',\n\t\t\t\tgenerator: 'Material.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard Material serialization\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\n\t\tif ( this.color && this.color.isColor ) data.color = this.color.getHex();\n\n\t\tif ( this.roughness !== undefined ) data.roughness = this.roughness;\n\t\tif ( this.metalness !== undefined ) data.metalness = this.metalness;\n\n\t\tif ( this.sheen !== undefined ) data.sheen = this.sheen;\n\t\tif ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();\n\t\tif ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;\n\t\tif ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();\n\t\tif ( this.emissiveIntensity !== undefined && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;\n\n\t\tif ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();\n\t\tif ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;\n\t\tif ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();\n\t\tif ( this.shininess !== undefined ) data.shininess = this.shininess;\n\t\tif ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;\n\t\tif ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;\n\n\t\tif ( this.clearcoatMap && this.clearcoatMap.isTexture ) {\n\n\t\t\tdata.clearcoatMap = this.clearcoatMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture ) {\n\n\t\t\tdata.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) {\n\n\t\t\tdata.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid;\n\t\t\tdata.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.iridescence !== undefined ) data.iridescence = this.iridescence;\n\t\tif ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;\n\t\tif ( this.iridescenceThicknessRange !== undefined ) data.iridescenceThicknessRange = this.iridescenceThicknessRange;\n\n\t\tif ( this.iridescenceMap && this.iridescenceMap.isTexture ) {\n\n\t\t\tdata.iridescenceMap = this.iridescenceMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture ) {\n\n\t\t\tdata.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.anisotropy !== undefined ) data.anisotropy = this.anisotropy;\n\t\tif ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;\n\n\t\tif ( this.anisotropyMap && this.anisotropyMap.isTexture ) {\n\n\t\t\tdata.anisotropyMap = this.anisotropyMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;\n\t\tif ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;\n\t\tif ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;\n\n\t\tif ( this.lightMap && this.lightMap.isTexture ) {\n\n\t\t\tdata.lightMap = this.lightMap.toJSON( meta ).uuid;\n\t\t\tdata.lightMapIntensity = this.lightMapIntensity;\n\n\t\t}\n\n\t\tif ( this.aoMap && this.aoMap.isTexture ) {\n\n\t\t\tdata.aoMap = this.aoMap.toJSON( meta ).uuid;\n\t\t\tdata.aoMapIntensity = this.aoMapIntensity;\n\n\t\t}\n\n\t\tif ( this.bumpMap && this.bumpMap.isTexture ) {\n\n\t\t\tdata.bumpMap = this.bumpMap.toJSON( meta ).uuid;\n\t\t\tdata.bumpScale = this.bumpScale;\n\n\t\t}\n\n\t\tif ( this.normalMap && this.normalMap.isTexture ) {\n\n\t\t\tdata.normalMap = this.normalMap.toJSON( meta ).uuid;\n\t\t\tdata.normalMapType = this.normalMapType;\n\t\t\tdata.normalScale = this.normalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.displacementMap && this.displacementMap.isTexture ) {\n\n\t\t\tdata.displacementMap = this.displacementMap.toJSON( meta ).uuid;\n\t\t\tdata.displacementScale = this.displacementScale;\n\t\t\tdata.displacementBias = this.displacementBias;\n\n\t\t}\n\n\t\tif ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;\n\t\tif ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;\n\n\t\tif ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;\n\t\tif ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;\n\t\tif ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;\n\t\tif ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;\n\n\t\tif ( this.envMap && this.envMap.isTexture ) {\n\n\t\t\tdata.envMap = this.envMap.toJSON( meta ).uuid;\n\n\t\t\tif ( this.combine !== undefined ) data.combine = this.combine;\n\n\t\t}\n\n\t\tif ( this.envMapRotation !== undefined ) data.envMapRotation = this.envMapRotation.toArray();\n\t\tif ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;\n\t\tif ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;\n\t\tif ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;\n\n\t\tif ( this.gradientMap && this.gradientMap.isTexture ) {\n\n\t\t\tdata.gradientMap = this.gradientMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.transmission !== undefined ) data.transmission = this.transmission;\n\t\tif ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;\n\t\tif ( this.thickness !== undefined ) data.thickness = this.thickness;\n\t\tif ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;\n\t\tif ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;\n\t\tif ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();\n\n\t\tif ( this.size !== undefined ) data.size = this.size;\n\t\tif ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;\n\t\tif ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;\n\n\t\tif ( this.blending !== NormalBlending ) data.blending = this.blending;\n\t\tif ( this.side !== FrontSide ) data.side = this.side;\n\t\tif ( this.vertexColors === true ) data.vertexColors = true;\n\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\n\t\tif ( this.transparent === true ) data.transparent = true;\n\n\t\tif ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;\n\t\tif ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;\n\t\tif ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;\n\t\tif ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;\n\t\tif ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;\n\t\tif ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;\n\t\tif ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();\n\t\tif ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;\n\n\t\tif ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;\n\t\tif ( this.depthTest === false ) data.depthTest = this.depthTest;\n\t\tif ( this.depthWrite === false ) data.depthWrite = this.depthWrite;\n\t\tif ( this.colorWrite === false ) data.colorWrite = this.colorWrite;\n\n\t\tif ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;\n\t\tif ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;\n\t\tif ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;\n\t\tif ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;\n\t\tif ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;\n\t\tif ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;\n\t\tif ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;\n\t\tif ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;\n\n\t\t// rotation (SpriteMaterial)\n\t\tif ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;\n\n\t\tif ( this.polygonOffset === true ) data.polygonOffset = true;\n\t\tif ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;\n\t\tif ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;\n\n\t\tif ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;\n\t\tif ( this.dashSize !== undefined ) data.dashSize = this.dashSize;\n\t\tif ( this.gapSize !== undefined ) data.gapSize = this.gapSize;\n\t\tif ( this.scale !== undefined ) data.scale = this.scale;\n\n\t\tif ( this.dithering === true ) data.dithering = true;\n\n\t\tif ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;\n\t\tif ( this.alphaHash === true ) data.alphaHash = true;\n\t\tif ( this.alphaToCoverage === true ) data.alphaToCoverage = true;\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;\n\t\tif ( this.forceSinglePass === true ) data.forceSinglePass = true;\n\n\t\tif ( this.wireframe === true ) data.wireframe = true;\n\t\tif ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;\n\t\tif ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;\n\t\tif ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;\n\n\t\tif ( this.flatShading === true ) data.flatShading = true;\n\n\t\tif ( this.visible === false ) data.visible = false;\n\n\t\tif ( this.toneMapped === false ) data.toneMapped = false;\n\n\t\tif ( this.fog === false ) data.fog = false;\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\t// TODO: Copied from Object3D.toJSON\n\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\n\t\t\tif ( images.length > 0 ) data.images = images;\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.blending = source.blending;\n\t\tthis.side = source.side;\n\t\tthis.vertexColors = source.vertexColors;\n\n\t\tthis.opacity = source.opacity;\n\t\tthis.transparent = source.transparent;\n\n\t\tthis.blendSrc = source.blendSrc;\n\t\tthis.blendDst = source.blendDst;\n\t\tthis.blendEquation = source.blendEquation;\n\t\tthis.blendSrcAlpha = source.blendSrcAlpha;\n\t\tthis.blendDstAlpha = source.blendDstAlpha;\n\t\tthis.blendEquationAlpha = source.blendEquationAlpha;\n\t\tthis.blendColor.copy( source.blendColor );\n\t\tthis.blendAlpha = source.blendAlpha;\n\n\t\tthis.depthFunc = source.depthFunc;\n\t\tthis.depthTest = source.depthTest;\n\t\tthis.depthWrite = source.depthWrite;\n\n\t\tthis.stencilWriteMask = source.stencilWriteMask;\n\t\tthis.stencilFunc = source.stencilFunc;\n\t\tthis.stencilRef = source.stencilRef;\n\t\tthis.stencilFuncMask = source.stencilFuncMask;\n\t\tthis.stencilFail = source.stencilFail;\n\t\tthis.stencilZFail = source.stencilZFail;\n\t\tthis.stencilZPass = source.stencilZPass;\n\t\tthis.stencilWrite = source.stencilWrite;\n\n\t\tconst srcPlanes = source.clippingPlanes;\n\t\tlet dstPlanes = null;\n\n\t\tif ( srcPlanes !== null ) {\n\n\t\t\tconst n = srcPlanes.length;\n\t\t\tdstPlanes = new Array( n );\n\n\t\t\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\t\t\tdstPlanes[ i ] = srcPlanes[ i ].clone();\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.clippingPlanes = dstPlanes;\n\t\tthis.clipIntersection = source.clipIntersection;\n\t\tthis.clipShadows = source.clipShadows;\n\n\t\tthis.shadowSide = source.shadowSide;\n\n\t\tthis.colorWrite = source.colorWrite;\n\n\t\tthis.precision = source.precision;\n\n\t\tthis.polygonOffset = source.polygonOffset;\n\t\tthis.polygonOffsetFactor = source.polygonOffsetFactor;\n\t\tthis.polygonOffsetUnits = source.polygonOffsetUnits;\n\n\t\tthis.dithering = source.dithering;\n\n\t\tthis.alphaTest = source.alphaTest;\n\t\tthis.alphaHash = source.alphaHash;\n\t\tthis.alphaToCoverage = source.alphaToCoverage;\n\t\tthis.premultipliedAlpha = source.premultipliedAlpha;\n\t\tthis.forceSinglePass = source.forceSinglePass;\n\n\t\tthis.visible = source.visible;\n\n\t\tthis.toneMapped = source.toneMapped;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n}\n\nclass MeshBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshBasicMaterial = true;\n\n\t\tthis.type = 'MeshBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // emissive\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapRotation = new Euler();\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapRotation.copy( source.envMapRotation );\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\n// Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n\nconst _tables = /*@__PURE__*/ _generateTables();\n\nfunction _generateTables() {\n\n\t// float32 to float16 helpers\n\n\tconst buffer = new ArrayBuffer( 4 );\n\tconst floatView = new Float32Array( buffer );\n\tconst uint32View = new Uint32Array( buffer );\n\n\tconst baseTable = new Uint32Array( 512 );\n\tconst shiftTable = new Uint32Array( 512 );\n\n\tfor ( let i = 0; i < 256; ++ i ) {\n\n\t\tconst e = i - 127;\n\n\t\t// very small number (0, -0)\n\n\t\tif ( e < - 27 ) {\n\n\t\t\tbaseTable[ i ] = 0x0000;\n\t\t\tbaseTable[ i | 0x100 ] = 0x8000;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// small number (denorm)\n\n\t\t} else if ( e < - 14 ) {\n\n\t\t\tbaseTable[ i ] = 0x0400 >> ( - e - 14 );\n\t\t\tbaseTable[ i | 0x100 ] = ( 0x0400 >> ( - e - 14 ) ) | 0x8000;\n\t\t\tshiftTable[ i ] = - e - 1;\n\t\t\tshiftTable[ i | 0x100 ] = - e - 1;\n\n\t\t\t// normal number\n\n\t\t} else if ( e <= 15 ) {\n\n\t\t\tbaseTable[ i ] = ( e + 15 ) << 10;\n\t\t\tbaseTable[ i | 0x100 ] = ( ( e + 15 ) << 10 ) | 0x8000;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t\t// large number (Infinity, -Infinity)\n\n\t\t} else if ( e < 128 ) {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// stay (NaN, Infinity, -Infinity)\n\n\t\t} else {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t}\n\n\t}\n\n\t// float16 to float32 helpers\n\n\tconst mantissaTable = new Uint32Array( 2048 );\n\tconst exponentTable = new Uint32Array( 64 );\n\tconst offsetTable = new Uint32Array( 64 );\n\n\tfor ( let i = 1; i < 1024; ++ i ) {\n\n\t\tlet m = i << 13; // zero pad mantissa bits\n\t\tlet e = 0; // zero exponent\n\n\t\t// normalized\n\t\twhile ( ( m & 0x00800000 ) === 0 ) {\n\n\t\t\tm <<= 1;\n\t\t\te -= 0x00800000; // decrement exponent\n\n\t\t}\n\n\t\tm &= ~ 0x00800000; // clear leading 1 bit\n\t\te += 0x38800000; // adjust bias\n\n\t\tmantissaTable[ i ] = m | e;\n\n\t}\n\n\tfor ( let i = 1024; i < 2048; ++ i ) {\n\n\t\tmantissaTable[ i ] = 0x38000000 + ( ( i - 1024 ) << 13 );\n\n\t}\n\n\tfor ( let i = 1; i < 31; ++ i ) {\n\n\t\texponentTable[ i ] = i << 23;\n\n\t}\n\n\texponentTable[ 31 ] = 0x47800000;\n\texponentTable[ 32 ] = 0x80000000;\n\n\tfor ( let i = 33; i < 63; ++ i ) {\n\n\t\texponentTable[ i ] = 0x80000000 + ( ( i - 32 ) << 23 );\n\n\t}\n\n\texponentTable[ 63 ] = 0xc7800000;\n\n\tfor ( let i = 1; i < 64; ++ i ) {\n\n\t\tif ( i !== 32 ) {\n\n\t\t\toffsetTable[ i ] = 1024;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tfloatView: floatView,\n\t\tuint32View: uint32View,\n\t\tbaseTable: baseTable,\n\t\tshiftTable: shiftTable,\n\t\tmantissaTable: mantissaTable,\n\t\texponentTable: exponentTable,\n\t\toffsetTable: offsetTable\n\t};\n\n}\n\n// float32 to float16\n\nfunction toHalfFloat( val ) {\n\n\tif ( Math.abs( val ) > 65504 ) console.warn( 'THREE.DataUtils.toHalfFloat(): Value out of range.' );\n\n\tval = clamp( val, - 65504, 65504 );\n\n\t_tables.floatView[ 0 ] = val;\n\tconst f = _tables.uint32View[ 0 ];\n\tconst e = ( f >> 23 ) & 0x1ff;\n\treturn _tables.baseTable[ e ] + ( ( f & 0x007fffff ) >> _tables.shiftTable[ e ] );\n\n}\n\n// float16 to float32\n\nfunction fromHalfFloat( val ) {\n\n\tconst m = val >> 10;\n\t_tables.uint32View[ 0 ] = _tables.mantissaTable[ _tables.offsetTable[ m ] + ( val & 0x3ff ) ] + _tables.exponentTable[ m ];\n\treturn _tables.floatView[ 0 ];\n\n}\n\nconst DataUtils = {\n\ttoHalfFloat: toHalfFloat,\n\tfromHalfFloat: fromHalfFloat,\n};\n\nconst _vector$9 = /*@__PURE__*/ new Vector3();\nconst _vector2$1 = /*@__PURE__*/ new Vector2();\n\nclass BufferAttribute {\n\n\tconstructor( array, itemSize, normalized = false ) {\n\n\t\tif ( Array.isArray( array ) ) {\n\n\t\t\tthrow new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );\n\n\t\t}\n\n\t\tthis.isBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.array = array;\n\t\tthis.itemSize = itemSize;\n\t\tthis.count = array !== undefined ? array.length / itemSize : 0;\n\t\tthis.normalized = normalized;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis._updateRange = { offset: 0, count: - 1 };\n\t\tthis.updateRanges = [];\n\t\tthis.gpuType = FloatType;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tget updateRange() {\n\n\t\twarnOnce( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\n\t\treturn this._updateRange;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.itemSize = source.itemSize;\n\t\tthis.count = source.count;\n\t\tthis.normalized = source.normalized;\n\n\t\tthis.usage = source.usage;\n\t\tthis.gpuType = source.gpuType;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.itemSize;\n\t\tindex2 *= attribute.itemSize;\n\n\t\tfor ( let i = 0, l = this.itemSize; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcopyArray( array ) {\n\n\t\tthis.array.set( array );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tif ( this.itemSize === 2 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector2$1.fromBufferAttribute( this, i );\n\t\t\t\t_vector2$1.applyMatrix3( m );\n\n\t\t\t\tthis.setXY( i, _vector2$1.x, _vector2$1.y );\n\n\t\t\t}\n\n\t\t} else if ( this.itemSize === 3 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector$9.fromBufferAttribute( this, i );\n\t\t\t\t_vector$9.applyMatrix3( m );\n\n\t\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\t// Matching BufferAttribute constructor, do not normalize the array.\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.itemSize + component ];\n\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\n\n\t\treturn value;\n\n\t}\n\n\tsetComponent( index, component, value ) {\n\n\t\tif ( this.normalized ) value = normalize( value, this.array );\n\n\t\tthis.array[ index * this.itemSize + component ] = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.array[ index * this.itemSize ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.array[ index * this.itemSize + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.array[ index * this.itemSize + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.array[ index * this.itemSize + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\t\tthis.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.array, this.itemSize ).copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\titemSize: this.itemSize,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tarray: Array.from( this.array ),\n\t\t\tnormalized: this.normalized\n\t\t};\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( this.usage !== StaticDrawUsage ) data.usage = this.usage;\n\n\t\treturn data;\n\n\t}\n\n}\n\n//\n\nclass Int8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8ClampedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8ClampedArray( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t\tthis.isFloat16BufferAttribute = true;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = fromHalfFloat( this.array[ index * this.itemSize ] );\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = toHalfFloat( x );\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = fromHalfFloat( this.array[ index * this.itemSize + 1 ] );\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = fromHalfFloat( this.array[ index * this.itemSize + 2 ] );\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = fromHalfFloat( this.array[ index * this.itemSize + 3 ] );\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\t\tthis.array[ index + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n}\n\n\nclass Float32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nlet _id$2 = 0;\n\nconst _m1$2 = /*@__PURE__*/ new Matrix4();\nconst _obj = /*@__PURE__*/ new Object3D();\nconst _offset = /*@__PURE__*/ new Vector3();\nconst _box$2 = /*@__PURE__*/ new Box3();\nconst _boxMorphTargets = /*@__PURE__*/ new Box3();\nconst _vector$8 = /*@__PURE__*/ new Vector3();\n\nclass BufferGeometry extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBufferGeometry = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _id$2 ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'BufferGeometry';\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\n\t\tthis.morphAttributes = {};\n\t\tthis.morphTargetsRelative = false;\n\n\t\tthis.groups = [];\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tthis.drawRange = { start: 0, count: Infinity };\n\n\t\tthis.userData = {};\n\n\t}\n\n\tgetIndex() {\n\n\t\treturn this.index;\n\n\t}\n\n\tsetIndex( index ) {\n\n\t\tif ( Array.isArray( index ) ) {\n\n\t\t\tthis.index = new ( arrayNeedsUint32( index ) ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );\n\n\t\t} else {\n\n\t\t\tthis.index = index;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetAttribute( name ) {\n\n\t\treturn this.attributes[ name ];\n\n\t}\n\n\tsetAttribute( name, attribute ) {\n\n\t\tthis.attributes[ name ] = attribute;\n\n\t\treturn this;\n\n\t}\n\n\tdeleteAttribute( name ) {\n\n\t\tdelete this.attributes[ name ];\n\n\t\treturn this;\n\n\t}\n\n\thasAttribute( name ) {\n\n\t\treturn this.attributes[ name ] !== undefined;\n\n\t}\n\n\taddGroup( start, count, materialIndex = 0 ) {\n\n\t\tthis.groups.push( {\n\n\t\t\tstart: start,\n\t\t\tcount: count,\n\t\t\tmaterialIndex: materialIndex\n\n\t\t} );\n\n\t}\n\n\tclearGroups() {\n\n\t\tthis.groups = [];\n\n\t}\n\n\tsetDrawRange( start, count ) {\n\n\t\tthis.drawRange.start = start;\n\t\tthis.drawRange.count = count;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tconst position = this.attributes.position;\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tposition.applyMatrix4( matrix );\n\n\t\t\tposition.needsUpdate = true;\n\n\t\t}\n\n\t\tconst normal = this.attributes.normal;\n\n\t\tif ( normal !== undefined ) {\n\n\t\t\tconst normalMatrix = new Matrix3().getNormalMatrix( matrix );\n\n\t\t\tnormal.applyNormalMatrix( normalMatrix );\n\n\t\t\tnormal.needsUpdate = true;\n\n\t\t}\n\n\t\tconst tangent = this.attributes.tangent;\n\n\t\tif ( tangent !== undefined ) {\n\n\t\t\ttangent.transformDirection( matrix );\n\n\t\t\ttangent.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t_m1$2.makeRotationFromQuaternion( q );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\t// rotate geometry around world x-axis\n\n\t\t_m1$2.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t}\n\n\trotateY( angle ) {\n\n\t\t// rotate geometry around world y-axis\n\n\t\t_m1$2.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\t// rotate geometry around world z-axis\n\n\t\t_m1$2.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( x, y, z ) {\n\n\t\t// translate geometry\n\n\t\t_m1$2.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t}\n\n\tscale( x, y, z ) {\n\n\t\t// scale geometry\n\n\t\t_m1$2.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1$2 );\n\n\t\treturn this;\n\n\t}\n\n\tlookAt( vector ) {\n\n\t\t_obj.lookAt( vector );\n\n\t\t_obj.updateMatrix();\n\n\t\tthis.applyMatrix4( _obj.matrix );\n\n\t\treturn this;\n\n\t}\n\n\tcenter() {\n\n\t\tthis.computeBoundingBox();\n\n\t\tthis.boundingBox.getCenter( _offset ).negate();\n\n\t\tthis.translate( _offset.x, _offset.y, _offset.z );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tconst position = [];\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst point = points[ i ];\n\t\t\tposition.push( point.x, point.y, point.z || 0 );\n\n\t\t}\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );\n\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this );\n\n\t\t\tthis.boundingBox.set(\n\t\t\t\tnew Vector3( - Infinity, - Infinity, - Infinity ),\n\t\t\t\tnew Vector3( + Infinity, + Infinity, + Infinity )\n\t\t\t);\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tthis.boundingBox.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_box$2.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.min, _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\n\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.max, _box$2.max );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.boundingBox.makeEmpty();\n\n\t\t}\n\n\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this );\n\n\t\t\tthis.boundingSphere.set( new Vector3(), Infinity );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position ) {\n\n\t\t\t// first, find the center of the bounding sphere\n\n\t\t\tconst center = this.boundingSphere.center;\n\n\t\t\t_box$2.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_boxMorphTargets.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$8.addVectors( _box$2.min, _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$8 );\n\n\t\t\t\t\t\t_vector$8.addVectors( _box$2.max, _boxMorphTargets.max );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$8 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_box$2.getCenter( center );\n\n\t\t\t// second, try to find a boundingSphere with a radius smaller than the\n\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n\n\t\t\tlet maxRadiusSq = 0;\n\n\t\t\tfor ( let i = 0, il = position.count; i < il; i ++ ) {\n\n\t\t\t\t_vector$8.fromBufferAttribute( position, i );\n\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\n\n\t\t\t}\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\tconst morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t\t\t\tfor ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {\n\n\t\t\t\t\t\t_vector$8.fromBufferAttribute( morphAttribute, j );\n\n\t\t\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t\t\t_offset.fromBufferAttribute( position, j );\n\t\t\t\t\t\t\t_vector$8.add( _offset );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\n\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeTangents() {\n\n\t\tconst index = this.index;\n\t\tconst attributes = this.attributes;\n\n\t\t// based on http://www.terathon.com/code/tangent.html\n\t\t// (per vertex tangents)\n\n\t\tif ( index === null ||\n\t\t\t attributes.position === undefined ||\n\t\t\t attributes.normal === undefined ||\n\t\t\t attributes.uv === undefined ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst positionAttribute = attributes.position;\n\t\tconst normalAttribute = attributes.normal;\n\t\tconst uvAttribute = attributes.uv;\n\n\t\tif ( this.hasAttribute( 'tangent' ) === false ) {\n\n\t\t\tthis.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );\n\n\t\t}\n\n\t\tconst tangentAttribute = this.getAttribute( 'tangent' );\n\n\t\tconst tan1 = [], tan2 = [];\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\ttan1[ i ] = new Vector3();\n\t\t\ttan2[ i ] = new Vector3();\n\n\t\t}\n\n\t\tconst vA = new Vector3(),\n\t\t\tvB = new Vector3(),\n\t\t\tvC = new Vector3(),\n\n\t\t\tuvA = new Vector2(),\n\t\t\tuvB = new Vector2(),\n\t\t\tuvC = new Vector2(),\n\n\t\t\tsdir = new Vector3(),\n\t\t\ttdir = new Vector3();\n\n\t\tfunction handleTriangle( a, b, c ) {\n\n\t\t\tvA.fromBufferAttribute( positionAttribute, a );\n\t\t\tvB.fromBufferAttribute( positionAttribute, b );\n\t\t\tvC.fromBufferAttribute( positionAttribute, c );\n\n\t\t\tuvA.fromBufferAttribute( uvAttribute, a );\n\t\t\tuvB.fromBufferAttribute( uvAttribute, b );\n\t\t\tuvC.fromBufferAttribute( uvAttribute, c );\n\n\t\t\tvB.sub( vA );\n\t\t\tvC.sub( vA );\n\n\t\t\tuvB.sub( uvA );\n\t\t\tuvC.sub( uvA );\n\n\t\t\tconst r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );\n\n\t\t\t// silently ignore degenerate uv triangles having coincident or colinear vertices\n\n\t\t\tif ( ! isFinite( r ) ) return;\n\n\t\t\tsdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );\n\t\t\ttdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );\n\n\t\t\ttan1[ a ].add( sdir );\n\t\t\ttan1[ b ].add( sdir );\n\t\t\ttan1[ c ].add( sdir );\n\n\t\t\ttan2[ a ].add( tdir );\n\t\t\ttan2[ b ].add( tdir );\n\t\t\ttan2[ c ].add( tdir );\n\n\t\t}\n\n\t\tlet groups = this.groups;\n\n\t\tif ( groups.length === 0 ) {\n\n\t\t\tgroups = [ {\n\t\t\t\tstart: 0,\n\t\t\t\tcount: index.count\n\t\t\t} ];\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleTriangle(\n\t\t\t\t\tindex.getX( j + 0 ),\n\t\t\t\t\tindex.getX( j + 1 ),\n\t\t\t\t\tindex.getX( j + 2 )\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst tmp = new Vector3(), tmp2 = new Vector3();\n\t\tconst n = new Vector3(), n2 = new Vector3();\n\n\t\tfunction handleVertex( v ) {\n\n\t\t\tn.fromBufferAttribute( normalAttribute, v );\n\t\t\tn2.copy( n );\n\n\t\t\tconst t = tan1[ v ];\n\n\t\t\t// Gram-Schmidt orthogonalize\n\n\t\t\ttmp.copy( t );\n\t\t\ttmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();\n\n\t\t\t// Calculate handedness\n\n\t\t\ttmp2.crossVectors( n2, t );\n\t\t\tconst test = tmp2.dot( tan2[ v ] );\n\t\t\tconst w = ( test < 0.0 ) ? - 1.0 : 1.0;\n\n\t\t\ttangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, w );\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleVertex( index.getX( j + 0 ) );\n\t\t\t\thandleVertex( index.getX( j + 1 ) );\n\t\t\t\thandleVertex( index.getX( j + 2 ) );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeVertexNormals() {\n\n\t\tconst index = this.index;\n\t\tconst positionAttribute = this.getAttribute( 'position' );\n\n\t\tif ( positionAttribute !== undefined ) {\n\n\t\t\tlet normalAttribute = this.getAttribute( 'normal' );\n\n\t\t\tif ( normalAttribute === undefined ) {\n\n\t\t\t\tnormalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );\n\t\t\t\tthis.setAttribute( 'normal', normalAttribute );\n\n\t\t\t} else {\n\n\t\t\t\t// reset existing normals to zero\n\n\t\t\t\tfor ( let i = 0, il = normalAttribute.count; i < il; i ++ ) {\n\n\t\t\t\t\tnormalAttribute.setXYZ( i, 0, 0, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst pA = new Vector3(), pB = new Vector3(), pC = new Vector3();\n\t\t\tconst nA = new Vector3(), nB = new Vector3(), nC = new Vector3();\n\t\t\tconst cb = new Vector3(), ab = new Vector3();\n\n\t\t\t// indexed elements\n\n\t\t\tif ( index ) {\n\n\t\t\t\tfor ( let i = 0, il = index.count; i < il; i += 3 ) {\n\n\t\t\t\t\tconst vA = index.getX( i + 0 );\n\t\t\t\t\tconst vB = index.getX( i + 1 );\n\t\t\t\t\tconst vC = index.getX( i + 2 );\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, vA );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, vB );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, vC );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnA.fromBufferAttribute( normalAttribute, vA );\n\t\t\t\t\tnB.fromBufferAttribute( normalAttribute, vB );\n\t\t\t\t\tnC.fromBufferAttribute( normalAttribute, vC );\n\n\t\t\t\t\tnA.add( cb );\n\t\t\t\t\tnB.add( cb );\n\t\t\t\t\tnC.add( cb );\n\n\t\t\t\t\tnormalAttribute.setXYZ( vA, nA.x, nA.y, nA.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vB, nB.x, nB.y, nB.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vC, nC.x, nC.y, nC.z );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\n\n\t\t\t\tfor ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) {\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, i + 0 );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, i + 1 );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, i + 2 );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnormalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.normalizeNormals();\n\n\t\t\tnormalAttribute.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tnormalizeNormals() {\n\n\t\tconst normals = this.attributes.normal;\n\n\t\tfor ( let i = 0, il = normals.count; i < il; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( normals, i );\n\n\t\t\t_vector$8.normalize();\n\n\t\t\tnormals.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t}\n\n\ttoNonIndexed() {\n\n\t\tfunction convertBufferAttribute( attribute, indices ) {\n\n\t\t\tconst array = attribute.array;\n\t\t\tconst itemSize = attribute.itemSize;\n\t\t\tconst normalized = attribute.normalized;\n\n\t\t\tconst array2 = new array.constructor( indices.length * itemSize );\n\n\t\t\tlet index = 0, index2 = 0;\n\n\t\t\tfor ( let i = 0, l = indices.length; i < l; i ++ ) {\n\n\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\tindex = indices[ i ] * attribute.data.stride + attribute.offset;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindex = indices[ i ] * itemSize;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let j = 0; j < itemSize; j ++ ) {\n\n\t\t\t\t\tarray2[ index2 ++ ] = array[ index ++ ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( array2, itemSize, normalized );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.index === null ) {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst geometry2 = new BufferGeometry();\n\n\t\tconst indices = this.index.array;\n\t\tconst attributes = this.attributes;\n\n\t\t// attributes\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\n\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\tgeometry2.setAttribute( name, newAttribute );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = this.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst morphArray = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = morphAttribute[ i ];\n\n\t\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\t\tmorphArray.push( newAttribute );\n\n\t\t\t}\n\n\t\t\tgeometry2.morphAttributes[ name ] = morphArray;\n\n\t\t}\n\n\t\tgeometry2.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = this.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tgeometry2.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\treturn geometry2;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'BufferGeometry',\n\t\t\t\tgenerator: 'BufferGeometry.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard BufferGeometry serialization\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\tif ( this.parameters !== undefined ) {\n\n\t\t\tconst parameters = this.parameters;\n\n\t\t\tfor ( const key in parameters ) {\n\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\n\n\t\t\t}\n\n\t\t\treturn data;\n\n\t\t}\n\n\t\t// for simplicity the code assumes attributes are not shared across geometries, see #15811\n\n\t\tdata.data = { attributes: {} };\n\n\t\tconst index = this.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tdata.data.index = {\n\t\t\t\ttype: index.array.constructor.name,\n\t\t\t\tarray: Array.prototype.slice.call( index.array )\n\t\t\t};\n\n\t\t}\n\n\t\tconst attributes = this.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\n\t\t\tdata.data.attributes[ key ] = attribute.toJSON( data.data );\n\n\t\t}\n\n\t\tconst morphAttributes = {};\n\t\tlet hasMorphAttributes = false;\n\n\t\tfor ( const key in this.morphAttributes ) {\n\n\t\t\tconst attributeArray = this.morphAttributes[ key ];\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = attributeArray[ i ];\n\n\t\t\t\tarray.push( attribute.toJSON( data.data ) );\n\n\t\t\t}\n\n\t\t\tif ( array.length > 0 ) {\n\n\t\t\t\tmorphAttributes[ key ] = array;\n\n\t\t\t\thasMorphAttributes = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( hasMorphAttributes ) {\n\n\t\t\tdata.data.morphAttributes = morphAttributes;\n\t\t\tdata.data.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t}\n\n\t\tconst groups = this.groups;\n\n\t\tif ( groups.length > 0 ) {\n\n\t\t\tdata.data.groups = JSON.parse( JSON.stringify( groups ) );\n\n\t\t}\n\n\t\tconst boundingSphere = this.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tdata.data.boundingSphere = {\n\t\t\t\tcenter: boundingSphere.center.toArray(),\n\t\t\t\tradius: boundingSphere.radius\n\t\t\t};\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\t// reset\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\t\tthis.morphAttributes = {};\n\t\tthis.groups = [];\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\t// used for storing cloned, shared data\n\n\t\tconst data = {};\n\n\t\t// name\n\n\t\tthis.name = source.name;\n\n\t\t// index\n\n\t\tconst index = source.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tthis.setIndex( index.clone( data ) );\n\n\t\t}\n\n\t\t// attributes\n\n\t\tconst attributes = source.attributes;\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\t\t\tthis.setAttribute( name, attribute.clone( data ) );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = source.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, l = morphAttribute.length; i < l; i ++ ) {\n\n\t\t\t\tarray.push( morphAttribute[ i ].clone( data ) );\n\n\t\t\t}\n\n\t\t\tthis.morphAttributes[ name ] = array;\n\n\t\t}\n\n\t\tthis.morphTargetsRelative = source.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = source.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tthis.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\t// bounding box\n\n\t\tconst boundingBox = source.boundingBox;\n\n\t\tif ( boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = boundingBox.clone();\n\n\t\t}\n\n\t\t// bounding sphere\n\n\t\tconst boundingSphere = source.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = boundingSphere.clone();\n\n\t\t}\n\n\t\t// draw range\n\n\t\tthis.drawRange.start = source.drawRange.start;\n\t\tthis.drawRange.count = source.drawRange.count;\n\n\t\t// user data\n\n\t\tthis.userData = source.userData;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nconst _inverseMatrix$3 = /*@__PURE__*/ new Matrix4();\nconst _ray$3 = /*@__PURE__*/ new Ray();\nconst _sphere$6 = /*@__PURE__*/ new Sphere();\nconst _sphereHitAt = /*@__PURE__*/ new Vector3();\n\nconst _vA$1 = /*@__PURE__*/ new Vector3();\nconst _vB$1 = /*@__PURE__*/ new Vector3();\nconst _vC$1 = /*@__PURE__*/ new Vector3();\n\nconst _tempA = /*@__PURE__*/ new Vector3();\nconst _morphA = /*@__PURE__*/ new Vector3();\n\nconst _uvA$1 = /*@__PURE__*/ new Vector2();\nconst _uvB$1 = /*@__PURE__*/ new Vector2();\nconst _uvC$1 = /*@__PURE__*/ new Vector2();\n\nconst _normalA = /*@__PURE__*/ new Vector3();\nconst _normalB = /*@__PURE__*/ new Vector3();\nconst _normalC = /*@__PURE__*/ new Vector3();\n\nconst _intersectionPoint = /*@__PURE__*/ new Vector3();\nconst _intersectionPointWorld = /*@__PURE__*/ new Vector3();\n\nclass Mesh extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new MeshBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isMesh = true;\n\n\t\tthis.type = 'Mesh';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.morphTargetInfluences !== undefined ) {\n\n\t\t\tthis.morphTargetInfluences = source.morphTargetInfluences.slice();\n\n\t\t}\n\n\t\tif ( source.morphTargetDictionary !== undefined ) {\n\n\t\t\tthis.morphTargetDictionary = Object.assign( {}, source.morphTargetDictionary );\n\n\t\t}\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.attributes.position;\n\t\tconst morphPosition = geometry.morphAttributes.position;\n\t\tconst morphTargetsRelative = geometry.morphTargetsRelative;\n\n\t\ttarget.fromBufferAttribute( position, index );\n\n\t\tconst morphInfluences = this.morphTargetInfluences;\n\n\t\tif ( morphPosition && morphInfluences ) {\n\n\t\t\t_morphA.set( 0, 0, 0 );\n\n\t\t\tfor ( let i = 0, il = morphPosition.length; i < il; i ++ ) {\n\n\t\t\t\tconst influence = morphInfluences[ i ];\n\t\t\t\tconst morphAttribute = morphPosition[ i ];\n\n\t\t\t\tif ( influence === 0 ) continue;\n\n\t\t\t\t_tempA.fromBufferAttribute( morphAttribute, index );\n\n\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA, influence );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA.sub( target ), influence );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttarget.add( _morphA );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$6.copy( geometry.boundingSphere );\n\t\t_sphere$6.applyMatrix4( matrixWorld );\n\n\t\t// check distance from ray origin to bounding sphere\n\n\t\t_ray$3.copy( raycaster.ray ).recast( raycaster.near );\n\n\t\tif ( _sphere$6.containsPoint( _ray$3.origin ) === false ) {\n\n\t\t\tif ( _ray$3.intersectSphere( _sphere$6, _sphereHitAt ) === null ) return;\n\n\t\t\tif ( _ray$3.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;\n\n\t\t}\n\n\t\t// convert ray to local space of mesh\n\n\t\t_inverseMatrix$3.copy( matrixWorld ).invert();\n\t\t_ray$3.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$3 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tif ( _ray$3.intersectsBox( geometry.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$3 );\n\n\t}\n\n\t_computeIntersections( raycaster, intersects, rayLocalSpace ) {\n\n\t\tlet intersection;\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\n\t\tconst index = geometry.index;\n\t\tconst position = geometry.attributes.position;\n\t\tconst uv = geometry.attributes.uv;\n\t\tconst uv1 = geometry.attributes.uv1;\n\t\tconst normal = geometry.attributes.normal;\n\t\tconst groups = geometry.groups;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\tif ( index !== null ) {\n\n\t\t\t// indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( index.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = index.getX( j );\n\t\t\t\t\t\tconst b = index.getX( j + 1 );\n\t\t\t\t\t\tconst c = index.getX( j + 2 );\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = index.getX( i );\n\t\t\t\t\tconst b = index.getX( i + 1 );\n\t\t\t\t\tconst c = index.getX( i + 2 );\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( position !== undefined ) {\n\n\t\t\t// non-indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( position.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = j;\n\t\t\t\t\t\tconst b = j + 1;\n\t\t\t\t\t\tconst c = j + 2;\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( position.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = i;\n\t\t\t\t\tconst b = i + 1;\n\t\t\t\t\tconst c = i + 2;\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\n\n\tlet intersect;\n\n\tif ( material.side === BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, ( material.side === FrontSide ), point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\t_intersectionPointWorld.copy( point );\n\t_intersectionPointWorld.applyMatrix4( object.matrixWorld );\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\n\n\treturn {\n\t\tdistance: distance,\n\t\tpoint: _intersectionPointWorld.clone(),\n\t\tobject: object\n\t};\n\n}\n\nfunction checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, normal, a, b, c ) {\n\n\tobject.getVertexPosition( a, _vA$1 );\n\tobject.getVertexPosition( b, _vB$1 );\n\tobject.getVertexPosition( c, _vC$1 );\n\n\tconst intersection = checkIntersection( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );\n\n\tif ( intersection ) {\n\n\t\tif ( uv ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv, c );\n\n\t\t\tintersection.uv = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\n\t\t}\n\n\t\tif ( uv1 ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv1, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv1, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv1, c );\n\n\t\t\tintersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\n\t\t}\n\n\t\tif ( normal ) {\n\n\t\t\t_normalA.fromBufferAttribute( normal, a );\n\t\t\t_normalB.fromBufferAttribute( normal, b );\n\t\t\t_normalC.fromBufferAttribute( normal, c );\n\n\t\t\tintersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3() );\n\n\t\t\tif ( intersection.normal.dot( ray.direction ) > 0 ) {\n\n\t\t\t\tintersection.normal.multiplyScalar( - 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst face = {\n\t\t\ta: a,\n\t\t\tb: b,\n\t\t\tc: c,\n\t\t\tnormal: new Vector3(),\n\t\t\tmaterialIndex: 0\n\t\t};\n\n\t\tTriangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal );\n\n\t\tintersection.face = face;\n\n\t}\n\n\treturn intersection;\n\n}\n\nclass BoxGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'BoxGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\tdepth: depth,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tdepthSegments: depthSegments\n\t\t};\n\n\t\tconst scope = this;\n\n\t\t// segments\n\n\t\twidthSegments = Math.floor( widthSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\t\tdepthSegments = Math.floor( depthSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet numberOfVertices = 0;\n\t\tlet groupStart = 0;\n\n\t\t// build each side of the box geometry\n\n\t\tbuildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px\n\t\tbuildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx\n\t\tbuildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py\n\t\tbuildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny\n\t\tbuildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz\n\t\tbuildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {\n\n\t\t\tconst segmentWidth = width / gridX;\n\t\t\tconst segmentHeight = height / gridY;\n\n\t\t\tconst widthHalf = width / 2;\n\t\t\tconst heightHalf = height / 2;\n\t\t\tconst depthHalf = depth / 2;\n\n\t\t\tconst gridX1 = gridX + 1;\n\t\t\tconst gridY1 = gridY + 1;\n\n\t\t\tlet vertexCounter = 0;\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst vector = new Vector3();\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\t\tconst y = iy * segmentHeight - heightHalf;\n\n\t\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\t\tconst x = ix * segmentWidth - widthHalf;\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = x * udir;\n\t\t\t\t\tvector[ v ] = y * vdir;\n\t\t\t\t\tvector[ w ] = depthHalf;\n\n\t\t\t\t\t// now apply vector to vertex buffer\n\n\t\t\t\t\tvertices.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = 0;\n\t\t\t\t\tvector[ v ] = 0;\n\t\t\t\t\tvector[ w ] = depth > 0 ? 1 : - 1;\n\n\t\t\t\t\t// now apply vector to normal buffer\n\n\t\t\t\t\tnormals.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// uvs\n\n\t\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t\t\t// counters\n\n\t\t\t\t\tvertexCounter += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\t// 1. you need three indices to draw a single face\n\t\t\t// 2. a single segment consists of two faces\n\t\t\t// 3. so we need to generate six (2*3) indices per segment\n\n\t\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\t\tconst a = numberOfVertices + ix + gridX1 * iy;\n\t\t\t\t\tconst b = numberOfVertices + ix + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// increase counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, materialIndex );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t\t// update total number of vertices\n\n\t\t\tnumberOfVertices += vertexCounter;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new BoxGeometry( data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments );\n\n\t}\n\n}\n\n/**\n * Uniform Utilities\n */\n\nfunction cloneUniforms( src ) {\n\n\tconst dst = {};\n\n\tfor ( const u in src ) {\n\n\t\tdst[ u ] = {};\n\n\t\tfor ( const p in src[ u ] ) {\n\n\t\t\tconst property = src[ u ][ p ];\n\n\t\t\tif ( property && ( property.isColor ||\n\t\t\t\tproperty.isMatrix3 || property.isMatrix4 ||\n\t\t\t\tproperty.isVector2 || property.isVector3 || property.isVector4 ||\n\t\t\t\tproperty.isTexture || property.isQuaternion ) ) {\n\n\t\t\t\tif ( property.isRenderTargetTexture ) {\n\n\t\t\t\t\tconsole.warn( 'UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().' );\n\t\t\t\t\tdst[ u ][ p ] = null;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdst[ u ][ p ] = property.clone();\n\n\t\t\t\t}\n\n\t\t\t} else if ( Array.isArray( property ) ) {\n\n\t\t\t\tdst[ u ][ p ] = property.slice();\n\n\t\t\t} else {\n\n\t\t\t\tdst[ u ][ p ] = property;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction mergeUniforms( uniforms ) {\n\n\tconst merged = {};\n\n\tfor ( let u = 0; u < uniforms.length; u ++ ) {\n\n\t\tconst tmp = cloneUniforms( uniforms[ u ] );\n\n\t\tfor ( const p in tmp ) {\n\n\t\t\tmerged[ p ] = tmp[ p ];\n\n\t\t}\n\n\t}\n\n\treturn merged;\n\n}\n\nfunction cloneUniformsGroups( src ) {\n\n\tconst dst = [];\n\n\tfor ( let u = 0; u < src.length; u ++ ) {\n\n\t\tdst.push( src[ u ].clone() );\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction getUnlitUniformColorSpace( renderer ) {\n\n\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\tif ( currentRenderTarget === null ) {\n\n\t\t// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398\n\t\treturn renderer.outputColorSpace;\n\n\t}\n\n\t// https://github.com/mrdoob/three.js/issues/27868\n\tif ( currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\treturn currentRenderTarget.texture.colorSpace;\n\n\t}\n\n\treturn ColorManagement.workingColorSpace;\n\n}\n\n// Legacy\n\nconst UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };\n\nvar default_vertex = \"void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\n\nvar default_fragment = \"void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\n\nclass ShaderMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isShaderMaterial = true;\n\n\t\tthis.type = 'ShaderMaterial';\n\n\t\tthis.defines = {};\n\t\tthis.uniforms = {};\n\t\tthis.uniformsGroups = [];\n\n\t\tthis.vertexShader = default_vertex;\n\t\tthis.fragmentShader = default_fragment;\n\n\t\tthis.linewidth = 1;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.fog = false; // set to use scene fog\n\t\tthis.lights = false; // set to use scene lights\n\t\tthis.clipping = false; // set to use user-defined clipping planes\n\n\t\tthis.forceSinglePass = true;\n\n\t\tthis.extensions = {\n\t\t\tclipCullDistance: false, // set to use vertex shader clipping\n\t\t\tmultiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID\n\t\t};\n\n\t\t// When rendered geometry doesn't include these attributes but the material does,\n\t\t// use these default values in WebGL. This avoids errors when buffer data is missing.\n\t\tthis.defaultAttributeValues = {\n\t\t\t'color': [ 1, 1, 1 ],\n\t\t\t'uv': [ 0, 0 ],\n\t\t\t'uv1': [ 0, 0 ]\n\t\t};\n\n\t\tthis.index0AttributeName = undefined;\n\t\tthis.uniformsNeedUpdate = false;\n\n\t\tthis.glslVersion = null;\n\n\t\tif ( parameters !== undefined ) {\n\n\t\t\tthis.setValues( parameters );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.fragmentShader = source.fragmentShader;\n\t\tthis.vertexShader = source.vertexShader;\n\n\t\tthis.uniforms = cloneUniforms( source.uniforms );\n\t\tthis.uniformsGroups = cloneUniformsGroups( source.uniformsGroups );\n\n\t\tthis.defines = Object.assign( {}, source.defines );\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.fog = source.fog;\n\t\tthis.lights = source.lights;\n\t\tthis.clipping = source.clipping;\n\n\t\tthis.extensions = Object.assign( {}, source.extensions );\n\n\t\tthis.glslVersion = source.glslVersion;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.glslVersion = this.glslVersion;\n\t\tdata.uniforms = {};\n\n\t\tfor ( const name in this.uniforms ) {\n\n\t\t\tconst uniform = this.uniforms[ name ];\n\t\t\tconst value = uniform.value;\n\n\t\t\tif ( value && value.isTexture ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 't',\n\t\t\t\t\tvalue: value.toJSON( meta ).uuid\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isColor ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'c',\n\t\t\t\t\tvalue: value.getHex()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector2 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v2',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\tvalue: value\n\t\t\t\t};\n\n\t\t\t\t// note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( Object.keys( this.defines ).length > 0 ) data.defines = this.defines;\n\n\t\tdata.vertexShader = this.vertexShader;\n\t\tdata.fragmentShader = this.fragmentShader;\n\n\t\tdata.lights = this.lights;\n\t\tdata.clipping = this.clipping;\n\n\t\tconst extensions = {};\n\n\t\tfor ( const key in this.extensions ) {\n\n\t\t\tif ( this.extensions[ key ] === true ) extensions[ key ] = true;\n\n\t\t}\n\n\t\tif ( Object.keys( extensions ).length > 0 ) data.extensions = extensions;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass Camera extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isCamera = true;\n\n\t\tthis.type = 'Camera';\n\n\t\tthis.matrixWorldInverse = new Matrix4();\n\n\t\tthis.projectionMatrix = new Matrix4();\n\t\tthis.projectionMatrixInverse = new Matrix4();\n\n\t\tthis.coordinateSystem = WebGLCoordinateSystem;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.matrixWorldInverse.copy( source.matrixWorldInverse );\n\n\t\tthis.projectionMatrix.copy( source.projectionMatrix );\n\t\tthis.projectionMatrixInverse.copy( source.projectionMatrixInverse );\n\n\t\tthis.coordinateSystem = source.coordinateSystem;\n\n\t\treturn this;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\treturn super.getWorldDirection( target ).negate();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tsuper.updateWorldMatrix( updateParents, updateChildren );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _v3$1 = /*@__PURE__*/ new Vector3();\nconst _minTarget = /*@__PURE__*/ new Vector2();\nconst _maxTarget = /*@__PURE__*/ new Vector2();\n\n\nclass PerspectiveCamera extends Camera {\n\n\tconstructor( fov = 50, aspect = 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isPerspectiveCamera = true;\n\n\t\tthis.type = 'PerspectiveCamera';\n\n\t\tthis.fov = fov;\n\t\tthis.zoom = 1;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.focus = 10;\n\n\t\tthis.aspect = aspect;\n\t\tthis.view = null;\n\n\t\tthis.filmGauge = 35;\t// width of the film (default in millimeters)\n\t\tthis.filmOffset = 0;\t// horizontal film offset (same unit as gauge)\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.fov = source.fov;\n\t\tthis.zoom = source.zoom;\n\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\t\tthis.focus = source.focus;\n\n\t\tthis.aspect = source.aspect;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\tthis.filmGauge = source.filmGauge;\n\t\tthis.filmOffset = source.filmOffset;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the FOV by focal length in respect to the current .filmGauge.\n\t *\n\t * The default film gauge is 35, so that the focal length can be specified for\n\t * a 35mm (full frame) camera.\n\t *\n\t * Values for focal length and film gauge must have the same unit.\n\t */\n\tsetFocalLength( focalLength ) {\n\n\t\t/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */\n\t\tconst vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n\n\t\tthis.fov = RAD2DEG * 2 * Math.atan( vExtentSlope );\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Calculates the focal length from the current .fov and .filmGauge.\n\t */\n\tgetFocalLength() {\n\n\t\tconst vExtentSlope = Math.tan( DEG2RAD * 0.5 * this.fov );\n\n\t\treturn 0.5 * this.getFilmHeight() / vExtentSlope;\n\n\t}\n\n\tgetEffectiveFOV() {\n\n\t\treturn RAD2DEG * 2 * Math.atan(\n\t\t\tMath.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom );\n\n\t}\n\n\tgetFilmWidth() {\n\n\t\t// film not completely covered in portrait format (aspect < 1)\n\t\treturn this.filmGauge * Math.min( this.aspect, 1 );\n\n\t}\n\n\tgetFilmHeight() {\n\n\t\t// film not completely covered in landscape format (aspect > 1)\n\t\treturn this.filmGauge / Math.max( this.aspect, 1 );\n\n\t}\n\n\t/**\n\t * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.\n\t * Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.\n\t */\n\tgetViewBounds( distance, minTarget, maxTarget ) {\n\n\t\t_v3$1.set( - 1, - 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );\n\n\t\tminTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );\n\n\t\t_v3$1.set( 1, 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );\n\n\t\tmaxTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );\n\n\t}\n\n\t/**\n\t * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.\n\t * Copies the result into the target Vector2, where x is width and y is height.\n\t */\n\tgetViewSize( distance, target ) {\n\n\t\tthis.getViewBounds( distance, _minTarget, _maxTarget );\n\n\t\treturn target.subVectors( _maxTarget, _minTarget );\n\n\t}\n\n\t/**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n\t * the monitors are in grid like this\n\t *\n\t * +---+---+---+\n\t * | A | B | C |\n\t * +---+---+---+\n\t * | D | E | F |\n\t * +---+---+---+\n\t *\n\t * then for each monitor you would call it like this\n\t *\n\t * const w = 1920;\n\t * const h = 1080;\n\t * const fullWidth = w * 3;\n\t * const fullHeight = h * 2;\n\t *\n\t * --A--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n\t * --B--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n\t * --C--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n\t * --D--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n\t * --E--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n\t * --F--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n\t *\n\t * Note there is no reason monitors have to be the same size or in a grid.\n\t */\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tthis.aspect = fullWidth / fullHeight;\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst near = this.near;\n\t\tlet top = near * Math.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom;\n\t\tlet height = 2 * top;\n\t\tlet width = this.aspect * height;\n\t\tlet left = - 0.5 * width;\n\t\tconst view = this.view;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst fullWidth = view.fullWidth,\n\t\t\t\tfullHeight = view.fullHeight;\n\n\t\t\tleft += view.offsetX * width / fullWidth;\n\t\t\ttop -= view.offsetY * height / fullHeight;\n\t\t\twidth *= view.width / fullWidth;\n\t\t\theight *= view.height / fullHeight;\n\n\t\t}\n\n\t\tconst skew = this.filmOffset;\n\t\tif ( skew !== 0 ) left += near * skew / this.getFilmWidth();\n\n\t\tthis.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.fov = this.fov;\n\t\tdata.object.zoom = this.zoom;\n\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\t\tdata.object.focus = this.focus;\n\n\t\tdata.object.aspect = this.aspect;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\tdata.object.filmGauge = this.filmGauge;\n\t\tdata.object.filmOffset = this.filmOffset;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst fov = - 90; // negative fov is not an error\nconst aspect = 1;\n\nclass CubeCamera extends Object3D {\n\n\tconstructor( near, far, renderTarget ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubeCamera';\n\n\t\tthis.renderTarget = renderTarget;\n\t\tthis.coordinateSystem = null;\n\t\tthis.activeMipmapLevel = 0;\n\n\t\tconst cameraPX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPX.layers = this.layers;\n\t\tthis.add( cameraPX );\n\n\t\tconst cameraNX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNX.layers = this.layers;\n\t\tthis.add( cameraNX );\n\n\t\tconst cameraPY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPY.layers = this.layers;\n\t\tthis.add( cameraPY );\n\n\t\tconst cameraNY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNY.layers = this.layers;\n\t\tthis.add( cameraNY );\n\n\t\tconst cameraPZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPZ.layers = this.layers;\n\t\tthis.add( cameraPZ );\n\n\t\tconst cameraNZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNZ.layers = this.layers;\n\t\tthis.add( cameraNZ );\n\n\t}\n\n\tupdateCoordinateSystem() {\n\n\t\tconst coordinateSystem = this.coordinateSystem;\n\n\t\tconst cameras = this.children.concat();\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = cameras;\n\n\t\tfor ( const camera of cameras ) this.remove( camera );\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, 1, 0 );\n\t\t\tcameraPX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, 1, 0 );\n\t\t\tcameraNX.lookAt( - 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, - 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, - 1, 0 );\n\t\t\tcameraPX.lookAt( - 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, - 1, 0 );\n\t\t\tcameraNX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, - 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, - 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, - 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tfor ( const camera of cameras ) {\n\n\t\t\tthis.add( camera );\n\n\t\t\tcamera.updateMatrixWorld();\n\n\t\t}\n\n\t}\n\n\tupdate( renderer, scene ) {\n\n\t\tif ( this.parent === null ) this.updateMatrixWorld();\n\n\t\tconst { renderTarget, activeMipmapLevel } = this;\n\n\t\tif ( this.coordinateSystem !== renderer.coordinateSystem ) {\n\n\t\t\tthis.coordinateSystem = renderer.coordinateSystem;\n\n\t\t\tthis.updateCoordinateSystem();\n\n\t\t}\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\t\tconst currentActiveCubeFace = renderer.getActiveCubeFace();\n\t\tconst currentActiveMipmapLevel = renderer.getActiveMipmapLevel();\n\n\t\tconst currentXrEnabled = renderer.xr.enabled;\n\n\t\trenderer.xr.enabled = false;\n\n\t\tconst generateMipmaps = renderTarget.texture.generateMipmaps;\n\n\t\trenderTarget.texture.generateMipmaps = false;\n\n\t\trenderer.setRenderTarget( renderTarget, 0, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPX );\n\n\t\trenderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNX );\n\n\t\trenderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPY );\n\n\t\trenderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNY );\n\n\t\trenderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPZ );\n\n\t\t// mipmaps are generated during the last call of render()\n\t\t// at this point, all sides of the cube render target are defined\n\n\t\trenderTarget.texture.generateMipmaps = generateMipmaps;\n\n\t\trenderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNZ );\n\n\t\trenderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );\n\n\t\trenderer.xr.enabled = currentXrEnabled;\n\n\t\trenderTarget.texture.needsPMREMUpdate = true;\n\n\t}\n\n}\n\nclass CubeTexture extends Texture {\n\n\tconstructor( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace ) {\n\n\t\timages = images !== undefined ? images : [];\n\t\tmapping = mapping !== undefined ? mapping : CubeReflectionMapping;\n\n\t\tsuper( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.flipY = false;\n\n\t}\n\n\tget images() {\n\n\t\treturn this.image;\n\n\t}\n\n\tset images( value ) {\n\n\t\tthis.image = value;\n\n\t}\n\n}\n\nclass WebGLCubeRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( size = 1, options = {} ) {\n\n\t\tsuper( size, size, options );\n\n\t\tthis.isWebGLCubeRenderTarget = true;\n\n\t\tconst image = { width: size, height: size, depth: 1 };\n\t\tconst images = [ image, image, image, image, image, image ];\n\n\t\tthis.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\n\t\t// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)\n\t\t// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,\n\t\t// in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.\n\n\t\t// three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped\n\t\t// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture\n\t\t// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\tthis.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n\t\tthis.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n\n\t}\n\n\tfromEquirectangularTexture( renderer, texture ) {\n\n\t\tthis.texture.type = texture.type;\n\t\tthis.texture.colorSpace = texture.colorSpace;\n\n\t\tthis.texture.generateMipmaps = texture.generateMipmaps;\n\t\tthis.texture.minFilter = texture.minFilter;\n\t\tthis.texture.magFilter = texture.magFilter;\n\n\t\tconst shader = {\n\n\t\t\tuniforms: {\n\t\t\t\ttEquirect: { value: null },\n\t\t\t},\n\n\t\t\tvertexShader: /* glsl */`\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t`,\n\n\t\t\tfragmentShader: /* glsl */`\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t`\n\t\t};\n\n\t\tconst geometry = new BoxGeometry( 5, 5, 5 );\n\n\t\tconst material = new ShaderMaterial( {\n\n\t\t\tname: 'CubemapFromEquirect',\n\n\t\t\tuniforms: cloneUniforms( shader.uniforms ),\n\t\t\tvertexShader: shader.vertexShader,\n\t\t\tfragmentShader: shader.fragmentShader,\n\t\t\tside: BackSide,\n\t\t\tblending: NoBlending\n\n\t\t} );\n\n\t\tmaterial.uniforms.tEquirect.value = texture;\n\n\t\tconst mesh = new Mesh( geometry, material );\n\n\t\tconst currentMinFilter = texture.minFilter;\n\n\t\t// Avoid blurred poles\n\t\tif ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;\n\n\t\tconst camera = new CubeCamera( 1, 10, this );\n\t\tcamera.update( renderer, mesh );\n\n\t\ttexture.minFilter = currentMinFilter;\n\n\t\tmesh.geometry.dispose();\n\t\tmesh.material.dispose();\n\n\t\treturn this;\n\n\t}\n\n\tclear( renderer, color, depth, stencil ) {\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\trenderer.setRenderTarget( this, i );\n\n\t\t\trenderer.clear( color, depth, stencil );\n\n\t\t}\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t}\n\n}\n\nconst _vector1 = /*@__PURE__*/ new Vector3();\nconst _vector2 = /*@__PURE__*/ new Vector3();\nconst _normalMatrix = /*@__PURE__*/ new Matrix3();\n\nclass Plane {\n\n\tconstructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {\n\n\t\tthis.isPlane = true;\n\n\t\t// normal is assumed to be normalized\n\n\t\tthis.normal = normal;\n\t\tthis.constant = constant;\n\n\t}\n\n\tset( normal, constant ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = constant;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponents( x, y, z, w ) {\n\n\t\tthis.normal.set( x, y, z );\n\t\tthis.constant = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromNormalAndCoplanarPoint( normal, point ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = - point.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCoplanarPoints( a, b, c ) {\n\n\t\tconst normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();\n\n\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n\n\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( plane ) {\n\n\t\tthis.normal.copy( plane.normal );\n\t\tthis.constant = plane.constant;\n\n\t\treturn this;\n\n\t}\n\n\tnormalize() {\n\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\n\n\t\tconst inverseNormalLength = 1.0 / this.normal.length();\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\n\t\tthis.constant *= inverseNormalLength;\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.constant *= - 1;\n\t\tthis.normal.negate();\n\n\t\treturn this;\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.normal.dot( point ) + this.constant;\n\n\t}\n\n\tdistanceToSphere( sphere ) {\n\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\n\n\t}\n\n\tprojectPoint( point, target ) {\n\n\t\treturn target.copy( point ).addScaledVector( this.normal, - this.distanceToPoint( point ) );\n\n\t}\n\n\tintersectLine( line, target ) {\n\n\t\tconst direction = line.delta( _vector1 );\n\n\t\tconst denominator = this.normal.dot( direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( this.distanceToPoint( line.start ) === 0 ) {\n\n\t\t\t\treturn target.copy( line.start );\n\n\t\t\t}\n\n\t\t\t// Unsure if this is the correct method to handle this case.\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\n\n\t\tif ( t < 0 || t > 1 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn target.copy( line.start ).addScaledVector( direction, t );\n\n\t}\n\n\tintersectsLine( line ) {\n\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n\n\t\tconst startSign = this.distanceToPoint( line.start );\n\t\tconst endSign = this.distanceToPoint( line.end );\n\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsPlane( this );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn sphere.intersectsPlane( this );\n\n\t}\n\n\tcoplanarPoint( target ) {\n\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.constant );\n\n\t}\n\n\tapplyMatrix4( matrix, optionalNormalMatrix ) {\n\n\t\tconst normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );\n\n\t\tconst referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );\n\n\t\tconst normal = this.normal.applyMatrix3( normalMatrix ).normalize();\n\n\t\tthis.constant = - referencePoint.dot( normal );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.constant -= offset.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tequals( plane ) {\n\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant === this.constant );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _sphere$5 = /*@__PURE__*/ new Sphere();\nconst _vector$7 = /*@__PURE__*/ new Vector3();\n\nclass Frustum {\n\n\tconstructor( p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane() ) {\n\n\t\tthis.planes = [ p0, p1, p2, p3, p4, p5 ];\n\n\t}\n\n\tset( p0, p1, p2, p3, p4, p5 ) {\n\n\t\tconst planes = this.planes;\n\n\t\tplanes[ 0 ].copy( p0 );\n\t\tplanes[ 1 ].copy( p1 );\n\t\tplanes[ 2 ].copy( p2 );\n\t\tplanes[ 3 ].copy( p3 );\n\t\tplanes[ 4 ].copy( p4 );\n\t\tplanes[ 5 ].copy( p5 );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( frustum ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tplanes[ i ].copy( frustum.planes[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst planes = this.planes;\n\t\tconst me = m.elements;\n\t\tconst me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];\n\t\tconst me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];\n\t\tconst me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];\n\t\tconst me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];\n\n\t\tplanes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();\n\t\tplanes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();\n\t\tplanes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();\n\t\tplanes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();\n\t\tplanes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tplanes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tplanes[ 5 ].setComponents( me2, me6, me10, me14 ).normalize();\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tintersectsObject( object ) {\n\n\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\n\t\t\t_sphere$5.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t} else {\n\n\t\t\tconst geometry = object.geometry;\n\n\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t\t_sphere$5.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t}\n\n\t\treturn this.intersectsSphere( _sphere$5 );\n\n\t}\n\n\tintersectsSprite( sprite ) {\n\n\t\t_sphere$5.center.set( 0, 0, 0 );\n\t\t_sphere$5.radius = 0.7071067811865476;\n\t\t_sphere$5.applyMatrix4( sprite.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$5 );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst planes = this.planes;\n\t\tconst center = sphere.center;\n\t\tconst negRadius = - sphere.radius;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst distance = planes[ i ].distanceToPoint( center );\n\n\t\t\tif ( distance < negRadius ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst plane = planes[ i ];\n\n\t\t\t// corner at max distance\n\n\t\t\t_vector$7.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n\t\t\t_vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n\t\t\t_vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n\n\t\t\tif ( plane.distanceToPoint( _vector$7 ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tif ( planes[ i ].distanceToPoint( point ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nfunction WebGLAnimation() {\n\n\tlet context = null;\n\tlet isAnimating = false;\n\tlet animationLoop = null;\n\tlet requestId = null;\n\n\tfunction onAnimationFrame( time, frame ) {\n\n\t\tanimationLoop( time, frame );\n\n\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t}\n\n\treturn {\n\n\t\tstart: function () {\n\n\t\t\tif ( isAnimating === true ) return;\n\t\t\tif ( animationLoop === null ) return;\n\n\t\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t\t\tisAnimating = true;\n\n\t\t},\n\n\t\tstop: function () {\n\n\t\t\tcontext.cancelAnimationFrame( requestId );\n\n\t\t\tisAnimating = false;\n\n\t\t},\n\n\t\tsetAnimationLoop: function ( callback ) {\n\n\t\t\tanimationLoop = callback;\n\n\t\t},\n\n\t\tsetContext: function ( value ) {\n\n\t\t\tcontext = value;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLAttributes( gl ) {\n\n\tconst buffers = new WeakMap();\n\n\tfunction createBuffer( attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst usage = attribute.usage;\n\t\tconst size = array.byteLength;\n\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\t\tgl.bufferData( bufferType, array, usage );\n\n\t\tattribute.onUploadCallback();\n\n\t\tlet type;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\ttype = gl.FLOAT;\n\n\t\t} else if ( array instanceof Uint16Array ) {\n\n\t\t\tif ( attribute.isFloat16BufferAttribute ) {\n\n\t\t\t\ttype = gl.HALF_FLOAT;\n\n\t\t\t} else {\n\n\t\t\t\ttype = gl.UNSIGNED_SHORT;\n\n\t\t\t}\n\n\t\t} else if ( array instanceof Int16Array ) {\n\n\t\t\ttype = gl.SHORT;\n\n\t\t} else if ( array instanceof Uint32Array ) {\n\n\t\t\ttype = gl.UNSIGNED_INT;\n\n\t\t} else if ( array instanceof Int32Array ) {\n\n\t\t\ttype = gl.INT;\n\n\t\t} else if ( array instanceof Int8Array ) {\n\n\t\t\ttype = gl.BYTE;\n\n\t\t} else if ( array instanceof Uint8Array ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else if ( array instanceof Uint8ClampedArray ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.WebGLAttributes: Unsupported buffer data format: ' + array );\n\n\t\t}\n\n\t\treturn {\n\t\t\tbuffer: buffer,\n\t\t\ttype: type,\n\t\t\tbytesPerElement: array.BYTES_PER_ELEMENT,\n\t\t\tversion: attribute.version,\n\t\t\tsize: size\n\t\t};\n\n\t}\n\n\tfunction updateBuffer( buffer, attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst updateRange = attribute._updateRange; // @deprecated, r159\n\t\tconst updateRanges = attribute.updateRanges;\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\n\t\tif ( updateRange.count === - 1 && updateRanges.length === 0 ) {\n\n\t\t\t// Not using update ranges\n\t\t\tgl.bufferSubData( bufferType, 0, array );\n\n\t\t}\n\n\t\tif ( updateRanges.length !== 0 ) {\n\n\t\t\tfor ( let i = 0, l = updateRanges.length; i < l; i ++ ) {\n\n\t\t\t\tconst range = updateRanges[ i ];\n\n\t\t\t\tgl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray, range.start, range.count );\n\n\t\t\t}\n\n\t\t\tattribute.clearUpdateRanges();\n\n\t\t}\n\n\t\t// @deprecated, r159\n\t\tif ( updateRange.count !== - 1 ) {\n\n\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\tarray, updateRange.offset, updateRange.count );\n\n\t\t\tupdateRange.count = - 1; // reset range\n\n\t\t}\n\n\t\tattribute.onUploadCallback();\n\n\t}\n\n\t//\n\n\tfunction get( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\treturn buffers.get( attribute );\n\n\t}\n\n\tfunction remove( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data ) {\n\n\t\t\tgl.deleteBuffer( data.buffer );\n\n\t\t\tbuffers.delete( attribute );\n\n\t\t}\n\n\t}\n\n\tfunction update( attribute, bufferType ) {\n\n\t\tif ( attribute.isGLBufferAttribute ) {\n\n\t\t\tconst cached = buffers.get( attribute );\n\n\t\t\tif ( ! cached || cached.version < attribute.version ) {\n\n\t\t\t\tbuffers.set( attribute, {\n\t\t\t\t\tbuffer: attribute.buffer,\n\t\t\t\t\ttype: attribute.type,\n\t\t\t\t\tbytesPerElement: attribute.elementSize,\n\t\t\t\t\tversion: attribute.version\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data === undefined ) {\n\n\t\t\tbuffers.set( attribute, createBuffer( attribute, bufferType ) );\n\n\t\t} else if ( data.version < attribute.version ) {\n\n\t\t\tif ( data.size !== attribute.array.byteLength ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLAttributes: The size of the buffer attribute\\'s array buffer does not match the original size. Resizing buffer attributes is not supported.' );\n\n\t\t\t}\n\n\t\t\tupdateBuffer( data.buffer, attribute, bufferType );\n\n\t\t\tdata.version = attribute.version;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update\n\n\t};\n\n}\n\nclass PlaneGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PlaneGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments\n\t\t};\n\n\t\tconst width_half = width / 2;\n\t\tconst height_half = height / 2;\n\n\t\tconst gridX = Math.floor( widthSegments );\n\t\tconst gridY = Math.floor( heightSegments );\n\n\t\tconst gridX1 = gridX + 1;\n\t\tconst gridY1 = gridY + 1;\n\n\t\tconst segment_width = width / gridX;\n\t\tconst segment_height = height / gridY;\n\n\t\t//\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\tconst y = iy * segment_height - height_half;\n\n\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\tconst x = ix * segment_width - width_half;\n\n\t\t\t\tvertices.push( x, - y, 0 );\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\tconst a = ix + gridX1 * iy;\n\t\t\t\tconst b = ix + gridX1 * ( iy + 1 );\n\t\t\t\tconst c = ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\tconst d = ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PlaneGeometry( data.width, data.height, data.widthSegments, data.heightSegments );\n\n\t}\n\n}\n\nvar alphahash_fragment = \"#ifdef USE_ALPHAHASH\\n\\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\\n#endif\";\n\nvar alphahash_pars_fragment = \"#ifdef USE_ALPHAHASH\\n\\tconst float ALPHA_HASH_SCALE = 0.05;\\n\\tfloat hash2D( vec2 value ) {\\n\\t\\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\\n\\t}\\n\\tfloat hash3D( vec3 value ) {\\n\\t\\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\\n\\t}\\n\\tfloat getAlphaHashThreshold( vec3 position ) {\\n\\t\\tfloat maxDeriv = max(\\n\\t\\t\\tlength( dFdx( position.xyz ) ),\\n\\t\\t\\tlength( dFdy( position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\\n\\t\\tvec2 pixScales = vec2(\\n\\t\\t\\texp2( floor( log2( pixScale ) ) ),\\n\\t\\t\\texp2( ceil( log2( pixScale ) ) )\\n\\t\\t);\\n\\t\\tvec2 alpha = vec2(\\n\\t\\t\\thash3D( floor( pixScales.x * position.xyz ) ),\\n\\t\\t\\thash3D( floor( pixScales.y * position.xyz ) )\\n\\t\\t);\\n\\t\\tfloat lerpFactor = fract( log2( pixScale ) );\\n\\t\\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\\n\\t\\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\\n\\t\\tvec3 cases = vec3(\\n\\t\\t\\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\\n\\t\\t\\t( x - 0.5 * a ) / ( 1.0 - a ),\\n\\t\\t\\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\\n\\t\\t);\\n\\t\\tfloat threshold = ( x < ( 1.0 - a ) )\\n\\t\\t\\t? ( ( x < a ) ? cases.x : cases.y )\\n\\t\\t\\t: cases.z;\\n\\t\\treturn clamp( threshold , 1.0e-6, 1.0 );\\n\\t}\\n#endif\";\n\nvar alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\\n#endif\";\n\nvar alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar alphatest_fragment = \"#ifdef USE_ALPHATEST\\n\\t#ifdef ALPHA_TO_COVERAGE\\n\\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\\n\\tif ( diffuseColor.a == 0.0 ) discard;\\n\\t#else\\n\\tif ( diffuseColor.a < alphaTest ) discard;\\n\\t#endif\\n#endif\";\n\nvar alphatest_pars_fragment = \"#ifdef USE_ALPHATEST\\n\\tuniform float alphaTest;\\n#endif\";\n\nvar aomap_fragment = \"#ifdef USE_AOMAP\\n\\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\\treflectedLight.indirectDiffuse *= ambientOcclusion;\\n\\t#if defined( USE_CLEARCOAT ) \\n\\t\\tclearcoatSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_SHEEN ) \\n\\t\\tsheenSpecularIndirect *= ambientOcclusion;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\\t\\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\\n\\t\\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\\n\\t#endif\\n#endif\";\n\nvar aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\\tuniform sampler2D aoMap;\\n\\tuniform float aoMapIntensity;\\n#endif\";\n\nvar batching_pars_vertex = \"#ifdef USE_BATCHING\\n\\tattribute float batchId;\\n\\tuniform highp sampler2D batchingTexture;\\n\\tmat4 getBatchingMatrix( const in float i ) {\\n\\t\\tint size = textureSize( batchingTexture, 0 ).x;\\n\\t\\tint j = int( i ) * 4;\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\\n\\t\\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\\n\\t\\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\\n\\t\\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\\n\\t\\treturn mat4( v1, v2, v3, v4 );\\n\\t}\\n#endif\";\n\nvar batching_vertex = \"#ifdef USE_BATCHING\\n\\tmat4 batchingMatrix = getBatchingMatrix( batchId );\\n#endif\";\n\nvar begin_vertex = \"vec3 transformed = vec3( position );\\n#ifdef USE_ALPHAHASH\\n\\tvPosition = vec3( position );\\n#endif\";\n\nvar beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\n\nvar bsdfs = \"float G_BlinnPhong_Implicit( ) {\\n\\treturn 0.25;\\n}\\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\\n\\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\n}\\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\\n\\tfloat G = G_BlinnPhong_Implicit( );\\n\\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\\treturn F * ( G * D );\\n} // validated\";\n\nvar iridescence_fragment = \"#ifdef USE_IRIDESCENCE\\n\\tconst mat3 XYZ_TO_REC709 = mat3(\\n\\t\\t 3.2404542, -0.9692660, 0.0556434,\\n\\t\\t-1.5371385, 1.8760108, -0.2040259,\\n\\t\\t-0.4985314, 0.0415560, 1.0572252\\n\\t);\\n\\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\\n\\t\\tvec3 sqrtF0 = sqrt( fresnel0 );\\n\\t\\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\\n\\t}\\n\\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\\n\\t}\\n\\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\\n\\t}\\n\\tvec3 evalSensitivity( float OPD, vec3 shift ) {\\n\\t\\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\\n\\t\\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\\n\\t\\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\\n\\t\\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\\n\\t\\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\\n\\t\\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\\n\\t\\txyz /= 1.0685e-7;\\n\\t\\tvec3 rgb = XYZ_TO_REC709 * xyz;\\n\\t\\treturn rgb;\\n\\t}\\n\\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\\n\\t\\tvec3 I;\\n\\t\\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\\n\\t\\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\\n\\t\\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\\n\\t\\tif ( cosTheta2Sq < 0.0 ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t}\\n\\t\\tfloat cosTheta2 = sqrt( cosTheta2Sq );\\n\\t\\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\\n\\t\\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\\n\\t\\tfloat T121 = 1.0 - R12;\\n\\t\\tfloat phi12 = 0.0;\\n\\t\\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\\n\\t\\tfloat phi21 = PI - phi12;\\n\\t\\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\\t\\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\\n\\t\\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\\n\\t\\tvec3 phi23 = vec3( 0.0 );\\n\\t\\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\\n\\t\\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\\n\\t\\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\\n\\t\\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\\n\\t\\tvec3 phi = vec3( phi21 ) + phi23;\\n\\t\\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\\n\\t\\tvec3 r123 = sqrt( R123 );\\n\\t\\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\\n\\t\\tvec3 C0 = R12 + Rs;\\n\\t\\tI = C0;\\n\\t\\tvec3 Cm = Rs - T121;\\n\\t\\tfor ( int m = 1; m <= 2; ++ m ) {\\n\\t\\t\\tCm *= r123;\\n\\t\\t\\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\\n\\t\\t\\tI += Cm * Sm;\\n\\t\\t}\\n\\t\\treturn max( I, vec3( 0.0 ) );\\n\\t}\\n#endif\";\n\nvar bumpmap_pars_fragment = \"#ifdef USE_BUMPMAP\\n\\tuniform sampler2D bumpMap;\\n\\tuniform float bumpScale;\\n\\tvec2 dHdxy_fwd() {\\n\\t\\tvec2 dSTdx = dFdx( vBumpMapUv );\\n\\t\\tvec2 dSTdy = dFdy( vBumpMapUv );\\n\\t\\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\\n\\t\\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\\n\\t\\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\\n\\t\\treturn vec2( dBx, dBy );\\n\\t}\\n\\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\\n\\t\\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\\n\\t\\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\\n\\t\\tvec3 vN = surf_norm;\\n\\t\\tvec3 R1 = cross( vSigmaY, vN );\\n\\t\\tvec3 R2 = cross( vN, vSigmaX );\\n\\t\\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\\n\\t\\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\\t\\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\\t}\\n#endif\";\n\nvar clipping_planes_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvec4 plane;\\n\\t#ifdef ALPHA_TO_COVERAGE\\n\\t\\tfloat distanceToPlane, distanceGradient;\\n\\t\\tfloat clipOpacity = 1.0;\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\n\\t\\t\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\n\\t\\t\\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\n\\t\\t\\tif ( clipOpacity == 0.0 ) discard;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\t\\tfloat unionClipOpacity = 1.0;\\n\\t\\t\\t#pragma unroll_loop_start\\n\\t\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\t\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\n\\t\\t\\t\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\n\\t\\t\\t\\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\n\\t\\t\\t}\\n\\t\\t\\t#pragma unroll_loop_end\\n\\t\\t\\tclipOpacity *= 1.0 - unionClipOpacity;\\n\\t\\t#endif\\n\\t\\tdiffuseColor.a *= clipOpacity;\\n\\t\\tif ( diffuseColor.a == 0.0 ) discard;\\n\\t#else\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\t\\tbool clipped = true;\\n\\t\\t\\t#pragma unroll_loop_start\\n\\t\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\t\\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\\n\\t\\t\\t}\\n\\t\\t\\t#pragma unroll_loop_end\\n\\t\\t\\tif ( clipped ) discard;\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n\\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\n\nvar clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n#endif\";\n\nvar clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvClipPosition = - mvPosition.xyz;\\n#endif\";\n\nvar color_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tdiffuseColor *= vColor;\\n#elif defined( USE_COLOR )\\n\\tdiffuseColor.rgb *= vColor;\\n#endif\";\n\nvar color_pars_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_pars_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvColor = vec4( 1.0 );\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvColor = vec3( 1.0 );\\n#endif\\n#ifdef USE_COLOR\\n\\tvColor *= color;\\n#endif\\n#ifdef USE_INSTANCING_COLOR\\n\\tvColor.xyz *= instanceColor.xyz;\\n#endif\";\n\nvar common = \"#define PI 3.141592653589793\\n#define PI2 6.283185307179586\\n#define PI_HALF 1.5707963267948966\\n#define RECIPROCAL_PI 0.3183098861837907\\n#define RECIPROCAL_PI2 0.15915494309189535\\n#define EPSILON 1e-6\\n#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\\nfloat pow2( const in float x ) { return x*x; }\\nvec3 pow2( const in vec3 x ) { return x*x; }\\nfloat pow3( const in float x ) { return x*x*x; }\\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\\nhighp float rand( const in vec2 uv ) {\\n\\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n\\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\\n\\treturn fract( sin( sn ) * c );\\n}\\n#ifdef HIGH_PRECISION\\n\\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\n#else\\n\\tfloat precisionSafeLength( vec3 v ) {\\n\\t\\tfloat maxComponent = max3( abs( v ) );\\n\\t\\treturn length( v / maxComponent ) * maxComponent;\\n\\t}\\n#endif\\nstruct IncidentLight {\\n\\tvec3 color;\\n\\tvec3 direction;\\n\\tbool visible;\\n};\\nstruct ReflectedLight {\\n\\tvec3 directDiffuse;\\n\\tvec3 directSpecular;\\n\\tvec3 indirectDiffuse;\\n\\tvec3 indirectSpecular;\\n};\\n#ifdef USE_ALPHAHASH\\n\\tvarying vec3 vPosition;\\n#endif\\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\n}\\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\\n}\\nmat3 transposeMat3( const in mat3 m ) {\\n\\tmat3 tmp;\\n\\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\\n\\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\\n\\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\\n\\treturn tmp;\\n}\\nfloat luminance( const in vec3 rgb ) {\\n\\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\\n\\treturn dot( weights, rgb );\\n}\\nbool isPerspectiveMatrix( mat4 m ) {\\n\\treturn m[ 2 ][ 3 ] == - 1.0;\\n}\\nvec2 equirectUv( in vec3 dir ) {\\n\\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\\n\\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\\treturn vec2( u, v );\\n}\\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\\n\\treturn RECIPROCAL_PI * diffuseColor;\\n}\\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n}\\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n} // validated\";\n\nvar cube_uv_reflection_fragment = \"#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t#define cubeUV_minMipLevel 4.0\\n\\t#define cubeUV_minTileSize 16.0\\n\\tfloat getFace( vec3 direction ) {\\n\\t\\tvec3 absDirection = abs( direction );\\n\\t\\tfloat face = - 1.0;\\n\\t\\tif ( absDirection.x > absDirection.z ) {\\n\\t\\t\\tif ( absDirection.x > absDirection.y )\\n\\t\\t\\t\\tface = direction.x > 0.0 ? 0.0 : 3.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t} else {\\n\\t\\t\\tif ( absDirection.z > absDirection.y )\\n\\t\\t\\t\\tface = direction.z > 0.0 ? 2.0 : 5.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t}\\n\\t\\treturn face;\\n\\t}\\n\\tvec2 getUV( vec3 direction, float face ) {\\n\\t\\tvec2 uv;\\n\\t\\tif ( face == 0.0 ) {\\n\\t\\t\\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 1.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\\n\\t\\t} else if ( face == 2.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\\n\\t\\t} else if ( face == 3.0 ) {\\n\\t\\t\\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 4.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\\n\\t\\t} else {\\n\\t\\t\\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\\n\\t\\t}\\n\\t\\treturn 0.5 * ( uv + 1.0 );\\n\\t}\\n\\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\\n\\t\\tfloat face = getFace( direction );\\n\\t\\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\\n\\t\\tmipInt = max( mipInt, cubeUV_minMipLevel );\\n\\t\\tfloat faceSize = exp2( mipInt );\\n\\t\\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\\n\\t\\tif ( face > 2.0 ) {\\n\\t\\t\\tuv.y += faceSize;\\n\\t\\t\\tface -= 3.0;\\n\\t\\t}\\n\\t\\tuv.x += face * faceSize;\\n\\t\\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\\n\\t\\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\\n\\t\\tuv.x *= CUBEUV_TEXEL_WIDTH;\\n\\t\\tuv.y *= CUBEUV_TEXEL_HEIGHT;\\n\\t\\t#ifdef texture2DGradEXT\\n\\t\\t\\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\\n\\t\\t#else\\n\\t\\t\\treturn texture2D( envMap, uv ).rgb;\\n\\t\\t#endif\\n\\t}\\n\\t#define cubeUV_r0 1.0\\n\\t#define cubeUV_m0 - 2.0\\n\\t#define cubeUV_r1 0.8\\n\\t#define cubeUV_m1 - 1.0\\n\\t#define cubeUV_r4 0.4\\n\\t#define cubeUV_m4 2.0\\n\\t#define cubeUV_r5 0.305\\n\\t#define cubeUV_m5 3.0\\n\\t#define cubeUV_r6 0.21\\n\\t#define cubeUV_m6 4.0\\n\\tfloat roughnessToMip( float roughness ) {\\n\\t\\tfloat mip = 0.0;\\n\\t\\tif ( roughness >= cubeUV_r1 ) {\\n\\t\\t\\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\\n\\t\\t} else if ( roughness >= cubeUV_r4 ) {\\n\\t\\t\\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\\n\\t\\t} else if ( roughness >= cubeUV_r5 ) {\\n\\t\\t\\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\\n\\t\\t} else if ( roughness >= cubeUV_r6 ) {\\n\\t\\t\\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\\n\\t\\t} else {\\n\\t\\t\\tmip = - 2.0 * log2( 1.16 * roughness );\\t\\t}\\n\\t\\treturn mip;\\n\\t}\\n\\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\\n\\t\\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\\n\\t\\tfloat mipF = fract( mip );\\n\\t\\tfloat mipInt = floor( mip );\\n\\t\\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\\n\\t\\tif ( mipF == 0.0 ) {\\n\\t\\t\\treturn vec4( color0, 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\\n\\t\\t\\treturn vec4( mix( color0, color1, mipF ), 1.0 );\\n\\t\\t}\\n\\t}\\n#endif\";\n\nvar defaultnormal_vertex = \"vec3 transformedNormal = objectNormal;\\n#ifdef USE_TANGENT\\n\\tvec3 transformedTangent = objectTangent;\\n#endif\\n#ifdef USE_BATCHING\\n\\tmat3 bm = mat3( batchingMatrix );\\n\\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\\n\\ttransformedNormal = bm * transformedNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\ttransformedTangent = bm * transformedTangent;\\n\\t#endif\\n#endif\\n#ifdef USE_INSTANCING\\n\\tmat3 im = mat3( instanceMatrix );\\n\\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\\n\\ttransformedNormal = im * transformedNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\ttransformedTangent = im * transformedTangent;\\n\\t#endif\\n#endif\\ntransformedNormal = normalMatrix * transformedNormal;\\n#ifdef FLIP_SIDED\\n\\ttransformedNormal = - transformedNormal;\\n#endif\\n#ifdef USE_TANGENT\\n\\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\\n\\t#ifdef FLIP_SIDED\\n\\t\\ttransformedTangent = - transformedTangent;\\n\\t#endif\\n#endif\";\n\nvar displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\tuniform sampler2D displacementMap;\\n\\tuniform float displacementScale;\\n\\tuniform float displacementBias;\\n#endif\";\n\nvar displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\\n#endif\";\n\nvar emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\\n\\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\n\nvar emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tuniform sampler2D emissiveMap;\\n#endif\";\n\nvar colorspace_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\n\nvar colorspace_pars_fragment = \"\\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\\n\\tvec3( 0.8224621, 0.177538, 0.0 ),\\n\\tvec3( 0.0331941, 0.9668058, 0.0 ),\\n\\tvec3( 0.0170827, 0.0723974, 0.9105199 )\\n);\\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.2249401, - 0.2249404, 0.0 ),\\n\\tvec3( - 0.0420569, 1.0420571, 0.0 ),\\n\\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\\n);\\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\\n}\\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\\n}\\nvec4 LinearTransferOETF( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 sRGBTransferOETF( in vec4 value ) {\\n\\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\\n}\\nvec4 LinearToLinear( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 LinearTosRGB( in vec4 value ) {\\n\\treturn sRGBTransferOETF( value );\\n}\";\n\nvar envmap_fragment = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvec3 cameraToFrag;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#else\\n\\t\\tvec3 reflectVec = vReflect;\\n\\t#endif\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\\t#else\\n\\t\\tvec4 envColor = vec4( 0.0 );\\n\\t#endif\\n\\t#ifdef ENVMAP_BLENDING_MULTIPLY\\n\\t\\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_MIX )\\n\\t\\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_ADD )\\n\\t\\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\\n\\t#endif\\n#endif\";\n\nvar envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float envMapIntensity;\\n\\tuniform float flipEnvMap;\\n\\tuniform mat3 envMapRotation;\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tuniform samplerCube envMap;\\n\\t#else\\n\\t\\tuniform sampler2D envMap;\\n\\t#endif\\n\\t\\n#endif\";\n\nvar envmap_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float reflectivity;\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t\\tuniform float refractionRatio;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t#endif\\n#endif\";\n\nvar envmap_pars_vertex = \"#ifdef USE_ENVMAP\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\t\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t\\tuniform float refractionRatio;\\n\\t#endif\\n#endif\";\n\nvar envmap_vertex = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvWorldPosition = worldPosition.xyz;\\n\\t#else\\n\\t\\tvec3 cameraToVertex;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvReflect = reflect( cameraToVertex, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar fog_vertex = \"#ifdef USE_FOG\\n\\tvFogDepth = - mvPosition.z;\\n#endif\";\n\nvar fog_pars_vertex = \"#ifdef USE_FOG\\n\\tvarying float vFogDepth;\\n#endif\";\n\nvar fog_fragment = \"#ifdef USE_FOG\\n\\t#ifdef FOG_EXP2\\n\\t\\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\\n\\t#else\\n\\t\\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\\n\\t#endif\\n\\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n#endif\";\n\nvar fog_pars_fragment = \"#ifdef USE_FOG\\n\\tuniform vec3 fogColor;\\n\\tvarying float vFogDepth;\\n\\t#ifdef FOG_EXP2\\n\\t\\tuniform float fogDensity;\\n\\t#else\\n\\t\\tuniform float fogNear;\\n\\t\\tuniform float fogFar;\\n\\t#endif\\n#endif\";\n\nvar gradientmap_pars_fragment = \"#ifdef USE_GRADIENTMAP\\n\\tuniform sampler2D gradientMap;\\n#endif\\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\\n\\tfloat dotNL = dot( normal, lightDirection );\\n\\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\\n\\t#ifdef USE_GRADIENTMAP\\n\\t\\treturn vec3( texture2D( gradientMap, coord ).r );\\n\\t#else\\n\\t\\tvec2 fw = fwidth( coord ) * 0.5;\\n\\t\\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\\n\\t#endif\\n}\";\n\nvar lightmap_fragment = \"#ifdef USE_LIGHTMAP\\n\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\treflectedLight.indirectDiffuse += lightMapIrradiance;\\n#endif\";\n\nvar lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\\tuniform sampler2D lightMap;\\n\\tuniform float lightMapIntensity;\\n#endif\";\n\nvar lights_lambert_fragment = \"LambertMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_lambert_pars_fragment = \"varying vec3 vViewPosition;\\nstruct LambertMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Lambert\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Lambert\";\n\nvar lights_pars_begin = \"uniform bool receiveShadow;\\nuniform vec3 ambientLightColor;\\n#if defined( USE_LIGHT_PROBES )\\n\\tuniform vec3 lightProbe[ 9 ];\\n#endif\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\n\\tfloat x = normal.x, y = normal.y, z = normal.z;\\n\\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\n\\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\n\\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\n\\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\n\\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\n\\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\n\\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\n\\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\n\\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\n\\treturn result;\\n}\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\\n\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\n\\treturn irradiance;\\n}\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\n\\tvec3 irradiance = ambientLightColor;\\n\\treturn irradiance;\\n}\\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\n\\t#if defined ( LEGACY_LIGHTS )\\n\\t\\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\\n\\t\\t\\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\\n\\t\\t}\\n\\t\\treturn 1.0;\\n\\t#else\\n\\t\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\t\\tif ( cutoffDistance > 0.0 ) {\\n\\t\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t\\t}\\n\\t\\treturn distanceFalloff;\\n\\t#endif\\n}\\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\\n\\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\\n}\\n#if NUM_DIR_LIGHTS > 0\\n\\tstruct DirectionalLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t};\\n\\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\n\\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\\n\\t\\tlight.color = directionalLight.color;\\n\\t\\tlight.direction = directionalLight.direction;\\n\\t\\tlight.visible = true;\\n\\t}\\n#endif\\n#if NUM_POINT_LIGHTS > 0\\n\\tstruct PointLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t};\\n\\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\n\\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = pointLight.position - geometryPosition;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat lightDistance = length( lVector );\\n\\t\\tlight.color = pointLight.color;\\n\\t\\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\\n\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t}\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\\tstruct SpotLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t\\tfloat coneCos;\\n\\t\\tfloat penumbraCos;\\n\\t};\\n\\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\n\\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\\n\\t\\tvec3 lVector = spotLight.position - geometryPosition;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat angleCos = dot( light.direction, spotLight.direction );\\n\\t\\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\n\\t\\tif ( spotAttenuation > 0.0 ) {\\n\\t\\t\\tfloat lightDistance = length( lVector );\\n\\t\\t\\tlight.color = spotLight.color * spotAttenuation;\\n\\t\\t\\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\\n\\t\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t\\t} else {\\n\\t\\t\\tlight.color = vec3( 0.0 );\\n\\t\\t\\tlight.visible = false;\\n\\t\\t}\\n\\t}\\n#endif\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tstruct RectAreaLight {\\n\\t\\tvec3 color;\\n\\t\\tvec3 position;\\n\\t\\tvec3 halfWidth;\\n\\t\\tvec3 halfHeight;\\n\\t};\\n\\tuniform sampler2D ltc_1;\\tuniform sampler2D ltc_2;\\n\\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\\tstruct HemisphereLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 skyColor;\\n\\t\\tvec3 groundColor;\\n\\t};\\n\\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\\n\\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\\n\\t\\tfloat dotNL = dot( normal, hemiLight.direction );\\n\\t\\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\n\\t\\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\n\\t\\treturn irradiance;\\n\\t}\\n#endif\";\n\nvar envmap_physical_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tvec3 getIBLIrradiance( const in vec3 normal ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\\n\\t\\t\\treturn PI * envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\\n\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\tvec3 reflectVec = reflect( - viewDir, normal );\\n\\t\\t\\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\\n\\t\\t\\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\\n\\t\\t\\treturn envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\\n\\t\\t\\t#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\t\\tvec3 bentNormal = cross( bitangent, viewDir );\\n\\t\\t\\t\\tbentNormal = normalize( cross( bentNormal, bitangent ) );\\n\\t\\t\\t\\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\\n\\t\\t\\t\\treturn getIBLRadiance( viewDir, bentNormal, roughness );\\n\\t\\t\\t#else\\n\\t\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t#endif\\n#endif\";\n\nvar lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\";\n\nvar lights_toon_pars_fragment = \"varying vec3 vViewPosition;\\nstruct ToonMaterial {\\n\\tvec3 diffuseColor;\\n};\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Toon\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Toon\";\n\nvar lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_phong_pars_fragment = \"varying vec3 vViewPosition;\\nstruct BlinnPhongMaterial {\\n\\tvec3 diffuseColor;\\n\\tvec3 specularColor;\\n\\tfloat specularShininess;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_BlinnPhong\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_BlinnPhong\";\n\nvar lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\\nmaterial.roughness = min( material.roughness, 1.0 );\\n#ifdef IOR\\n\\tmaterial.ior = ior;\\n\\t#ifdef USE_SPECULAR\\n\\t\\tfloat specularIntensityFactor = specularIntensity;\\n\\t\\tvec3 specularColorFactor = specularColor;\\n\\t\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\t\\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\\n\\t\\t#endif\\n\\t\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\t\\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\\n\\t\\t#endif\\n\\t\\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\\n\\t#else\\n\\t\\tfloat specularIntensityFactor = 1.0;\\n\\t\\tvec3 specularColorFactor = vec3( 1.0 );\\n\\t\\tmaterial.specularF90 = 1.0;\\n\\t#endif\\n\\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\\n#else\\n\\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\\n\\tmaterial.specularF90 = 1.0;\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tmaterial.clearcoat = clearcoat;\\n\\tmaterial.clearcoatRoughness = clearcoatRoughness;\\n\\tmaterial.clearcoatF0 = vec3( 0.04 );\\n\\tmaterial.clearcoatF90 = 1.0;\\n\\t#ifdef USE_CLEARCOATMAP\\n\\t\\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\t\\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\\n\\t#endif\\n\\tmaterial.clearcoat = saturate( material.clearcoat );\\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\\n\\tmaterial.clearcoatRoughness += geometryRoughness;\\n\\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tmaterial.iridescence = iridescence;\\n\\tmaterial.iridescenceIOR = iridescenceIOR;\\n\\t#ifdef USE_IRIDESCENCEMAP\\n\\t\\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\t\\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\\n\\t#else\\n\\t\\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\\n\\t#endif\\n#endif\\n#ifdef USE_SHEEN\\n\\tmaterial.sheenColor = sheenColor;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\\n\\t#endif\\n\\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\\n\\t\\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\\n\\t\\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\\n\\t#else\\n\\t\\tvec2 anisotropyV = anisotropyVector;\\n\\t#endif\\n\\tmaterial.anisotropy = length( anisotropyV );\\n\\tif( material.anisotropy == 0.0 ) {\\n\\t\\tanisotropyV = vec2( 1.0, 0.0 );\\n\\t} else {\\n\\t\\tanisotropyV /= material.anisotropy;\\n\\t\\tmaterial.anisotropy = saturate( material.anisotropy );\\n\\t}\\n\\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\\n\\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\\n\\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\\n#endif\";\n\nvar lights_physical_pars_fragment = \"struct PhysicalMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat roughness;\\n\\tvec3 specularColor;\\n\\tfloat specularF90;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat clearcoat;\\n\\t\\tfloat clearcoatRoughness;\\n\\t\\tvec3 clearcoatF0;\\n\\t\\tfloat clearcoatF90;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tfloat iridescence;\\n\\t\\tfloat iridescenceIOR;\\n\\t\\tfloat iridescenceThickness;\\n\\t\\tvec3 iridescenceFresnel;\\n\\t\\tvec3 iridescenceF0;\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tvec3 sheenColor;\\n\\t\\tfloat sheenRoughness;\\n\\t#endif\\n\\t#ifdef IOR\\n\\t\\tfloat ior;\\n\\t#endif\\n\\t#ifdef USE_TRANSMISSION\\n\\t\\tfloat transmission;\\n\\t\\tfloat transmissionAlpha;\\n\\t\\tfloat thickness;\\n\\t\\tfloat attenuationDistance;\\n\\t\\tvec3 attenuationColor;\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat anisotropy;\\n\\t\\tfloat alphaT;\\n\\t\\tvec3 anisotropyT;\\n\\t\\tvec3 anisotropyB;\\n\\t#endif\\n};\\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\\nvec3 sheenSpecularDirect = vec3( 0.0 );\\nvec3 sheenSpecularIndirect = vec3(0.0 );\\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\\n float x2 = x * x;\\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\\n}\\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\n\\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\n\\treturn 0.5 / max( gv + gl, EPSILON );\\n}\\nfloat D_GGX( const in float alpha, const in float dotNH ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\\n\\treturn RECIPROCAL_PI * a2 / pow2( denom );\\n}\\n#ifdef USE_ANISOTROPY\\n\\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\\n\\t\\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\\n\\t\\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\\n\\t\\tfloat v = 0.5 / ( gv + gl );\\n\\t\\treturn saturate(v);\\n\\t}\\n\\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\\n\\t\\tfloat a2 = alphaT * alphaB;\\n\\t\\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\\n\\t\\thighp float v2 = dot( v, v );\\n\\t\\tfloat w2 = a2 / v2;\\n\\t\\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\\n\\t}\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\\n\\t\\tvec3 f0 = material.clearcoatF0;\\n\\t\\tfloat f90 = material.clearcoatF90;\\n\\t\\tfloat roughness = material.clearcoatRoughness;\\n\\t\\tfloat alpha = pow2( roughness );\\n\\t\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\t\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\t\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\t\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\t\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\t\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t\\treturn F * ( V * D );\\n\\t}\\n#endif\\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\n\\tvec3 f0 = material.specularColor;\\n\\tfloat f90 = material.specularF90;\\n\\tfloat roughness = material.roughness;\\n\\tfloat alpha = pow2( roughness );\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tF = mix( F, material.iridescenceFresnel, material.iridescence );\\n\\t#endif\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tfloat dotTL = dot( material.anisotropyT, lightDir );\\n\\t\\tfloat dotTV = dot( material.anisotropyT, viewDir );\\n\\t\\tfloat dotTH = dot( material.anisotropyT, halfDir );\\n\\t\\tfloat dotBL = dot( material.anisotropyB, lightDir );\\n\\t\\tfloat dotBV = dot( material.anisotropyB, viewDir );\\n\\t\\tfloat dotBH = dot( material.anisotropyB, halfDir );\\n\\t\\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\\n\\t\\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\\n\\t#else\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t#endif\\n\\treturn F * ( V * D );\\n}\\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\\n\\tconst float LUT_SIZE = 64.0;\\n\\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\\n\\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\\n\\tfloat dotNV = saturate( dot( N, V ) );\\n\\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\\n\\tuv = uv * LUT_SCALE + LUT_BIAS;\\n\\treturn uv;\\n}\\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\\n\\tfloat l = length( f );\\n\\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\\n}\\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\\n\\tfloat x = dot( v1, v2 );\\n\\tfloat y = abs( x );\\n\\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\\n\\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\\n\\tfloat v = a / b;\\n\\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\\n\\treturn cross( v1, v2 ) * theta_sintheta;\\n}\\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\\n\\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\\n\\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\\n\\tvec3 lightNormal = cross( v1, v2 );\\n\\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\\n\\tvec3 T1, T2;\\n\\tT1 = normalize( V - N * dot( V, N ) );\\n\\tT2 = - cross( N, T1 );\\n\\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\\n\\tvec3 coords[ 4 ];\\n\\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\\n\\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\\n\\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\\n\\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\\n\\tcoords[ 0 ] = normalize( coords[ 0 ] );\\n\\tcoords[ 1 ] = normalize( coords[ 1 ] );\\n\\tcoords[ 2 ] = normalize( coords[ 2 ] );\\n\\tcoords[ 3 ] = normalize( coords[ 3 ] );\\n\\tvec3 vectorFormFactor = vec3( 0.0 );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\\n\\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\\n\\treturn vec3( result );\\n}\\n#if defined( USE_SHEEN )\\nfloat D_Charlie( float roughness, float dotNH ) {\\n\\tfloat alpha = pow2( roughness );\\n\\tfloat invAlpha = 1.0 / alpha;\\n\\tfloat cos2h = dotNH * dotNH;\\n\\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\\n\\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\\n}\\nfloat V_Neubelt( float dotNV, float dotNL ) {\\n\\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\\n}\\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat D = D_Charlie( sheenRoughness, dotNH );\\n\\tfloat V = V_Neubelt( dotNV, dotNL );\\n\\treturn sheenColor * ( D * V );\\n}\\n#endif\\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat r2 = roughness * roughness;\\n\\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\\n\\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\\n\\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\\n\\treturn saturate( DG * RECIPROCAL_PI );\\n}\\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\\n\\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\\n\\tvec4 r = roughness * c0 + c1;\\n\\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\\n\\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\\n\\treturn fab;\\n}\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\treturn specularColor * fab.x + specularF90 * fab.y;\\n}\\n#ifdef USE_IRIDESCENCE\\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#else\\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#endif\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\\n\\t#else\\n\\t\\tvec3 Fr = specularColor;\\n\\t#endif\\n\\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\\n\\tfloat Ess = fab.x + fab.y;\\n\\tfloat Ems = 1.0 - Ess;\\n\\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\n\\tsingleScatter += FssEss;\\n\\tmultiScatter += Fms * Ems;\\n}\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\t\\tvec3 normal = geometryNormal;\\n\\t\\tvec3 viewDir = geometryViewDir;\\n\\t\\tvec3 position = geometryPosition;\\n\\t\\tvec3 lightPos = rectAreaLight.position;\\n\\t\\tvec3 halfWidth = rectAreaLight.halfWidth;\\n\\t\\tvec3 halfHeight = rectAreaLight.halfHeight;\\n\\t\\tvec3 lightColor = rectAreaLight.color;\\n\\t\\tfloat roughness = material.roughness;\\n\\t\\tvec3 rectCoords[ 4 ];\\n\\t\\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\\t\\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\\n\\t\\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\\n\\t\\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\\n\\t\\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\\n\\t\\tvec4 t1 = texture2D( ltc_1, uv );\\n\\t\\tvec4 t2 = texture2D( ltc_2, uv );\\n\\t\\tmat3 mInv = mat3(\\n\\t\\t\\tvec3( t1.x, 0, t1.y ),\\n\\t\\t\\tvec3( 0, 1, 0 ),\\n\\t\\t\\tvec3( t1.z, 0, t1.w )\\n\\t\\t);\\n\\t\\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\\n\\t\\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\n\\t\\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\\n\\t}\\n#endif\\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\\n\\t\\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\\t\\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\\n\\t#endif\\n\\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\\n\\t#endif\\n\\tvec3 singleScattering = vec3( 0.0 );\\n\\tvec3 multiScattering = vec3( 0.0 );\\n\\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\\n\\t#else\\n\\t\\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\\n\\t#endif\\n\\tvec3 totalScattering = singleScattering + multiScattering;\\n\\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\\n\\treflectedLight.indirectSpecular += radiance * singleScattering;\\n\\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Physical\\n#define RE_Direct_RectArea\\t\\tRE_Direct_RectArea_Physical\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Physical\\n#define RE_IndirectSpecular\\t\\tRE_IndirectSpecular_Physical\\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\\n\\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\\n}\";\n\nvar lights_fragment_begin = \"\\nvec3 geometryPosition = - vViewPosition;\\nvec3 geometryNormal = normal;\\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\nvec3 geometryClearcoatNormal = vec3( 0.0 );\\n#ifdef USE_CLEARCOAT\\n\\tgeometryClearcoatNormal = clearcoatNormal;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\\n\\tif ( material.iridescenceThickness == 0.0 ) {\\n\\t\\tmaterial.iridescence = 0.0;\\n\\t} else {\\n\\t\\tmaterial.iridescence = saturate( material.iridescence );\\n\\t}\\n\\tif ( material.iridescence > 0.0 ) {\\n\\t\\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\\n\\t\\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\\n\\t}\\n#endif\\nIncidentLight directLight;\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tPointLight pointLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\\t\\tpointLight = pointLights[ i ];\\n\\t\\tgetPointLightInfo( pointLight, geometryPosition, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\\n\\t\\tpointLightShadow = pointLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tSpotLight spotLight;\\n\\tvec4 spotColor;\\n\\tvec3 spotLightCoord;\\n\\tbool inSpotLightMap;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\\t\\tspotLight = spotLights[ i ];\\n\\t\\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\\n\\t\\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\\n\\t\\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\\n\\t\\t#else\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#endif\\n\\t\\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\\n\\t\\t\\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\\n\\t\\t\\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\\n\\t\\t\\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\\n\\t\\t\\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\\n\\t\\t#endif\\n\\t\\t#undef SPOT_LIGHT_MAP_INDEX\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\tspotLightShadow = spotLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tDirectionalLight directionalLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLights[ i ];\\n\\t\\tgetDirectionalLightInfo( directionalLight, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\n\\t\\tdirectionalLightShadow = directionalLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\n\\tRectAreaLight rectAreaLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\\n\\t\\trectAreaLight = rectAreaLights[ i ];\\n\\t\\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n\\tvec3 iblIrradiance = vec3( 0.0 );\\n\\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\n\\t#if defined( USE_LIGHT_PROBES )\\n\\t\\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\\n\\t#endif\\n\\t#if ( NUM_HEMI_LIGHTS > 0 )\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\\t\\t\\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tvec3 radiance = vec3( 0.0 );\\n\\tvec3 clearcoatRadiance = vec3( 0.0 );\\n#endif\";\n\nvar lights_fragment_maps = \"#if defined( RE_IndirectDiffuse )\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\t\\tirradiance += lightMapIrradiance;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tiblIrradiance += getIBLIrradiance( geometryNormal );\\n\\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\\t#ifdef USE_ANISOTROPY\\n\\t\\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\\n\\t#else\\n\\t\\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\\n\\t#endif\\n#endif\";\n\nvar lights_fragment_end = \"#if defined( RE_IndirectDiffuse )\\n\\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\n#endif\";\n\nvar logdepthbuf_fragment = \"#if defined( USE_LOGDEPTHBUF )\\n\\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\\n#endif\";\n\nvar logdepthbuf_pars_fragment = \"#if defined( USE_LOGDEPTHBUF )\\n\\tuniform float logDepthBufFC;\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_pars_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\tvFragDepth = 1.0 + gl_Position.w;\\n\\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\\n#endif\";\n\nvar map_fragment = \"#ifdef USE_MAP\\n\\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\\n\\t\\n\\t#endif\\n\\tdiffuseColor *= sampledDiffuseColor;\\n#endif\";\n\nvar map_pars_fragment = \"#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\";\n\nvar map_particle_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t#if defined( USE_POINTS_UV )\\n\\t\\tvec2 uv = vUv;\\n\\t#else\\n\\t\\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tdiffuseColor *= texture2D( map, uv );\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\n#endif\";\n\nvar map_particle_pars_fragment = \"#if defined( USE_POINTS_UV )\\n\\tvarying vec2 vUv;\\n#else\\n\\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t\\tuniform mat3 uvTransform;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\\n\\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\n\nvar metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\\tuniform sampler2D metalnessMap;\\n#endif\";\n\nvar morphinstance_vertex = \"#ifdef USE_INSTANCING_MORPH\\n\\tfloat morphTargetInfluences[MORPHTARGETS_COUNT];\\n\\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\\n\\t}\\n#endif\";\n\nvar morphcolor_vertex = \"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\\n\\tvColor *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t#if defined( USE_COLOR_ALPHA )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\\n\\t\\t#elif defined( USE_COLOR )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\\n\\t\\t#endif\\n\\t}\\n#endif\";\n\nvar morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\\tobjectNormal *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\\n\\t\\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\\n\\t\\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\\n\\t\\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\\n\\t#endif\\n#endif\";\n\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\t#ifndef USE_INSTANCING_MORPH\\n\\t\\tuniform float morphTargetBaseInfluence;\\n\\t#endif\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\t#ifndef USE_INSTANCING_MORPH\\n\\t\\t\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\t\\t#endif\\n\\t\\tuniform sampler2DArray morphTargetsTexture;\\n\\t\\tuniform ivec2 morphTargetsTextureSize;\\n\\t\\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\\t\\t\\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\\t\\t\\tint y = texelIndex / morphTargetsTextureSize.x;\\n\\t\\t\\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\\t\\t\\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\\t\\t\\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\\t\\t}\\n\\t#else\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\tuniform float morphTargetInfluences[ 8 ];\\n\\t\\t#else\\n\\t\\t\\tuniform float morphTargetInfluences[ 4 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\\n\\t\\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\\n\\t\\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\\n\\t\\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\\n\\t\\t\\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\\n\\t\\t\\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\\n\\t\\t\\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar normal_fragment_begin = \"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\\n#ifdef FLAT_SHADED\\n\\tvec3 fdx = dFdx( vViewPosition );\\n\\tvec3 fdy = dFdy( vViewPosition );\\n\\tvec3 normal = normalize( cross( fdx, fdy ) );\\n#else\\n\\tvec3 normal = normalize( vNormal );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal *= faceDirection;\\n\\t#endif\\n#endif\\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\\n\\t\\t#if defined( USE_NORMALMAP )\\n\\t\\t\\tvNormalMapUv\\n\\t\\t#elif defined( USE_CLEARCOAT_NORMALMAP )\\n\\t\\t\\tvClearcoatNormalMapUv\\n\\t\\t#else\\n\\t\\t\\tvUv\\n\\t\\t#endif\\n\\t\\t);\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn[0] *= faceDirection;\\n\\t\\ttbn[1] *= faceDirection;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn2[0] *= faceDirection;\\n\\t\\ttbn2[1] *= faceDirection;\\n\\t#endif\\n#endif\\nvec3 nonPerturbedNormal = normal;\";\n\nvar normal_fragment_maps = \"#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\t#ifdef FLIP_SIDED\\n\\t\\tnormal = - normal;\\n\\t#endif\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal = normal * faceDirection;\\n\\t#endif\\n\\tnormal = normalize( normalMatrix * normal );\\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tmapN.xy *= normalScale;\\n\\tnormal = normalize( tbn * mapN );\\n#elif defined( USE_BUMPMAP )\\n\\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\\n#endif\";\n\nvar normal_pars_fragment = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_pars_vertex = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_vertex = \"#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n\\t#ifdef USE_TANGENT\\n\\t\\tvTangent = normalize( transformedTangent );\\n\\t\\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\\t#endif\\n#endif\";\n\nvar normalmap_pars_fragment = \"#ifdef USE_NORMALMAP\\n\\tuniform sampler2D normalMap;\\n\\tuniform vec2 normalScale;\\n#endif\\n#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tuniform mat3 normalMatrix;\\n#endif\\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\\n\\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\\n\\t\\tvec3 q0 = dFdx( eye_pos.xyz );\\n\\t\\tvec3 q1 = dFdy( eye_pos.xyz );\\n\\t\\tvec2 st0 = dFdx( uv.st );\\n\\t\\tvec2 st1 = dFdy( uv.st );\\n\\t\\tvec3 N = surf_norm;\\n\\t\\tvec3 q1perp = cross( q1, N );\\n\\t\\tvec3 q0perp = cross( N, q0 );\\n\\t\\tvec3 T = q1perp * st0.x + q0perp * st1.x;\\n\\t\\tvec3 B = q1perp * st0.y + q0perp * st1.y;\\n\\t\\tfloat det = max( dot( T, T ), dot( B, B ) );\\n\\t\\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\\n\\t\\treturn mat3( T * scale, B * scale, N );\\n\\t}\\n#endif\";\n\nvar clearcoat_normal_fragment_begin = \"#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal = nonPerturbedNormal;\\n#endif\";\n\nvar clearcoat_normal_fragment_maps = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tclearcoatMapN.xy *= clearcoatNormalScale;\\n\\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\\n#endif\";\n\nvar clearcoat_pars_fragment = \"#ifdef USE_CLEARCOATMAP\\n\\tuniform sampler2D clearcoatMap;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform sampler2D clearcoatNormalMap;\\n\\tuniform vec2 clearcoatNormalScale;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform sampler2D clearcoatRoughnessMap;\\n#endif\";\n\nvar iridescence_pars_fragment = \"#ifdef USE_IRIDESCENCEMAP\\n\\tuniform sampler2D iridescenceMap;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform sampler2D iridescenceThicknessMap;\\n#endif\";\n\nvar opaque_fragment = \"#ifdef OPAQUE\\ndiffuseColor.a = 1.0;\\n#endif\\n#ifdef USE_TRANSMISSION\\ndiffuseColor.a *= material.transmissionAlpha;\\n#endif\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\";\n\nvar packing = \"vec3 packNormalToRGB( const in vec3 normal ) {\\n\\treturn normalize( normal ) * 0.5 + 0.5;\\n}\\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\\n\\treturn 2.0 * rgb.xyz - 1.0;\\n}\\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\\nconst float ShiftRight8 = 1. / 256.;\\nvec4 packDepthToRGBA( const in float v ) {\\n\\tvec4 r = vec4( fract( v * PackFactors ), v );\\n\\tr.yzw -= r.xyz * ShiftRight8;\\treturn r * PackUpscale;\\n}\\nfloat unpackRGBAToDepth( const in vec4 v ) {\\n\\treturn dot( v, UnpackFactors );\\n}\\nvec2 packDepthToRG( in highp float v ) {\\n\\treturn packDepthToRGBA( v ).yx;\\n}\\nfloat unpackRGToDepth( const in highp vec2 v ) {\\n\\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\\n}\\nvec4 pack2HalfToRGBA( vec2 v ) {\\n\\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\\n\\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\\n}\\nvec2 unpackRGBATo2Half( vec4 v ) {\\n\\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\\n}\\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( viewZ + near ) / ( near - far );\\n}\\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\\n\\treturn depth * ( near - far ) - near;\\n}\\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\\n}\\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\\n\\treturn ( near * far ) / ( ( far - near ) * depth - far );\\n}\";\n\nvar premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\n\nvar project_vertex = \"vec4 mvPosition = vec4( transformed, 1.0 );\\n#ifdef USE_BATCHING\\n\\tmvPosition = batchingMatrix * mvPosition;\\n#endif\\n#ifdef USE_INSTANCING\\n\\tmvPosition = instanceMatrix * mvPosition;\\n#endif\\nmvPosition = modelViewMatrix * mvPosition;\\ngl_Position = projectionMatrix * mvPosition;\";\n\nvar dithering_fragment = \"#ifdef DITHERING\\n\\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\n\nvar dithering_pars_fragment = \"#ifdef DITHERING\\n\\tvec3 dithering( vec3 color ) {\\n\\t\\tfloat grid_position = rand( gl_FragCoord.xy );\\n\\t\\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\\n\\t\\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\\n\\t\\treturn color + dither_shift_RGB;\\n\\t}\\n#endif\";\n\nvar roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\\n\\troughnessFactor *= texelRoughness.g;\\n#endif\";\n\nvar roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\\tuniform sampler2D roughnessMap;\\n#endif\";\n\nvar shadowmap_pars_fragment = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#if NUM_SPOT_LIGHT_MAPS > 0\\n\\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\\n\\t\\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\\n\\t}\\n\\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\\n\\t\\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\\n\\t}\\n\\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\\n\\t\\tfloat occlusion = 1.0;\\n\\t\\tvec2 distribution = texture2DDistribution( shadow, uv );\\n\\t\\tfloat hard_shadow = step( compare , distribution.x );\\n\\t\\tif (hard_shadow != 1.0 ) {\\n\\t\\t\\tfloat distance = compare - distribution.x ;\\n\\t\\t\\tfloat variance = max( 0.00000, distribution.y * distribution.y );\\n\\t\\t\\tfloat softness_probability = variance / (variance + distance * distance );\\t\\t\\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\\t\\t\\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\\n\\t\\t}\\n\\t\\treturn occlusion;\\n\\t}\\n\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tshadowCoord.xyz /= shadowCoord.w;\\n\\t\\tshadowCoord.z += shadowBias;\\n\\t\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\\t\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\n\\t\\tif ( frustumTest ) {\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx0 = - texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy0 = - texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx1 = + texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy1 = + texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx2 = dx0 / 2.0;\\n\\t\\t\\tfloat dy2 = dy0 / 2.0;\\n\\t\\t\\tfloat dx3 = dx1 / 2.0;\\n\\t\\t\\tfloat dy3 = dy1 / 2.0;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\\n\\t\\t\\t) * ( 1.0 / 17.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx = texelSize.x;\\n\\t\\t\\tfloat dy = texelSize.y;\\n\\t\\t\\tvec2 uv = shadowCoord.xy;\\n\\t\\t\\tvec2 f = fract( uv * shadowMapSize + 0.5 );\\n\\t\\t\\tuv -= f * texelSize;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t f.y )\\n\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#else\\n\\t\\t\\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#endif\\n\\t\\t}\\n\\t\\treturn shadow;\\n\\t}\\n\\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\\n\\t\\tvec3 absV = abs( v );\\n\\t\\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\\n\\t\\tabsV *= scaleToCube;\\n\\t\\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\\n\\t\\tvec2 planar = v.xy;\\n\\t\\tfloat almostATexel = 1.5 * texelSizeY;\\n\\t\\tfloat almostOne = 1.0 - almostATexel;\\n\\t\\tif ( absV.z >= almostOne ) {\\n\\t\\t\\tif ( v.z > 0.0 )\\n\\t\\t\\t\\tplanar.x = 4.0 - v.x;\\n\\t\\t} else if ( absV.x >= almostOne ) {\\n\\t\\t\\tfloat signX = sign( v.x );\\n\\t\\t\\tplanar.x = v.z * signX + 2.0 * signX;\\n\\t\\t} else if ( absV.y >= almostOne ) {\\n\\t\\t\\tfloat signY = sign( v.y );\\n\\t\\t\\tplanar.x = v.x + 2.0 * signY + 2.0;\\n\\t\\t\\tplanar.y = v.z * signY - 2.0;\\n\\t\\t}\\n\\t\\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\\n\\t}\\n\\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tvec3 lightToPosition = shadowCoord.xyz;\\n\\t\\t\\n\\t\\tfloat lightToPositionLength = length( lightToPosition );\\n\\t\\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\\n\\t\\t\\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\\t\\t\\tdp += shadowBias;\\n\\t\\t\\tvec3 bd3D = normalize( lightToPosition );\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\\n\\t\\t\\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\t\\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\\n\\t\\t\\t\\tshadow = (\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\\n\\t\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\\n\\t\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t\\t#else\\n\\t\\t\\t\\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t\\treturn shadow;\\n\\t}\\n#endif\";\n\nvar shadowmap_pars_vertex = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n#endif\";\n\nvar shadowmap_vertex = \"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\\n\\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\tvec4 shadowWorldPosition;\\n#endif\\n#if defined( USE_SHADOWMAP )\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if NUM_SPOT_LIGHT_COORDS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\\n\\t\\tshadowWorldPosition = worldPosition;\\n\\t\\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t\\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\\n\\t\\t#endif\\n\\t\\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\";\n\nvar shadowmask_pars_fragment = \"float getShadowMask() {\\n\\tfloat shadow = 1.0;\\n\\t#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tspotLight = spotLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tpointLight = pointLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#endif\\n\\treturn shadow;\\n}\";\n\nvar skinbase_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\\n\\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\\n\\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\\n\\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\\n#endif\";\n\nvar skinning_pars_vertex = \"#ifdef USE_SKINNING\\n\\tuniform mat4 bindMatrix;\\n\\tuniform mat4 bindMatrixInverse;\\n\\tuniform highp sampler2D boneTexture;\\n\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\tint size = textureSize( boneTexture, 0 ).x;\\n\\t\\tint j = int( i ) * 4;\\n\\t\\tint x = j % size;\\n\\t\\tint y = j / size;\\n\\t\\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\\n\\t\\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\\n\\t\\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\\n\\t\\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\\n\\t\\treturn mat4( v1, v2, v3, v4 );\\n\\t}\\n#endif\";\n\nvar skinning_vertex = \"#ifdef USE_SKINNING\\n\\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\\n\\tvec4 skinned = vec4( 0.0 );\\n\\tskinned += boneMatX * skinVertex * skinWeight.x;\\n\\tskinned += boneMatY * skinVertex * skinWeight.y;\\n\\tskinned += boneMatZ * skinVertex * skinWeight.z;\\n\\tskinned += boneMatW * skinVertex * skinWeight.w;\\n\\ttransformed = ( bindMatrixInverse * skinned ).xyz;\\n#endif\";\n\nvar skinnormal_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 skinMatrix = mat4( 0.0 );\\n\\tskinMatrix += skinWeight.x * boneMatX;\\n\\tskinMatrix += skinWeight.y * boneMatY;\\n\\tskinMatrix += skinWeight.z * boneMatZ;\\n\\tskinMatrix += skinWeight.w * boneMatW;\\n\\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\\n\\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\\n\\t#ifdef USE_TANGENT\\n\\t\\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\n\\t#endif\\n#endif\";\n\nvar specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\\n\\tspecularStrength = texelSpecular.r;\\n#else\\n\\tspecularStrength = 1.0;\\n#endif\";\n\nvar specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\\tuniform sampler2D specularMap;\\n#endif\";\n\nvar tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\n\nvar tonemapping_pars_fragment = \"#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\nuniform float toneMappingExposure;\\nvec3 LinearToneMapping( vec3 color ) {\\n\\treturn saturate( toneMappingExposure * color );\\n}\\nvec3 ReinhardToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\treturn saturate( color / ( vec3( 1.0 ) + color ) );\\n}\\nvec3 OptimizedCineonToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = max( vec3( 0.0 ), color - 0.004 );\\n\\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\\n}\\nvec3 RRTAndODTFit( vec3 v ) {\\n\\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\\n\\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\\n\\treturn a / b;\\n}\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\n\\tconst mat3 ACESInputMat = mat3(\\n\\t\\tvec3( 0.59719, 0.07600, 0.02840 ),\\t\\tvec3( 0.35458, 0.90834, 0.13383 ),\\n\\t\\tvec3( 0.04823, 0.01566, 0.83777 )\\n\\t);\\n\\tconst mat3 ACESOutputMat = mat3(\\n\\t\\tvec3( 1.60475, -0.10208, -0.00327 ),\\t\\tvec3( -0.53108, 1.10813, -0.07276 ),\\n\\t\\tvec3( -0.07367, -0.00605, 1.07602 )\\n\\t);\\n\\tcolor *= toneMappingExposure / 0.6;\\n\\tcolor = ACESInputMat * color;\\n\\tcolor = RRTAndODTFit( color );\\n\\tcolor = ACESOutputMat * color;\\n\\treturn saturate( color );\\n}\\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.6605, - 0.1246, - 0.0182 ),\\n\\tvec3( - 0.5876, 1.1329, - 0.1006 ),\\n\\tvec3( - 0.0728, - 0.0083, 1.1187 )\\n);\\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\\n\\tvec3( 0.6274, 0.0691, 0.0164 ),\\n\\tvec3( 0.3293, 0.9195, 0.0880 ),\\n\\tvec3( 0.0433, 0.0113, 0.8956 )\\n);\\nvec3 agxDefaultContrastApprox( vec3 x ) {\\n\\tvec3 x2 = x * x;\\n\\tvec3 x4 = x2 * x2;\\n\\treturn + 15.5 * x4 * x2\\n\\t\\t- 40.14 * x4 * x\\n\\t\\t+ 31.96 * x4\\n\\t\\t- 6.868 * x2 * x\\n\\t\\t+ 0.4298 * x2\\n\\t\\t+ 0.1191 * x\\n\\t\\t- 0.00232;\\n}\\nvec3 AgXToneMapping( vec3 color ) {\\n\\tconst mat3 AgXInsetMatrix = mat3(\\n\\t\\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\\n\\t\\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\\n\\t\\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\\n\\t);\\n\\tconst mat3 AgXOutsetMatrix = mat3(\\n\\t\\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\\n\\t\\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\\n\\t\\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\\n\\t);\\n\\tconst float AgxMinEv = - 12.47393;\\tconst float AgxMaxEv = 4.026069;\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\\n\\tcolor = AgXInsetMatrix * color;\\n\\tcolor = max( color, 1e-10 );\\tcolor = log2( color );\\n\\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\\n\\tcolor = clamp( color, 0.0, 1.0 );\\n\\tcolor = agxDefaultContrastApprox( color );\\n\\tcolor = AgXOutsetMatrix * color;\\n\\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\\n\\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\\n\\tcolor = clamp( color, 0.0, 1.0 );\\n\\treturn color;\\n}\\nvec3 NeutralToneMapping( vec3 color ) {\\n\\tfloat startCompression = 0.8 - 0.04;\\n\\tfloat desaturation = 0.15;\\n\\tcolor *= toneMappingExposure;\\n\\tfloat x = min(color.r, min(color.g, color.b));\\n\\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\\n\\tcolor -= offset;\\n\\tfloat peak = max(color.r, max(color.g, color.b));\\n\\tif (peak < startCompression) return color;\\n\\tfloat d = 1. - startCompression;\\n\\tfloat newPeak = 1. - d * d / (peak + d - startCompression);\\n\\tcolor *= newPeak / peak;\\n\\tfloat g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\\n\\treturn mix(color, newPeak * vec3(1, 1, 1), g);\\n}\\nvec3 CustomToneMapping( vec3 color ) { return color; }\";\n\nvar transmission_fragment = \"#ifdef USE_TRANSMISSION\\n\\tmaterial.transmission = transmission;\\n\\tmaterial.transmissionAlpha = 1.0;\\n\\tmaterial.thickness = thickness;\\n\\tmaterial.attenuationDistance = attenuationDistance;\\n\\tmaterial.attenuationColor = attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\\n\\t#endif\\n\\tvec3 pos = vWorldPosition;\\n\\tvec3 v = normalize( cameraPosition - pos );\\n\\tvec3 n = inverseTransformDirection( normal, viewMatrix );\\n\\tvec4 transmitted = getIBLVolumeRefraction(\\n\\t\\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\\n\\t\\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\\n\\t\\tmaterial.attenuationColor, material.attenuationDistance );\\n\\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\\n\\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\\n#endif\";\n\nvar transmission_pars_fragment = \"#ifdef USE_TRANSMISSION\\n\\tuniform float transmission;\\n\\tuniform float thickness;\\n\\tuniform float attenuationDistance;\\n\\tuniform vec3 attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tuniform sampler2D transmissionMap;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tuniform sampler2D thicknessMap;\\n\\t#endif\\n\\tuniform vec2 transmissionSamplerSize;\\n\\tuniform sampler2D transmissionSamplerMap;\\n\\tuniform mat4 modelMatrix;\\n\\tuniform mat4 projectionMatrix;\\n\\tvarying vec3 vWorldPosition;\\n\\tfloat w0( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w1( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\\n\\t}\\n\\tfloat w2( float a ){\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w3( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * a );\\n\\t}\\n\\tfloat g0( float a ) {\\n\\t\\treturn w0( a ) + w1( a );\\n\\t}\\n\\tfloat g1( float a ) {\\n\\t\\treturn w2( a ) + w3( a );\\n\\t}\\n\\tfloat h0( float a ) {\\n\\t\\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\\n\\t}\\n\\tfloat h1( float a ) {\\n\\t\\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\\n\\t}\\n\\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\\n\\t\\tuv = uv * texelSize.zw + 0.5;\\n\\t\\tvec2 iuv = floor( uv );\\n\\t\\tvec2 fuv = fract( uv );\\n\\t\\tfloat g0x = g0( fuv.x );\\n\\t\\tfloat g1x = g1( fuv.x );\\n\\t\\tfloat h0x = h0( fuv.x );\\n\\t\\tfloat h1x = h1( fuv.x );\\n\\t\\tfloat h0y = h0( fuv.y );\\n\\t\\tfloat h1y = h1( fuv.y );\\n\\t\\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\\n\\t\\t\\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\\n\\t}\\n\\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\\n\\t\\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\\n\\t\\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\\n\\t\\tvec2 fLodSizeInv = 1.0 / fLodSize;\\n\\t\\tvec2 cLodSizeInv = 1.0 / cLodSize;\\n\\t\\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\\n\\t\\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\\n\\t\\treturn mix( fSample, cSample, fract( lod ) );\\n\\t}\\n\\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\\n\\t\\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\\n\\t\\tvec3 modelScale;\\n\\t\\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\\n\\t\\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\\n\\t\\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\\n\\t\\treturn normalize( refractionVector ) * thickness * modelScale;\\n\\t}\\n\\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\\n\\t\\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\\n\\t}\\n\\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\\n\\t\\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\\n\\t\\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\\n\\t}\\n\\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tif ( isinf( attenuationDistance ) ) {\\n\\t\\t\\treturn vec3( 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\\n\\t\\t\\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\\t\\t\\treturn transmittance;\\n\\t\\t}\\n\\t}\\n\\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\\n\\t\\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\\n\\t\\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\\n\\t\\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\trefractionCoords += 1.0;\\n\\t\\trefractionCoords /= 2.0;\\n\\t\\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\\t\\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\n\\t\\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\\n\\t\\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\\n\\t\\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\\n\\t\\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\\n\\t}\\n#endif\";\n\nvar uv_pars_fragment = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\n\nvar uv_pars_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tuniform mat3 mapTransform;\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform mat3 alphaMapTransform;\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tuniform mat3 lightMapTransform;\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tuniform mat3 aoMapTransform;\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tuniform mat3 bumpMapTransform;\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tuniform mat3 normalMapTransform;\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tuniform mat3 displacementMapTransform;\\n\\tvarying vec2 vDisplacementMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tuniform mat3 emissiveMapTransform;\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tuniform mat3 metalnessMapTransform;\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tuniform mat3 roughnessMapTransform;\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tuniform mat3 anisotropyMapTransform;\\n\\tvarying vec2 vAnisotropyMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tuniform mat3 clearcoatMapTransform;\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform mat3 clearcoatNormalMapTransform;\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform mat3 clearcoatRoughnessMapTransform;\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tuniform mat3 sheenColorMapTransform;\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tuniform mat3 sheenRoughnessMapTransform;\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tuniform mat3 iridescenceMapTransform;\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform mat3 iridescenceThicknessMapTransform;\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tuniform mat3 specularMapTransform;\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tuniform mat3 specularColorMapTransform;\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tuniform mat3 specularIntensityMapTransform;\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\n\nvar uv_vertex = \"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\n\\tvUv = vec3( uv, 1 ).xy;\\n#endif\\n#ifdef USE_MAP\\n\\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ANISOTROPYMAP\\n\\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\";\n\nvar worldpos_vertex = \"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\\n\\tvec4 worldPosition = vec4( transformed, 1.0 );\\n\\t#ifdef USE_BATCHING\\n\\t\\tworldPosition = batchingMatrix * worldPosition;\\n\\t#endif\\n\\t#ifdef USE_INSTANCING\\n\\t\\tworldPosition = instanceMatrix * worldPosition;\\n\\t#endif\\n\\tworldPosition = modelMatrix * worldPosition;\\n#endif\";\n\nconst vertex$h = \"varying vec2 vUv;\\nuniform mat3 uvTransform;\\nvoid main() {\\n\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\tgl_Position = vec4( position.xy, 1.0, 1.0 );\\n}\";\n\nconst fragment$h = \"uniform sampler2D t2D;\\nuniform float backgroundIntensity;\\nvarying vec2 vUv;\\nvoid main() {\\n\\tvec4 texColor = texture2D( t2D, vUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$g = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$g = \"#ifdef ENVMAP_TYPE_CUBE\\n\\tuniform samplerCube envMap;\\n#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\tuniform sampler2D envMap;\\n#endif\\nuniform float flipEnvMap;\\nuniform float backgroundBlurriness;\\nuniform float backgroundIntensity;\\nuniform mat3 backgroundRotation;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\\n\\t#else\\n\\t\\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$f = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$f = \"uniform samplerCube tCube;\\nuniform float tFlip;\\nuniform float opacity;\\nvarying vec3 vWorldDirection;\\nvoid main() {\\n\\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\\n\\tgl_FragColor = texColor;\\n\\tgl_FragColor.a *= opacity;\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$e = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvHighPrecisionZW = gl_Position.zw;\\n}\";\n\nconst fragment$e = \"#if DEPTH_PACKING == 3200\\n\\tuniform float opacity;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tdiffuseColor.a = opacity;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\\n\\t#elif DEPTH_PACKING == 3201\\n\\t\\tgl_FragColor = packDepthToRGBA( fragCoordZ );\\n\\t#endif\\n}\";\n\nconst vertex$d = \"#define DISTANCE\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvWorldPosition = worldPosition.xyz;\\n}\";\n\nconst fragment$d = \"#define DISTANCE\\nuniform vec3 referencePosition;\\nuniform float nearDistance;\\nuniform float farDistance;\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main () {\\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat dist = length( vWorldPosition - referencePosition );\\n\\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\n\\tdist = saturate( dist );\\n\\tgl_FragColor = packDepthToRGBA( dist );\\n}\";\n\nconst vertex$c = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$c = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvec3 direction = normalize( vWorldDirection );\\n\\tvec2 sampleUV = equirectUv( direction );\\n\\tgl_FragColor = texture2D( tEquirect, sampleUV );\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$b = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvLineDistance = scale * lineDistance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$b = \"uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\\n\\t\\tdiscard;\\n\\t}\\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$a = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$a = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\\n\\t#else\\n\\t\\treflectedLight.indirectDiffuse += vec3( 1.0 );\\n\\t#endif\\n\\t#include \\n\\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\n\\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$9 = \"#define LAMBERT\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$9 = \"#define LAMBERT\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$8 = \"#define MATCAP\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n}\";\n\nconst fragment$8 = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 viewDir = normalize( vViewPosition );\\n\\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\\n\\tvec3 y = cross( viewDir, x );\\n\\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\\n\\t#ifdef USE_MATCAP\\n\\t\\tvec4 matcapColor = texture2D( matcap, uv );\\n\\t#else\\n\\t\\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\\n\\t#endif\\n\\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$7 = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$7 = \"#define NORMAL\\nuniform float opacity;\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\\n\\t#ifdef OPAQUE\\n\\t\\tgl_FragColor.a = 1.0;\\n\\t#endif\\n}\";\n\nconst vertex$6 = \"#define PHONG\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$6 = \"#define PHONG\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$5 = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifdef USE_TRANSMISSION\\n\\tvarying vec3 vWorldPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n#ifdef USE_TRANSMISSION\\n\\tvWorldPosition = worldPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$5 = \"#define STANDARD\\n#ifdef PHYSICAL\\n\\t#define IOR\\n\\t#define USE_SPECULAR\\n#endif\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float roughness;\\nuniform float metalness;\\nuniform float opacity;\\n#ifdef IOR\\n\\tuniform float ior;\\n#endif\\n#ifdef USE_SPECULAR\\n\\tuniform float specularIntensity;\\n\\tuniform vec3 specularColor;\\n\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\tuniform sampler2D specularColorMap;\\n\\t#endif\\n\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\tuniform sampler2D specularIntensityMap;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tuniform float clearcoat;\\n\\tuniform float clearcoatRoughness;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tuniform float iridescence;\\n\\tuniform float iridescenceIOR;\\n\\tuniform float iridescenceThicknessMinimum;\\n\\tuniform float iridescenceThicknessMaximum;\\n#endif\\n#ifdef USE_SHEEN\\n\\tuniform vec3 sheenColor;\\n\\tuniform float sheenRoughness;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tuniform sampler2D sheenColorMap;\\n\\t#endif\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tuniform sampler2D sheenRoughnessMap;\\n\\t#endif\\n#endif\\n#ifdef USE_ANISOTROPY\\n\\tuniform vec2 anisotropyVector;\\n\\t#ifdef USE_ANISOTROPYMAP\\n\\t\\tuniform sampler2D anisotropyMap;\\n\\t#endif\\n#endif\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\n\\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\n\\t#include \\n\\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\n\\t#ifdef USE_SHEEN\\n\\t\\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\\n\\t\\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\\n\\t\\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\\t\\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$4 = \"#define TOON\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$4 = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$3 = \"uniform float size;\\nuniform float scale;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#ifdef USE_POINTS_UV\\n\\tvarying vec2 vUv;\\n\\tuniform mat3 uvTransform;\\n#endif\\nvoid main() {\\n\\t#ifdef USE_POINTS_UV\\n\\t\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_PointSize = size;\\n\\t#ifdef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$3 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$2 = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$2 = \"uniform vec3 color;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$1 = \"uniform float rotation;\\nuniform vec2 center;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\tvec2 scale;\\n\\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\\n\\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\\n\\t#ifndef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) scale *= - mvPosition.z;\\n\\t#endif\\n\\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\\n\\tvec2 rotatedPosition;\\n\\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\\n\\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\\n\\tmvPosition.xy += rotatedPosition;\\n\\tgl_Position = projectionMatrix * mvPosition;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$1 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst ShaderChunk = {\n\talphahash_fragment: alphahash_fragment,\n\talphahash_pars_fragment: alphahash_pars_fragment,\n\talphamap_fragment: alphamap_fragment,\n\talphamap_pars_fragment: alphamap_pars_fragment,\n\talphatest_fragment: alphatest_fragment,\n\talphatest_pars_fragment: alphatest_pars_fragment,\n\taomap_fragment: aomap_fragment,\n\taomap_pars_fragment: aomap_pars_fragment,\n\tbatching_pars_vertex: batching_pars_vertex,\n\tbatching_vertex: batching_vertex,\n\tbegin_vertex: begin_vertex,\n\tbeginnormal_vertex: beginnormal_vertex,\n\tbsdfs: bsdfs,\n\tiridescence_fragment: iridescence_fragment,\n\tbumpmap_pars_fragment: bumpmap_pars_fragment,\n\tclipping_planes_fragment: clipping_planes_fragment,\n\tclipping_planes_pars_fragment: clipping_planes_pars_fragment,\n\tclipping_planes_pars_vertex: clipping_planes_pars_vertex,\n\tclipping_planes_vertex: clipping_planes_vertex,\n\tcolor_fragment: color_fragment,\n\tcolor_pars_fragment: color_pars_fragment,\n\tcolor_pars_vertex: color_pars_vertex,\n\tcolor_vertex: color_vertex,\n\tcommon: common,\n\tcube_uv_reflection_fragment: cube_uv_reflection_fragment,\n\tdefaultnormal_vertex: defaultnormal_vertex,\n\tdisplacementmap_pars_vertex: displacementmap_pars_vertex,\n\tdisplacementmap_vertex: displacementmap_vertex,\n\temissivemap_fragment: emissivemap_fragment,\n\temissivemap_pars_fragment: emissivemap_pars_fragment,\n\tcolorspace_fragment: colorspace_fragment,\n\tcolorspace_pars_fragment: colorspace_pars_fragment,\n\tenvmap_fragment: envmap_fragment,\n\tenvmap_common_pars_fragment: envmap_common_pars_fragment,\n\tenvmap_pars_fragment: envmap_pars_fragment,\n\tenvmap_pars_vertex: envmap_pars_vertex,\n\tenvmap_physical_pars_fragment: envmap_physical_pars_fragment,\n\tenvmap_vertex: envmap_vertex,\n\tfog_vertex: fog_vertex,\n\tfog_pars_vertex: fog_pars_vertex,\n\tfog_fragment: fog_fragment,\n\tfog_pars_fragment: fog_pars_fragment,\n\tgradientmap_pars_fragment: gradientmap_pars_fragment,\n\tlightmap_fragment: lightmap_fragment,\n\tlightmap_pars_fragment: lightmap_pars_fragment,\n\tlights_lambert_fragment: lights_lambert_fragment,\n\tlights_lambert_pars_fragment: lights_lambert_pars_fragment,\n\tlights_pars_begin: lights_pars_begin,\n\tlights_toon_fragment: lights_toon_fragment,\n\tlights_toon_pars_fragment: lights_toon_pars_fragment,\n\tlights_phong_fragment: lights_phong_fragment,\n\tlights_phong_pars_fragment: lights_phong_pars_fragment,\n\tlights_physical_fragment: lights_physical_fragment,\n\tlights_physical_pars_fragment: lights_physical_pars_fragment,\n\tlights_fragment_begin: lights_fragment_begin,\n\tlights_fragment_maps: lights_fragment_maps,\n\tlights_fragment_end: lights_fragment_end,\n\tlogdepthbuf_fragment: logdepthbuf_fragment,\n\tlogdepthbuf_pars_fragment: logdepthbuf_pars_fragment,\n\tlogdepthbuf_pars_vertex: logdepthbuf_pars_vertex,\n\tlogdepthbuf_vertex: logdepthbuf_vertex,\n\tmap_fragment: map_fragment,\n\tmap_pars_fragment: map_pars_fragment,\n\tmap_particle_fragment: map_particle_fragment,\n\tmap_particle_pars_fragment: map_particle_pars_fragment,\n\tmetalnessmap_fragment: metalnessmap_fragment,\n\tmetalnessmap_pars_fragment: metalnessmap_pars_fragment,\n\tmorphinstance_vertex: morphinstance_vertex,\n\tmorphcolor_vertex: morphcolor_vertex,\n\tmorphnormal_vertex: morphnormal_vertex,\n\tmorphtarget_pars_vertex: morphtarget_pars_vertex,\n\tmorphtarget_vertex: morphtarget_vertex,\n\tnormal_fragment_begin: normal_fragment_begin,\n\tnormal_fragment_maps: normal_fragment_maps,\n\tnormal_pars_fragment: normal_pars_fragment,\n\tnormal_pars_vertex: normal_pars_vertex,\n\tnormal_vertex: normal_vertex,\n\tnormalmap_pars_fragment: normalmap_pars_fragment,\n\tclearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,\n\tclearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,\n\tclearcoat_pars_fragment: clearcoat_pars_fragment,\n\tiridescence_pars_fragment: iridescence_pars_fragment,\n\topaque_fragment: opaque_fragment,\n\tpacking: packing,\n\tpremultiplied_alpha_fragment: premultiplied_alpha_fragment,\n\tproject_vertex: project_vertex,\n\tdithering_fragment: dithering_fragment,\n\tdithering_pars_fragment: dithering_pars_fragment,\n\troughnessmap_fragment: roughnessmap_fragment,\n\troughnessmap_pars_fragment: roughnessmap_pars_fragment,\n\tshadowmap_pars_fragment: shadowmap_pars_fragment,\n\tshadowmap_pars_vertex: shadowmap_pars_vertex,\n\tshadowmap_vertex: shadowmap_vertex,\n\tshadowmask_pars_fragment: shadowmask_pars_fragment,\n\tskinbase_vertex: skinbase_vertex,\n\tskinning_pars_vertex: skinning_pars_vertex,\n\tskinning_vertex: skinning_vertex,\n\tskinnormal_vertex: skinnormal_vertex,\n\tspecularmap_fragment: specularmap_fragment,\n\tspecularmap_pars_fragment: specularmap_pars_fragment,\n\ttonemapping_fragment: tonemapping_fragment,\n\ttonemapping_pars_fragment: tonemapping_pars_fragment,\n\ttransmission_fragment: transmission_fragment,\n\ttransmission_pars_fragment: transmission_pars_fragment,\n\tuv_pars_fragment: uv_pars_fragment,\n\tuv_pars_vertex: uv_pars_vertex,\n\tuv_vertex: uv_vertex,\n\tworldpos_vertex: worldpos_vertex,\n\n\tbackground_vert: vertex$h,\n\tbackground_frag: fragment$h,\n\tbackgroundCube_vert: vertex$g,\n\tbackgroundCube_frag: fragment$g,\n\tcube_vert: vertex$f,\n\tcube_frag: fragment$f,\n\tdepth_vert: vertex$e,\n\tdepth_frag: fragment$e,\n\tdistanceRGBA_vert: vertex$d,\n\tdistanceRGBA_frag: fragment$d,\n\tequirect_vert: vertex$c,\n\tequirect_frag: fragment$c,\n\tlinedashed_vert: vertex$b,\n\tlinedashed_frag: fragment$b,\n\tmeshbasic_vert: vertex$a,\n\tmeshbasic_frag: fragment$a,\n\tmeshlambert_vert: vertex$9,\n\tmeshlambert_frag: fragment$9,\n\tmeshmatcap_vert: vertex$8,\n\tmeshmatcap_frag: fragment$8,\n\tmeshnormal_vert: vertex$7,\n\tmeshnormal_frag: fragment$7,\n\tmeshphong_vert: vertex$6,\n\tmeshphong_frag: fragment$6,\n\tmeshphysical_vert: vertex$5,\n\tmeshphysical_frag: fragment$5,\n\tmeshtoon_vert: vertex$4,\n\tmeshtoon_frag: fragment$4,\n\tpoints_vert: vertex$3,\n\tpoints_frag: fragment$3,\n\tshadow_vert: vertex$2,\n\tshadow_frag: fragment$2,\n\tsprite_vert: vertex$1,\n\tsprite_frag: fragment$1\n};\n\n/**\n * Uniforms library for shared webgl shaders\n */\n\nconst UniformsLib = {\n\n\tcommon: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaTest: { value: 0 }\n\n\t},\n\n\tspecularmap: {\n\n\t\tspecularMap: { value: null },\n\t\tspecularMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tenvmap: {\n\n\t\tenvMap: { value: null },\n\t\tenvMapRotation: { value: /*@__PURE__*/ new Matrix3() },\n\t\tflipEnvMap: { value: - 1 },\n\t\treflectivity: { value: 1.0 }, // basic, lambert, phong\n\t\tior: { value: 1.5 }, // physical\n\t\trefractionRatio: { value: 0.98 }, // basic, lambert, phong\n\n\t},\n\n\taomap: {\n\n\t\taoMap: { value: null },\n\t\taoMapIntensity: { value: 1 },\n\t\taoMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tlightmap: {\n\n\t\tlightMap: { value: null },\n\t\tlightMapIntensity: { value: 1 },\n\t\tlightMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tbumpmap: {\n\n\t\tbumpMap: { value: null },\n\t\tbumpMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tbumpScale: { value: 1 }\n\n\t},\n\n\tnormalmap: {\n\n\t\tnormalMap: { value: null },\n\t\tnormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tnormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) }\n\n\t},\n\n\tdisplacementmap: {\n\n\t\tdisplacementMap: { value: null },\n\t\tdisplacementMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tdisplacementScale: { value: 1 },\n\t\tdisplacementBias: { value: 0 }\n\n\t},\n\n\temissivemap: {\n\n\t\temissiveMap: { value: null },\n\t\temissiveMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tmetalnessmap: {\n\n\t\tmetalnessMap: { value: null },\n\t\tmetalnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\troughnessmap: {\n\n\t\troughnessMap: { value: null },\n\t\troughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tgradientmap: {\n\n\t\tgradientMap: { value: null }\n\n\t},\n\n\tfog: {\n\n\t\tfogDensity: { value: 0.00025 },\n\t\tfogNear: { value: 1 },\n\t\tfogFar: { value: 2000 },\n\t\tfogColor: { value: /*@__PURE__*/ new Color( 0xffffff ) }\n\n\t},\n\n\tlights: {\n\n\t\tambientLightColor: { value: [] },\n\n\t\tlightProbe: { value: [] },\n\n\t\tdirectionalLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tcolor: {}\n\t\t} },\n\n\t\tdirectionalLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tdirectionalShadowMap: { value: [] },\n\t\tdirectionalShadowMatrix: { value: [] },\n\n\t\tspotLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdirection: {},\n\t\t\tdistance: {},\n\t\t\tconeCos: {},\n\t\t\tpenumbraCos: {},\n\t\t\tdecay: {}\n\t\t} },\n\n\t\tspotLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tspotLightMap: { value: [] },\n\t\tspotShadowMap: { value: [] },\n\t\tspotLightMatrix: { value: [] },\n\n\t\tpointLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdecay: {},\n\t\t\tdistance: {}\n\t\t} },\n\n\t\tpointLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {},\n\t\t\tshadowCameraNear: {},\n\t\t\tshadowCameraFar: {}\n\t\t} },\n\n\t\tpointShadowMap: { value: [] },\n\t\tpointShadowMatrix: { value: [] },\n\n\t\themisphereLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tskyColor: {},\n\t\t\tgroundColor: {}\n\t\t} },\n\n\t\t// TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\n\t\trectAreaLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\twidth: {},\n\t\t\theight: {}\n\t\t} },\n\n\t\tltc_1: { value: null },\n\t\tltc_2: { value: null }\n\n\t},\n\n\tpoints: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tsize: { value: 1.0 },\n\t\tscale: { value: 1.0 },\n\t\tmap: { value: null },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 },\n\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tsprite: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tcenter: { value: /*@__PURE__*/ new Vector2( 0.5, 0.5 ) },\n\t\trotation: { value: 0.0 },\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 }\n\n\t}\n\n};\n\nconst ShaderLib = {\n\n\tbasic: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshbasic_vert,\n\t\tfragmentShader: ShaderChunk.meshbasic_frag\n\n\t},\n\n\tlambert: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshlambert_vert,\n\t\tfragmentShader: ShaderChunk.meshlambert_frag\n\n\t},\n\n\tphong: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\tspecular: { value: /*@__PURE__*/ new Color( 0x111111 ) },\n\t\t\t\tshininess: { value: 30 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphong_vert,\n\t\tfragmentShader: ShaderChunk.meshphong_frag\n\n\t},\n\n\tstandard: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.roughnessmap,\n\t\t\tUniformsLib.metalnessmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\troughness: { value: 1.0 },\n\t\t\t\tmetalness: { value: 0.0 },\n\t\t\t\tenvMapIntensity: { value: 1 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphysical_vert,\n\t\tfragmentShader: ShaderChunk.meshphysical_frag\n\n\t},\n\n\ttoon: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.gradientmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshtoon_vert,\n\t\tfragmentShader: ShaderChunk.meshtoon_frag\n\n\t},\n\n\tmatcap: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tmatcap: { value: null }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshmatcap_vert,\n\t\tfragmentShader: ShaderChunk.meshmatcap_frag\n\n\t},\n\n\tpoints: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.points,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.points_vert,\n\t\tfragmentShader: ShaderChunk.points_frag\n\n\t},\n\n\tdashed: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tscale: { value: 1 },\n\t\t\t\tdashSize: { value: 1 },\n\t\t\t\ttotalSize: { value: 2 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.linedashed_vert,\n\t\tfragmentShader: ShaderChunk.linedashed_frag\n\n\t},\n\n\tdepth: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.depth_vert,\n\t\tfragmentShader: ShaderChunk.depth_frag\n\n\t},\n\n\tnormal: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshnormal_vert,\n\t\tfragmentShader: ShaderChunk.meshnormal_frag\n\n\t},\n\n\tsprite: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.sprite,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.sprite_vert,\n\t\tfragmentShader: ShaderChunk.sprite_frag\n\n\t},\n\n\tbackground: {\n\n\t\tuniforms: {\n\t\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tt2D: { value: null },\n\t\t\tbackgroundIntensity: { value: 1 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.background_vert,\n\t\tfragmentShader: ShaderChunk.background_frag\n\n\t},\n\n\tbackgroundCube: {\n\n\t\tuniforms: {\n\t\t\tenvMap: { value: null },\n\t\t\tflipEnvMap: { value: - 1 },\n\t\t\tbackgroundBlurriness: { value: 0 },\n\t\t\tbackgroundIntensity: { value: 1 },\n\t\t\tbackgroundRotation: { value: /*@__PURE__*/ new Matrix3() }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.backgroundCube_vert,\n\t\tfragmentShader: ShaderChunk.backgroundCube_frag\n\n\t},\n\n\tcube: {\n\n\t\tuniforms: {\n\t\t\ttCube: { value: null },\n\t\t\ttFlip: { value: - 1 },\n\t\t\topacity: { value: 1.0 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.cube_vert,\n\t\tfragmentShader: ShaderChunk.cube_frag\n\n\t},\n\n\tequirect: {\n\n\t\tuniforms: {\n\t\t\ttEquirect: { value: null },\n\t\t},\n\n\t\tvertexShader: ShaderChunk.equirect_vert,\n\t\tfragmentShader: ShaderChunk.equirect_frag\n\n\t},\n\n\tdistanceRGBA: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\treferencePosition: { value: /*@__PURE__*/ new Vector3() },\n\t\t\t\tnearDistance: { value: 1 },\n\t\t\t\tfarDistance: { value: 1000 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.distanceRGBA_vert,\n\t\tfragmentShader: ShaderChunk.distanceRGBA_frag\n\n\t},\n\n\tshadow: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.lights,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tcolor: { value: /*@__PURE__*/ new Color( 0x00000 ) },\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t},\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.shadow_vert,\n\t\tfragmentShader: ShaderChunk.shadow_frag\n\n\t}\n\n};\n\nShaderLib.physical = {\n\n\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\tShaderLib.standard.uniforms,\n\t\t{\n\t\t\tclearcoat: { value: 0 },\n\t\t\tclearcoatMap: { value: null },\n\t\t\tclearcoatMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalMap: { value: null },\n\t\t\tclearcoatNormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) },\n\t\t\tclearcoatRoughness: { value: 0 },\n\t\t\tclearcoatRoughnessMap: { value: null },\n\t\t\tclearcoatRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tiridescence: { value: 0 },\n\t\t\tiridescenceMap: { value: null },\n\t\t\tiridescenceMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tiridescenceIOR: { value: 1.3 },\n\t\t\tiridescenceThicknessMinimum: { value: 100 },\n\t\t\tiridescenceThicknessMaximum: { value: 400 },\n\t\t\tiridescenceThicknessMap: { value: null },\n\t\t\tiridescenceThicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheen: { value: 0 },\n\t\t\tsheenColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tsheenColorMap: { value: null },\n\t\t\tsheenColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheenRoughness: { value: 1 },\n\t\t\tsheenRoughnessMap: { value: null },\n\t\t\tsheenRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmission: { value: 0 },\n\t\t\ttransmissionMap: { value: null },\n\t\t\ttransmissionMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmissionSamplerSize: { value: /*@__PURE__*/ new Vector2() },\n\t\t\ttransmissionSamplerMap: { value: null },\n\t\t\tthickness: { value: 0 },\n\t\t\tthicknessMap: { value: null },\n\t\t\tthicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tattenuationDistance: { value: 0 },\n\t\t\tattenuationColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tspecularColor: { value: /*@__PURE__*/ new Color( 1, 1, 1 ) },\n\t\t\tspecularColorMap: { value: null },\n\t\t\tspecularColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tspecularIntensity: { value: 1 },\n\t\t\tspecularIntensityMap: { value: null },\n\t\t\tspecularIntensityMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tanisotropyVector: { value: /*@__PURE__*/ new Vector2() },\n\t\t\tanisotropyMap: { value: null },\n\t\t\tanisotropyMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t}\n\t] ),\n\n\tvertexShader: ShaderChunk.meshphysical_vert,\n\tfragmentShader: ShaderChunk.meshphysical_frag\n\n};\n\nconst _rgb = { r: 0, b: 0, g: 0 };\nconst _e1$1 = /*@__PURE__*/ new Euler();\nconst _m1$1 = /*@__PURE__*/ new Matrix4();\n\nfunction WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {\n\n\tconst clearColor = new Color( 0x000000 );\n\tlet clearAlpha = alpha === true ? 0 : 1;\n\n\tlet planeMesh;\n\tlet boxMesh;\n\n\tlet currentBackground = null;\n\tlet currentBackgroundVersion = 0;\n\tlet currentTonemapping = null;\n\n\tfunction render( renderList, scene ) {\n\n\t\tlet forceClear = false;\n\t\tlet background = scene.isScene === true ? scene.background : null;\n\n\t\tif ( background && background.isTexture ) {\n\n\t\t\tconst usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background\n\t\t\tbackground = ( usePMREM ? cubeuvmaps : cubemaps ).get( background );\n\n\t\t}\n\n\t\tif ( background === null ) {\n\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t} else if ( background && background.isColor ) {\n\n\t\t\tsetClear( background, 1 );\n\t\t\tforceClear = true;\n\n\t\t}\n\n\t\tconst environmentBlendMode = renderer.xr.getEnvironmentBlendMode();\n\n\t\tif ( environmentBlendMode === 'additive' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );\n\n\t\t} else if ( environmentBlendMode === 'alpha-blend' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );\n\n\t\t}\n\n\t\tif ( renderer.autoClear || forceClear ) {\n\n\t\t\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\n\t\t}\n\n\t\tif ( background && ( background.isCubeTexture || background.mapping === CubeUVReflectionMapping ) ) {\n\n\t\t\tif ( boxMesh === undefined ) {\n\n\t\t\t\tboxMesh = new Mesh(\n\t\t\t\t\tnew BoxGeometry( 1, 1, 1 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundCubeMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.backgroundCube.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.backgroundCube.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.backgroundCube.fragmentShader,\n\t\t\t\t\t\tside: BackSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'normal' );\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'uv' );\n\n\t\t\t\tboxMesh.onBeforeRender = function ( renderer, scene, camera ) {\n\n\t\t\t\t\tthis.matrixWorld.copyPosition( camera.matrixWorld );\n\n\t\t\t\t};\n\n\t\t\t\t// add \"envMap\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( boxMesh.material, 'envMap', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.envMap.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( boxMesh );\n\n\t\t\t}\n\n\t\t\t_e1$1.copy( scene.backgroundRotation );\n\n\t\t\t// accommodate left-handed frame\n\t\t\t_e1$1.x *= - 1; _e1$1.y *= - 1; _e1$1.z *= - 1;\n\n\t\t\tif ( background.isCubeTexture && background.isRenderTargetTexture === false ) {\n\n\t\t\t\t// environment maps which are not cube render targets or PMREMs follow a different convention\n\t\t\t\t_e1$1.y *= - 1;\n\t\t\t\t_e1$1.z *= - 1;\n\n\t\t\t}\n\n\t\t\tboxMesh.material.uniforms.envMap.value = background;\n\t\t\tboxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;\n\t\t\tboxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;\n\t\t\tboxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tboxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );\n\t\t\tboxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tboxMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tboxMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null );\n\n\t\t} else if ( background && background.isTexture ) {\n\n\t\t\tif ( planeMesh === undefined ) {\n\n\t\t\t\tplaneMesh = new Mesh(\n\t\t\t\t\tnew PlaneGeometry( 2, 2 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.background.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.background.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.background.fragmentShader,\n\t\t\t\t\t\tside: FrontSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tplaneMesh.geometry.deleteAttribute( 'normal' );\n\n\t\t\t\t// add \"map\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( planeMesh.material, 'map', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.t2D.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( planeMesh );\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.t2D.value = background;\n\t\t\tplaneMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tplaneMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\n\n\t\t\tif ( background.matrixAutoUpdate === true ) {\n\n\t\t\t\tbackground.updateMatrix();\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.uvTransform.value.copy( background.matrix );\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tplaneMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tplaneMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null );\n\n\t\t}\n\n\t}\n\n\tfunction setClear( color, alpha ) {\n\n\t\tcolor.getRGB( _rgb, getUnlitUniformColorSpace( renderer ) );\n\n\t\tstate.buffers.color.setClear( _rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha );\n\n\t}\n\n\treturn {\n\n\t\tgetClearColor: function () {\n\n\t\t\treturn clearColor;\n\n\t\t},\n\t\tsetClearColor: function ( color, alpha = 1 ) {\n\n\t\t\tclearColor.set( color );\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\tgetClearAlpha: function () {\n\n\t\t\treturn clearAlpha;\n\n\t\t},\n\t\tsetClearAlpha: function ( alpha ) {\n\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\trender: render\n\n\t};\n\n}\n\nfunction WebGLBindingStates( gl, attributes ) {\n\n\tconst maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\n\tconst bindingStates = {};\n\n\tconst defaultState = createBindingState( null );\n\tlet currentState = defaultState;\n\tlet forceUpdate = false;\n\n\tfunction setup( object, material, program, geometry, index ) {\n\n\t\tlet updateBuffers = false;\n\n\t\tconst state = getBindingState( geometry, program, material );\n\n\t\tif ( currentState !== state ) {\n\n\t\t\tcurrentState = state;\n\t\t\tbindVertexArrayObject( currentState.object );\n\n\t\t}\n\n\t\tupdateBuffers = needsUpdate( object, geometry, program, index );\n\n\t\tif ( updateBuffers ) saveCache( object, geometry, program, index );\n\n\t\tif ( index !== null ) {\n\n\t\t\tattributes.update( index, gl.ELEMENT_ARRAY_BUFFER );\n\n\t\t}\n\n\t\tif ( updateBuffers || forceUpdate ) {\n\n\t\t\tforceUpdate = false;\n\n\t\t\tsetupVertexAttributes( object, material, program, geometry );\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, attributes.get( index ).buffer );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction createVertexArrayObject() {\n\n\t\treturn gl.createVertexArray();\n\n\t}\n\n\tfunction bindVertexArrayObject( vao ) {\n\n\t\treturn gl.bindVertexArray( vao );\n\n\t}\n\n\tfunction deleteVertexArrayObject( vao ) {\n\n\t\treturn gl.deleteVertexArray( vao );\n\n\t}\n\n\tfunction getBindingState( geometry, program, material ) {\n\n\t\tconst wireframe = ( material.wireframe === true );\n\n\t\tlet programMap = bindingStates[ geometry.id ];\n\n\t\tif ( programMap === undefined ) {\n\n\t\t\tprogramMap = {};\n\t\t\tbindingStates[ geometry.id ] = programMap;\n\n\t\t}\n\n\t\tlet stateMap = programMap[ program.id ];\n\n\t\tif ( stateMap === undefined ) {\n\n\t\t\tstateMap = {};\n\t\t\tprogramMap[ program.id ] = stateMap;\n\n\t\t}\n\n\t\tlet state = stateMap[ wireframe ];\n\n\t\tif ( state === undefined ) {\n\n\t\t\tstate = createBindingState( createVertexArrayObject() );\n\t\t\tstateMap[ wireframe ] = state;\n\n\t\t}\n\n\t\treturn state;\n\n\t}\n\n\tfunction createBindingState( vao ) {\n\n\t\tconst newAttributes = [];\n\t\tconst enabledAttributes = [];\n\t\tconst attributeDivisors = [];\n\n\t\tfor ( let i = 0; i < maxVertexAttributes; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\t\t\tenabledAttributes[ i ] = 0;\n\t\t\tattributeDivisors[ i ] = 0;\n\n\t\t}\n\n\t\treturn {\n\n\t\t\t// for backward compatibility on non-VAO support browser\n\t\t\tgeometry: null,\n\t\t\tprogram: null,\n\t\t\twireframe: false,\n\n\t\t\tnewAttributes: newAttributes,\n\t\t\tenabledAttributes: enabledAttributes,\n\t\t\tattributeDivisors: attributeDivisors,\n\t\t\tobject: vao,\n\t\t\tattributes: {},\n\t\t\tindex: null\n\n\t\t};\n\n\t}\n\n\tfunction needsUpdate( object, geometry, program, index ) {\n\n\t\tconst cachedAttributes = currentState.attributes;\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tconst cachedAttribute = cachedAttributes[ name ];\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( cachedAttribute === undefined ) return true;\n\n\t\t\t\tif ( cachedAttribute.attribute !== geometryAttribute ) return true;\n\n\t\t\t\tif ( geometryAttribute && cachedAttribute.data !== geometryAttribute.data ) return true;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( currentState.attributesNum !== attributesNum ) return true;\n\n\t\tif ( currentState.index !== index ) return true;\n\n\t\treturn false;\n\n\t}\n\n\tfunction saveCache( object, geometry, program, index ) {\n\n\t\tconst cache = {};\n\t\tconst attributes = geometry.attributes;\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet attribute = attributes[ name ];\n\n\t\t\t\tif ( attribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) attribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) attribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tconst data = {};\n\t\t\t\tdata.attribute = attribute;\n\n\t\t\t\tif ( attribute && attribute.data ) {\n\n\t\t\t\t\tdata.data = attribute.data;\n\n\t\t\t\t}\n\n\t\t\t\tcache[ name ] = data;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tcurrentState.attributes = cache;\n\t\tcurrentState.attributesNum = attributesNum;\n\n\t\tcurrentState.index = index;\n\n\t}\n\n\tfunction initAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\n\t\tfor ( let i = 0, il = newAttributes.length; i < il; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\tfunction enableAttribute( attribute ) {\n\n\t\tenableAttributeAndDivisor( attribute, 0 );\n\n\t}\n\n\tfunction enableAttributeAndDivisor( attribute, meshPerAttribute ) {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\t\tconst attributeDivisors = currentState.attributeDivisors;\n\n\t\tnewAttributes[ attribute ] = 1;\n\n\t\tif ( enabledAttributes[ attribute ] === 0 ) {\n\n\t\t\tgl.enableVertexAttribArray( attribute );\n\t\t\tenabledAttributes[ attribute ] = 1;\n\n\t\t}\n\n\t\tif ( attributeDivisors[ attribute ] !== meshPerAttribute ) {\n\n\t\t\tgl.vertexAttribDivisor( attribute, meshPerAttribute );\n\t\t\tattributeDivisors[ attribute ] = meshPerAttribute;\n\n\t\t}\n\n\t}\n\n\tfunction disableUnusedAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\n\t\tfor ( let i = 0, il = enabledAttributes.length; i < il; i ++ ) {\n\n\t\t\tif ( enabledAttributes[ i ] !== newAttributes[ i ] ) {\n\n\t\t\t\tgl.disableVertexAttribArray( i );\n\t\t\t\tenabledAttributes[ i ] = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction vertexAttribPointer( index, size, type, normalized, stride, offset, integer ) {\n\n\t\tif ( integer === true ) {\n\n\t\t\tgl.vertexAttribIPointer( index, size, type, stride, offset );\n\n\t\t} else {\n\n\t\t\tgl.vertexAttribPointer( index, size, type, normalized, stride, offset );\n\n\t\t}\n\n\t}\n\n\tfunction setupVertexAttributes( object, material, program, geometry ) {\n\n\t\tinitAttributes();\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tconst materialDefaultAttributeValues = material.defaultAttributeValues;\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( geometryAttribute !== undefined ) {\n\n\t\t\t\t\tconst normalized = geometryAttribute.normalized;\n\t\t\t\t\tconst size = geometryAttribute.itemSize;\n\n\t\t\t\t\tconst attribute = attributes.get( geometryAttribute );\n\n\t\t\t\t\t// TODO Attribute may not be available on context restore\n\n\t\t\t\t\tif ( attribute === undefined ) continue;\n\n\t\t\t\t\tconst buffer = attribute.buffer;\n\t\t\t\t\tconst type = attribute.type;\n\t\t\t\t\tconst bytesPerElement = attribute.bytesPerElement;\n\n\t\t\t\t\t// check for integer attributes\n\n\t\t\t\t\tconst integer = ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType );\n\n\t\t\t\t\tif ( geometryAttribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst data = geometryAttribute.data;\n\t\t\t\t\t\tconst stride = data.stride;\n\t\t\t\t\t\tconst offset = geometryAttribute.offset;\n\n\t\t\t\t\t\tif ( data.isInstancedInterleavedBuffer ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, data.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = data.meshPerAttribute * data.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tstride * bytesPerElement,\n\t\t\t\t\t\t\t\t( offset + ( size / programAttribute.locationSize ) * i ) * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( geometryAttribute.isInstancedBufferAttribute ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, geometryAttribute.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tsize * bytesPerElement,\n\t\t\t\t\t\t\t\t( size / programAttribute.locationSize ) * i * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( materialDefaultAttributeValues !== undefined ) {\n\n\t\t\t\t\tconst value = materialDefaultAttributeValues[ name ];\n\n\t\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\t\tswitch ( value.length ) {\n\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\tgl.vertexAttrib2fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\tgl.vertexAttrib3fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\tgl.vertexAttrib4fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tgl.vertexAttrib1fv( programAttribute.location, value );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tdisableUnusedAttributes();\n\n\t}\n\n\tfunction dispose() {\n\n\t\treset();\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tfor ( const programId in programMap ) {\n\n\t\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t\t}\n\n\t\t\t\tdelete programMap[ programId ];\n\n\t\t\t}\n\n\t\t\tdelete bindingStates[ geometryId ];\n\n\t\t}\n\n\t}\n\n\tfunction releaseStatesOfGeometry( geometry ) {\n\n\t\tif ( bindingStates[ geometry.id ] === undefined ) return;\n\n\t\tconst programMap = bindingStates[ geometry.id ];\n\n\t\tfor ( const programId in programMap ) {\n\n\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ programId ];\n\n\t\t}\n\n\t\tdelete bindingStates[ geometry.id ];\n\n\t}\n\n\tfunction releaseStatesOfProgram( program ) {\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tif ( programMap[ program.id ] === undefined ) continue;\n\n\t\t\tconst stateMap = programMap[ program.id ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ program.id ];\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\tresetDefaultState();\n\t\tforceUpdate = true;\n\n\t\tif ( currentState === defaultState ) return;\n\n\t\tcurrentState = defaultState;\n\t\tbindVertexArrayObject( currentState.object );\n\n\t}\n\n\t// for backward-compatibility\n\n\tfunction resetDefaultState() {\n\n\t\tdefaultState.geometry = null;\n\t\tdefaultState.program = null;\n\t\tdefaultState.wireframe = false;\n\n\t}\n\n\treturn {\n\n\t\tsetup: setup,\n\t\treset: reset,\n\t\tresetDefaultState: resetDefaultState,\n\t\tdispose: dispose,\n\t\treleaseStatesOfGeometry: releaseStatesOfGeometry,\n\t\treleaseStatesOfProgram: releaseStatesOfProgram,\n\n\t\tinitAttributes: initAttributes,\n\t\tenableAttribute: enableAttribute,\n\t\tdisableUnusedAttributes: disableUnusedAttributes\n\n\t};\n\n}\n\nfunction WebGLBufferRenderer( gl, extensions, info ) {\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawArrays( mode, start, count );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tgl.drawArraysInstanced( mode, start, count, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\n\t\tif ( extension === null ) {\n\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\tthis.render( starts[ i ], counts[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\textension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );\n\n\t\t\tlet elementCount = 0;\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\telementCount += counts[ i ];\n\n\t\t\t}\n\n\t\t\tinfo.update( elementCount, mode, 1 );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\tthis.renderMultiDraw = renderMultiDraw;\n\n}\n\nfunction WebGLCapabilities( gl, extensions, parameters ) {\n\n\tlet maxAnisotropy;\n\n\tfunction getMaxAnisotropy() {\n\n\t\tif ( maxAnisotropy !== undefined ) return maxAnisotropy;\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tmaxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT );\n\n\t\t} else {\n\n\t\t\tmaxAnisotropy = 0;\n\n\t\t}\n\n\t\treturn maxAnisotropy;\n\n\t}\n\n\tfunction getMaxPrecision( precision ) {\n\n\t\tif ( precision === 'highp' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'highp';\n\n\t\t\t}\n\n\t\t\tprecision = 'mediump';\n\n\t\t}\n\n\t\tif ( precision === 'mediump' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'mediump';\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn 'lowp';\n\n\t}\n\n\tlet precision = parameters.precision !== undefined ? parameters.precision : 'highp';\n\tconst maxPrecision = getMaxPrecision( precision );\n\n\tif ( maxPrecision !== precision ) {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );\n\t\tprecision = maxPrecision;\n\n\t}\n\n\tconst logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );\n\tconst maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );\n\tconst maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE );\n\tconst maxCubemapSize = gl.getParameter( gl.MAX_CUBE_MAP_TEXTURE_SIZE );\n\n\tconst maxAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\tconst maxVertexUniforms = gl.getParameter( gl.MAX_VERTEX_UNIFORM_VECTORS );\n\tconst maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS );\n\tconst maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );\n\n\tconst vertexTextures = maxVertexTextures > 0;\n\n\tconst maxSamples = gl.getParameter( gl.MAX_SAMPLES );\n\n\treturn {\n\n\t\tisWebGL2: true, // keeping this for backwards compatibility\n\n\t\tgetMaxAnisotropy: getMaxAnisotropy,\n\t\tgetMaxPrecision: getMaxPrecision,\n\n\t\tprecision: precision,\n\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\tmaxTextures: maxTextures,\n\t\tmaxVertexTextures: maxVertexTextures,\n\t\tmaxTextureSize: maxTextureSize,\n\t\tmaxCubemapSize: maxCubemapSize,\n\n\t\tmaxAttributes: maxAttributes,\n\t\tmaxVertexUniforms: maxVertexUniforms,\n\t\tmaxVaryings: maxVaryings,\n\t\tmaxFragmentUniforms: maxFragmentUniforms,\n\n\t\tvertexTextures: vertexTextures,\n\n\t\tmaxSamples: maxSamples\n\n\t};\n\n}\n\nfunction WebGLClipping( properties ) {\n\n\tconst scope = this;\n\n\tlet globalState = null,\n\t\tnumGlobalPlanes = 0,\n\t\tlocalClippingEnabled = false,\n\t\trenderingShadows = false;\n\n\tconst plane = new Plane(),\n\t\tviewNormalMatrix = new Matrix3(),\n\n\t\tuniform = { value: null, needsUpdate: false };\n\n\tthis.uniform = uniform;\n\tthis.numPlanes = 0;\n\tthis.numIntersection = 0;\n\n\tthis.init = function ( planes, enableLocalClipping ) {\n\n\t\tconst enabled =\n\t\t\tplanes.length !== 0 ||\n\t\t\tenableLocalClipping ||\n\t\t\t// enable state of previous frame - the clipping code has to\n\t\t\t// run another frame in order to reset the state:\n\t\t\tnumGlobalPlanes !== 0 ||\n\t\t\tlocalClippingEnabled;\n\n\t\tlocalClippingEnabled = enableLocalClipping;\n\n\t\tnumGlobalPlanes = planes.length;\n\n\t\treturn enabled;\n\n\t};\n\n\tthis.beginShadows = function () {\n\n\t\trenderingShadows = true;\n\t\tprojectPlanes( null );\n\n\t};\n\n\tthis.endShadows = function () {\n\n\t\trenderingShadows = false;\n\n\t};\n\n\tthis.setGlobalState = function ( planes, camera ) {\n\n\t\tglobalState = projectPlanes( planes, camera, 0 );\n\n\t};\n\n\tthis.setState = function ( material, camera, useCache ) {\n\n\t\tconst planes = material.clippingPlanes,\n\t\t\tclipIntersection = material.clipIntersection,\n\t\t\tclipShadows = material.clipShadows;\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tif ( ! localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && ! clipShadows ) {\n\n\t\t\t// there's no local clipping\n\n\t\t\tif ( renderingShadows ) {\n\n\t\t\t\t// there's no global clipping\n\n\t\t\t\tprojectPlanes( null );\n\n\t\t\t} else {\n\n\t\t\t\tresetGlobalState();\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst nGlobal = renderingShadows ? 0 : numGlobalPlanes,\n\t\t\t\tlGlobal = nGlobal * 4;\n\n\t\t\tlet dstArray = materialProperties.clippingState || null;\n\n\t\t\tuniform.value = dstArray; // ensure unique state\n\n\t\t\tdstArray = projectPlanes( planes, camera, lGlobal, useCache );\n\n\t\t\tfor ( let i = 0; i !== lGlobal; ++ i ) {\n\n\t\t\t\tdstArray[ i ] = globalState[ i ];\n\n\t\t\t}\n\n\t\t\tmaterialProperties.clippingState = dstArray;\n\t\t\tthis.numIntersection = clipIntersection ? this.numPlanes : 0;\n\t\t\tthis.numPlanes += nGlobal;\n\n\t\t}\n\n\n\t};\n\n\tfunction resetGlobalState() {\n\n\t\tif ( uniform.value !== globalState ) {\n\n\t\t\tuniform.value = globalState;\n\t\t\tuniform.needsUpdate = numGlobalPlanes > 0;\n\n\t\t}\n\n\t\tscope.numPlanes = numGlobalPlanes;\n\t\tscope.numIntersection = 0;\n\n\t}\n\n\tfunction projectPlanes( planes, camera, dstOffset, skipTransform ) {\n\n\t\tconst nPlanes = planes !== null ? planes.length : 0;\n\t\tlet dstArray = null;\n\n\t\tif ( nPlanes !== 0 ) {\n\n\t\t\tdstArray = uniform.value;\n\n\t\t\tif ( skipTransform !== true || dstArray === null ) {\n\n\t\t\t\tconst flatSize = dstOffset + nPlanes * 4,\n\t\t\t\t\tviewMatrix = camera.matrixWorldInverse;\n\n\t\t\t\tviewNormalMatrix.getNormalMatrix( viewMatrix );\n\n\t\t\t\tif ( dstArray === null || dstArray.length < flatSize ) {\n\n\t\t\t\t\tdstArray = new Float32Array( flatSize );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) {\n\n\t\t\t\t\tplane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix );\n\n\t\t\t\t\tplane.normal.toArray( dstArray, i4 );\n\t\t\t\t\tdstArray[ i4 + 3 ] = plane.constant;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tuniform.value = dstArray;\n\t\t\tuniform.needsUpdate = true;\n\n\t\t}\n\n\t\tscope.numPlanes = nPlanes;\n\t\tscope.numIntersection = 0;\n\n\t\treturn dstArray;\n\n\t}\n\n}\n\nfunction WebGLCubeMaps( renderer ) {\n\n\tlet cubemaps = new WeakMap();\n\n\tfunction mapTextureMapping( texture, mapping ) {\n\n\t\tif ( mapping === EquirectangularReflectionMapping ) {\n\n\t\t\ttexture.mapping = CubeReflectionMapping;\n\n\t\t} else if ( mapping === EquirectangularRefractionMapping ) {\n\n\t\t\ttexture.mapping = CubeRefractionMapping;\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tif ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) {\n\n\t\t\t\tif ( cubemaps.has( texture ) ) {\n\n\t\t\t\t\tconst cubemap = cubemaps.get( texture ).texture;\n\t\t\t\t\treturn mapTextureMapping( cubemap, texture.mapping );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\tif ( image && image.height > 0 ) {\n\n\t\t\t\t\t\tconst renderTarget = new WebGLCubeRenderTarget( image.height );\n\t\t\t\t\t\trenderTarget.fromEquirectangularTexture( renderer, texture );\n\t\t\t\t\t\tcubemaps.set( texture, renderTarget );\n\n\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\treturn mapTextureMapping( renderTarget.texture, texture.mapping );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemap = cubemaps.get( texture );\n\n\t\tif ( cubemap !== undefined ) {\n\n\t\t\tcubemaps.delete( texture );\n\t\t\tcubemap.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubemaps = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass OrthographicCamera extends Camera {\n\n\tconstructor( left = - 1, right = 1, top = 1, bottom = - 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isOrthographicCamera = true;\n\n\t\tthis.type = 'OrthographicCamera';\n\n\t\tthis.zoom = 1;\n\t\tthis.view = null;\n\n\t\tthis.left = left;\n\t\tthis.right = right;\n\t\tthis.top = top;\n\t\tthis.bottom = bottom;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.left = source.left;\n\t\tthis.right = source.right;\n\t\tthis.top = source.top;\n\t\tthis.bottom = source.bottom;\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\n\t\tthis.zoom = source.zoom;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\treturn this;\n\n\t}\n\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst dx = ( this.right - this.left ) / ( 2 * this.zoom );\n\t\tconst dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\n\t\tconst cx = ( this.right + this.left ) / 2;\n\t\tconst cy = ( this.top + this.bottom ) / 2;\n\n\t\tlet left = cx - dx;\n\t\tlet right = cx + dx;\n\t\tlet top = cy + dy;\n\t\tlet bottom = cy - dy;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom;\n\t\t\tconst scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom;\n\n\t\t\tleft += scaleW * this.view.offsetX;\n\t\t\tright = left + scaleW * this.view.width;\n\t\t\ttop -= scaleH * this.view.offsetY;\n\t\t\tbottom = top - scaleH * this.view.height;\n\n\t\t}\n\n\t\tthis.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.zoom = this.zoom;\n\t\tdata.object.left = this.left;\n\t\tdata.object.right = this.right;\n\t\tdata.object.top = this.top;\n\t\tdata.object.bottom = this.bottom;\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst LOD_MIN = 4;\n\n// The standard deviations (radians) associated with the extra mips. These are\n// chosen to approximate a Trowbridge-Reitz distribution function times the\n// geometric shadowing function. These sigma values squared must match the\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\nconst EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];\n\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\nconst MAX_SAMPLES = 20;\n\nconst _flatCamera = /*@__PURE__*/ new OrthographicCamera();\nconst _clearColor = /*@__PURE__*/ new Color();\nlet _oldTarget = null;\nlet _oldActiveCubeFace = 0;\nlet _oldActiveMipmapLevel = 0;\nlet _oldXrEnabled = false;\n\n// Golden Ratio\nconst PHI = ( 1 + Math.sqrt( 5 ) ) / 2;\nconst INV_PHI = 1 / PHI;\n\n// Vertices of a dodecahedron (except the opposites, which represent the\n// same axis), used as axis directions evenly spread on a sphere.\nconst _axisDirections = [\n\t/*@__PURE__*/ new Vector3( 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),\n\t/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ) ];\n\n/**\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n *\n * Paper: Fast, Accurate Image-Based Lighting\n * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view\n*/\n\nclass PMREMGenerator {\n\n\tconstructor( renderer ) {\n\n\t\tthis._renderer = renderer;\n\t\tthis._pingPongRenderTarget = null;\n\n\t\tthis._lodMax = 0;\n\t\tthis._cubeSize = 0;\n\t\tthis._lodPlanes = [];\n\t\tthis._sizeLods = [];\n\t\tthis._sigmas = [];\n\n\t\tthis._blurMaterial = null;\n\t\tthis._cubemapMaterial = null;\n\t\tthis._equirectMaterial = null;\n\n\t\tthis._compileMaterial( this._blurMaterial );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\n\t * in radians to be applied to the scene before PMREM generation. Optional near\n\t * and far planes ensure the scene is rendered in its entirety (the cubeCamera\n\t * is placed at the origin).\n\t */\n\tfromScene( scene, sigma = 0, near = 0.1, far = 100 ) {\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\t\t_oldXrEnabled = this._renderer.xr.enabled;\n\n\t\tthis._renderer.xr.enabled = false;\n\n\t\tthis._setSize( 256 );\n\n\t\tconst cubeUVRenderTarget = this._allocateTargets();\n\t\tcubeUVRenderTarget.depthBuffer = true;\n\n\t\tthis._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );\n\n\t\tif ( sigma > 0 ) {\n\n\t\t\tthis._blur( cubeUVRenderTarget, 0, 0, sigma );\n\n\t\t}\n\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * or HDR. The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t * The smallest supported equirectangular image size is 64 x 32.\n\t */\n\tfromEquirectangular( equirectangular, renderTarget = null ) {\n\n\t\treturn this._fromTexture( equirectangular, renderTarget );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\n\t * or HDR. The ideal input cube size is 256 x 256,\n\t * as this matches best with the 256 x 256 cubemap output.\n\t * The smallest supported cube size is 16 x 16.\n\t */\n\tfromCubemap( cubemap, renderTarget = null ) {\n\n\t\treturn this._fromTexture( cubemap, renderTarget );\n\n\t}\n\n\t/**\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileCubemapShader() {\n\n\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\t\t\tthis._compileMaterial( this._cubemapMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileEquirectangularShader() {\n\n\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\t\t\tthis._compileMaterial( this._equirectMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n\t * one of them will cause any others to also become unusable.\n\t */\n\tdispose() {\n\n\t\tthis._dispose();\n\n\t\tif ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();\n\t\tif ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();\n\n\t}\n\n\t// private interface\n\n\t_setSize( cubeSize ) {\n\n\t\tthis._lodMax = Math.floor( Math.log2( cubeSize ) );\n\t\tthis._cubeSize = Math.pow( 2, this._lodMax );\n\n\t}\n\n\t_dispose() {\n\n\t\tif ( this._blurMaterial !== null ) this._blurMaterial.dispose();\n\n\t\tif ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();\n\n\t\tfor ( let i = 0; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tthis._lodPlanes[ i ].dispose();\n\n\t\t}\n\n\t}\n\n\t_cleanup( outputTarget ) {\n\n\t\tthis._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );\n\t\tthis._renderer.xr.enabled = _oldXrEnabled;\n\n\t\toutputTarget.scissorTest = false;\n\t\t_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );\n\n\t}\n\n\t_fromTexture( texture, renderTarget ) {\n\n\t\tif ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping ) {\n\n\t\t\tthis._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );\n\n\t\t} else { // Equirectangular\n\n\t\t\tthis._setSize( texture.image.width / 4 );\n\n\t\t}\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\t\t_oldXrEnabled = this._renderer.xr.enabled;\n\n\t\tthis._renderer.xr.enabled = false;\n\n\t\tconst cubeUVRenderTarget = renderTarget || this._allocateTargets();\n\t\tthis._textureToCubeUV( texture, cubeUVRenderTarget );\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_allocateTargets() {\n\n\t\tconst width = 3 * Math.max( this._cubeSize, 16 * 7 );\n\t\tconst height = 4 * this._cubeSize;\n\n\t\tconst params = {\n\t\t\tmagFilter: LinearFilter,\n\t\t\tminFilter: LinearFilter,\n\t\t\tgenerateMipmaps: false,\n\t\t\ttype: HalfFloatType,\n\t\t\tformat: RGBAFormat,\n\t\t\tcolorSpace: LinearSRGBColorSpace,\n\t\t\tdepthBuffer: false\n\t\t};\n\n\t\tconst cubeUVRenderTarget = _createRenderTarget( width, height, params );\n\n\t\tif ( this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height ) {\n\n\t\t\tif ( this._pingPongRenderTarget !== null ) {\n\n\t\t\t\tthis._dispose();\n\n\t\t\t}\n\n\t\t\tthis._pingPongRenderTarget = _createRenderTarget( width, height, params );\n\n\t\t\tconst { _lodMax } = this;\n\t\t\t( { sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _createPlanes( _lodMax ) );\n\n\t\t\tthis._blurMaterial = _getBlurShader( _lodMax, width, height );\n\n\t\t}\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_compileMaterial( material ) {\n\n\t\tconst tmpMesh = new Mesh( this._lodPlanes[ 0 ], material );\n\t\tthis._renderer.compile( tmpMesh, _flatCamera );\n\n\t}\n\n\t_sceneToCubeUV( scene, near, far, cubeUVRenderTarget ) {\n\n\t\tconst fov = 90;\n\t\tconst aspect = 1;\n\t\tconst cubeCamera = new PerspectiveCamera( fov, aspect, near, far );\n\t\tconst upSign = [ 1, - 1, 1, 1, 1, 1 ];\n\t\tconst forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ];\n\t\tconst renderer = this._renderer;\n\n\t\tconst originalAutoClear = renderer.autoClear;\n\t\tconst toneMapping = renderer.toneMapping;\n\t\trenderer.getClearColor( _clearColor );\n\n\t\trenderer.toneMapping = NoToneMapping;\n\t\trenderer.autoClear = false;\n\n\t\tconst backgroundMaterial = new MeshBasicMaterial( {\n\t\t\tname: 'PMREM.Background',\n\t\t\tside: BackSide,\n\t\t\tdepthWrite: false,\n\t\t\tdepthTest: false,\n\t\t} );\n\n\t\tconst backgroundBox = new Mesh( new BoxGeometry(), backgroundMaterial );\n\n\t\tlet useSolidColor = false;\n\t\tconst background = scene.background;\n\n\t\tif ( background ) {\n\n\t\t\tif ( background.isColor ) {\n\n\t\t\t\tbackgroundMaterial.color.copy( background );\n\t\t\t\tscene.background = null;\n\t\t\t\tuseSolidColor = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tbackgroundMaterial.color.copy( _clearColor );\n\t\t\tuseSolidColor = true;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst col = i % 3;\n\n\t\t\tif ( col === 0 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( forwardSign[ i ], 0, 0 );\n\n\t\t\t} else if ( col === 1 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, 0, upSign[ i ] );\n\t\t\t\tcubeCamera.lookAt( 0, forwardSign[ i ], 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( 0, 0, forwardSign[ i ] );\n\n\t\t\t}\n\n\t\t\tconst size = this._cubeSize;\n\n\t\t\t_setViewport( cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size );\n\n\t\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\n\t\t\tif ( useSolidColor ) {\n\n\t\t\t\trenderer.render( backgroundBox, cubeCamera );\n\n\t\t\t}\n\n\t\t\trenderer.render( scene, cubeCamera );\n\n\t\t}\n\n\t\tbackgroundBox.geometry.dispose();\n\t\tbackgroundBox.material.dispose();\n\n\t\trenderer.toneMapping = toneMapping;\n\t\trenderer.autoClear = originalAutoClear;\n\t\tscene.background = background;\n\n\t}\n\n\t_textureToCubeUV( texture, cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst isCubeTexture = ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping );\n\n\t\tif ( isCubeTexture ) {\n\n\t\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\n\t\t\t}\n\n\t\t\tthis._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t} else {\n\n\t\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;\n\t\tconst mesh = new Mesh( this._lodPlanes[ 0 ], material );\n\n\t\tconst uniforms = material.uniforms;\n\n\t\tuniforms[ 'envMap' ].value = texture;\n\n\t\tconst size = this._cubeSize;\n\n\t\t_setViewport( cubeUVRenderTarget, 0, 0, 3 * size, 2 * size );\n\n\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\t\trenderer.render( mesh, _flatCamera );\n\n\t}\n\n\t_applyPMREM( cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst autoClear = renderer.autoClear;\n\t\trenderer.autoClear = false;\n\n\t\tfor ( let i = 1; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tconst sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );\n\n\t\t\tconst poleAxis = _axisDirections[ ( i - 1 ) % _axisDirections.length ];\n\n\t\t\tthis._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );\n\n\t\t}\n\n\t\trenderer.autoClear = autoClear;\n\n\t}\n\n\t/**\n\t * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n\t * vertically and horizontally, but this breaks down on a cube. Here we apply\n\t * the blur latitudinally (around the poles), and then longitudinally (towards\n\t * the poles) to approximate the orthogonally-separable blur. It is least\n\t * accurate at the poles, but still does a decent job.\n\t */\n\t_blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {\n\n\t\tconst pingPongRenderTarget = this._pingPongRenderTarget;\n\n\t\tthis._halfBlur(\n\t\t\tcubeUVRenderTarget,\n\t\t\tpingPongRenderTarget,\n\t\t\tlodIn,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'latitudinal',\n\t\t\tpoleAxis );\n\n\t\tthis._halfBlur(\n\t\t\tpingPongRenderTarget,\n\t\t\tcubeUVRenderTarget,\n\t\t\tlodOut,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'longitudinal',\n\t\t\tpoleAxis );\n\n\t}\n\n\t_halfBlur( targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst blurMaterial = this._blurMaterial;\n\n\t\tif ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {\n\n\t\t\tconsole.error(\n\t\t\t\t'blur direction must be either latitudinal or longitudinal!' );\n\n\t\t}\n\n\t\t// Number of standard deviations at which to cut off the discrete approximation.\n\t\tconst STANDARD_DEVIATIONS = 3;\n\n\t\tconst blurMesh = new Mesh( this._lodPlanes[ lodOut ], blurMaterial );\n\t\tconst blurUniforms = blurMaterial.uniforms;\n\n\t\tconst pixels = this._sizeLods[ lodIn ] - 1;\n\t\tconst radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );\n\t\tconst sigmaPixels = sigmaRadians / radiansPerPixel;\n\t\tconst samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;\n\n\t\tif ( samples > MAX_SAMPLES ) {\n\n\t\t\tconsole.warn( `sigmaRadians, ${\n\t\t\t\tsigmaRadians}, is too large and will clip, as it requested ${\n\t\t\t\tsamples} samples when the maximum is set to ${MAX_SAMPLES}` );\n\n\t\t}\n\n\t\tconst weights = [];\n\t\tlet sum = 0;\n\n\t\tfor ( let i = 0; i < MAX_SAMPLES; ++ i ) {\n\n\t\t\tconst x = i / sigmaPixels;\n\t\t\tconst weight = Math.exp( - x * x / 2 );\n\t\t\tweights.push( weight );\n\n\t\t\tif ( i === 0 ) {\n\n\t\t\t\tsum += weight;\n\n\t\t\t} else if ( i < samples ) {\n\n\t\t\t\tsum += 2 * weight;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < weights.length; i ++ ) {\n\n\t\t\tweights[ i ] = weights[ i ] / sum;\n\n\t\t}\n\n\t\tblurUniforms[ 'envMap' ].value = targetIn.texture;\n\t\tblurUniforms[ 'samples' ].value = samples;\n\t\tblurUniforms[ 'weights' ].value = weights;\n\t\tblurUniforms[ 'latitudinal' ].value = direction === 'latitudinal';\n\n\t\tif ( poleAxis ) {\n\n\t\t\tblurUniforms[ 'poleAxis' ].value = poleAxis;\n\n\t\t}\n\n\t\tconst { _lodMax } = this;\n\t\tblurUniforms[ 'dTheta' ].value = radiansPerPixel;\n\t\tblurUniforms[ 'mipInt' ].value = _lodMax - lodIn;\n\n\t\tconst outputSize = this._sizeLods[ lodOut ];\n\t\tconst x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );\n\t\tconst y = 4 * ( this._cubeSize - outputSize );\n\n\t\t_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );\n\t\trenderer.setRenderTarget( targetOut );\n\t\trenderer.render( blurMesh, _flatCamera );\n\n\t}\n\n}\n\n\n\nfunction _createPlanes( lodMax ) {\n\n\tconst lodPlanes = [];\n\tconst sizeLods = [];\n\tconst sigmas = [];\n\n\tlet lod = lodMax;\n\n\tconst totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;\n\n\tfor ( let i = 0; i < totalLods; i ++ ) {\n\n\t\tconst sizeLod = Math.pow( 2, lod );\n\t\tsizeLods.push( sizeLod );\n\t\tlet sigma = 1.0 / sizeLod;\n\n\t\tif ( i > lodMax - LOD_MIN ) {\n\n\t\t\tsigma = EXTRA_LOD_SIGMA[ i - lodMax + LOD_MIN - 1 ];\n\n\t\t} else if ( i === 0 ) {\n\n\t\t\tsigma = 0;\n\n\t\t}\n\n\t\tsigmas.push( sigma );\n\n\t\tconst texelSize = 1.0 / ( sizeLod - 2 );\n\t\tconst min = - texelSize;\n\t\tconst max = 1 + texelSize;\n\t\tconst uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];\n\n\t\tconst cubeFaces = 6;\n\t\tconst vertices = 6;\n\t\tconst positionSize = 3;\n\t\tconst uvSize = 2;\n\t\tconst faceIndexSize = 1;\n\n\t\tconst position = new Float32Array( positionSize * vertices * cubeFaces );\n\t\tconst uv = new Float32Array( uvSize * vertices * cubeFaces );\n\t\tconst faceIndex = new Float32Array( faceIndexSize * vertices * cubeFaces );\n\n\t\tfor ( let face = 0; face < cubeFaces; face ++ ) {\n\n\t\t\tconst x = ( face % 3 ) * 2 / 3 - 1;\n\t\t\tconst y = face > 2 ? 0 : - 1;\n\t\t\tconst coordinates = [\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y + 1, 0\n\t\t\t];\n\t\t\tposition.set( coordinates, positionSize * vertices * face );\n\t\t\tuv.set( uv1, uvSize * vertices * face );\n\t\t\tconst fill = [ face, face, face, face, face, face ];\n\t\t\tfaceIndex.set( fill, faceIndexSize * vertices * face );\n\n\t\t}\n\n\t\tconst planes = new BufferGeometry();\n\t\tplanes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );\n\t\tplanes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );\n\t\tplanes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );\n\t\tlodPlanes.push( planes );\n\n\t\tif ( lod > LOD_MIN ) {\n\n\t\t\tlod --;\n\n\t\t}\n\n\t}\n\n\treturn { lodPlanes, sizeLods, sigmas };\n\n}\n\nfunction _createRenderTarget( width, height, params ) {\n\n\tconst cubeUVRenderTarget = new WebGLRenderTarget( width, height, params );\n\tcubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;\n\tcubeUVRenderTarget.texture.name = 'PMREM.cubeUv';\n\tcubeUVRenderTarget.scissorTest = true;\n\treturn cubeUVRenderTarget;\n\n}\n\nfunction _setViewport( target, x, y, width, height ) {\n\n\ttarget.viewport.set( x, y, width, height );\n\ttarget.scissor.set( x, y, width, height );\n\n}\n\nfunction _getBlurShader( lodMax, width, height ) {\n\n\tconst weights = new Float32Array( MAX_SAMPLES );\n\tconst poleAxis = new Vector3( 0, 1, 0 );\n\tconst shaderMaterial = new ShaderMaterial( {\n\n\t\tname: 'SphericalGaussianBlur',\n\n\t\tdefines: {\n\t\t\t'n': MAX_SAMPLES,\n\t\t\t'CUBEUV_TEXEL_WIDTH': 1.0 / width,\n\t\t\t'CUBEUV_TEXEL_HEIGHT': 1.0 / height,\n\t\t\t'CUBEUV_MAX_MIP': `${lodMax}.0`,\n\t\t},\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'samples': { value: 1 },\n\t\t\t'weights': { value: weights },\n\t\t\t'latitudinal': { value: false },\n\t\t\t'dTheta': { value: 0 },\n\t\t\t'mipInt': { value: 0 },\n\t\t\t'poleAxis': { value: poleAxis }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getEquirectMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'EquirectangularToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCubemapMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'CubemapToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'flipEnvMap': { value: - 1 }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCommonVertexShader() {\n\n\treturn /* glsl */`\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t`;\n\n}\n\nfunction WebGLCubeUVMaps( renderer ) {\n\n\tlet cubeUVmaps = new WeakMap();\n\n\tlet pmremGenerator = null;\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tconst isEquirectMap = ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping );\n\t\t\tconst isCubeMap = ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping );\n\n\t\t\t// equirect/cube map to cubeUV conversion\n\n\t\t\tif ( isEquirectMap || isCubeMap ) {\n\n\t\t\t\tlet renderTarget = cubeUVmaps.get( texture );\n\n\t\t\t\tconst currentPMREMVersion = renderTarget !== undefined ? renderTarget.texture.pmremVersion : 0;\n\n\t\t\t\tif ( texture.isRenderTargetTexture && texture.pmremVersion !== currentPMREMVersion ) {\n\n\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );\n\t\t\t\t\trenderTarget.texture.pmremVersion = texture.pmremVersion;\n\n\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( renderTarget !== undefined ) {\n\n\t\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\t\tif ( ( isEquirectMap && image && image.height > 0 ) || ( isCubeMap && image && isCubeTextureComplete( image ) ) ) {\n\n\t\t\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\t\t\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );\n\t\t\t\t\t\t\trenderTarget.texture.pmremVersion = texture.pmremVersion;\n\n\t\t\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction isCubeTextureComplete( image ) {\n\n\t\tlet count = 0;\n\t\tconst length = 6;\n\n\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\tif ( image[ i ] !== undefined ) count ++;\n\n\t\t}\n\n\t\treturn count === length;\n\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemapUV = cubeUVmaps.get( texture );\n\n\t\tif ( cubemapUV !== undefined ) {\n\n\t\t\tcubeUVmaps.delete( texture );\n\t\t\tcubemapUV.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubeUVmaps = new WeakMap();\n\n\t\tif ( pmremGenerator !== null ) {\n\n\t\t\tpmremGenerator.dispose();\n\t\t\tpmremGenerator = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLExtensions( gl ) {\n\n\tconst extensions = {};\n\n\tfunction getExtension( name ) {\n\n\t\tif ( extensions[ name ] !== undefined ) {\n\n\t\t\treturn extensions[ name ];\n\n\t\t}\n\n\t\tlet extension;\n\n\t\tswitch ( name ) {\n\n\t\t\tcase 'WEBGL_depth_texture':\n\t\t\t\textension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'EXT_texture_filter_anisotropic':\n\t\t\t\textension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_s3tc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_pvrtc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\textension = gl.getExtension( name );\n\n\t\t}\n\n\t\textensions[ name ] = extension;\n\n\t\treturn extension;\n\n\t}\n\n\treturn {\n\n\t\thas: function ( name ) {\n\n\t\t\treturn getExtension( name ) !== null;\n\n\t\t},\n\n\t\tinit: function () {\n\n\t\t\tgetExtension( 'EXT_color_buffer_float' );\n\t\t\tgetExtension( 'WEBGL_clip_cull_distance' );\n\t\t\tgetExtension( 'OES_texture_float_linear' );\n\t\t\tgetExtension( 'EXT_color_buffer_half_float' );\n\t\t\tgetExtension( 'WEBGL_multisampled_render_to_texture' );\n\t\t\tgetExtension( 'WEBGL_render_shared_exponent' );\n\n\t\t},\n\n\t\tget: function ( name ) {\n\n\t\t\tconst extension = getExtension( name );\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );\n\n\t\t\t}\n\n\t\t\treturn extension;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLGeometries( gl, attributes, info, bindingStates ) {\n\n\tconst geometries = {};\n\tconst wireframeAttributes = new WeakMap();\n\n\tfunction onGeometryDispose( event ) {\n\n\t\tconst geometry = event.target;\n\n\t\tif ( geometry.index !== null ) {\n\n\t\t\tattributes.remove( geometry.index );\n\n\t\t}\n\n\t\tfor ( const name in geometry.attributes ) {\n\n\t\t\tattributes.remove( geometry.attributes[ name ] );\n\n\t\t}\n\n\t\tfor ( const name in geometry.morphAttributes ) {\n\n\t\t\tconst array = geometry.morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.remove( array[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.removeEventListener( 'dispose', onGeometryDispose );\n\n\t\tdelete geometries[ geometry.id ];\n\n\t\tconst attribute = wireframeAttributes.get( geometry );\n\n\t\tif ( attribute ) {\n\n\t\t\tattributes.remove( attribute );\n\t\t\twireframeAttributes.delete( geometry );\n\n\t\t}\n\n\t\tbindingStates.releaseStatesOfGeometry( geometry );\n\n\t\tif ( geometry.isInstancedBufferGeometry === true ) {\n\n\t\t\tdelete geometry._maxInstanceCount;\n\n\t\t}\n\n\t\t//\n\n\t\tinfo.memory.geometries --;\n\n\t}\n\n\tfunction get( object, geometry ) {\n\n\t\tif ( geometries[ geometry.id ] === true ) return geometry;\n\n\t\tgeometry.addEventListener( 'dispose', onGeometryDispose );\n\n\t\tgeometries[ geometry.id ] = true;\n\n\t\tinfo.memory.geometries ++;\n\n\t\treturn geometry;\n\n\t}\n\n\tfunction update( geometry ) {\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates.\n\n\t\tfor ( const name in geometryAttributes ) {\n\n\t\t\tattributes.update( geometryAttributes[ name ], gl.ARRAY_BUFFER );\n\n\t\t}\n\n\t\t// morph targets\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.update( array[ i ], gl.ARRAY_BUFFER );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateWireframeAttribute( geometry ) {\n\n\t\tconst indices = [];\n\n\t\tconst geometryIndex = geometry.index;\n\t\tconst geometryPosition = geometry.attributes.position;\n\t\tlet version = 0;\n\n\t\tif ( geometryIndex !== null ) {\n\n\t\t\tconst array = geometryIndex.array;\n\t\t\tversion = geometryIndex.version;\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i += 3 ) {\n\n\t\t\t\tconst a = array[ i + 0 ];\n\t\t\t\tconst b = array[ i + 1 ];\n\t\t\t\tconst c = array[ i + 2 ];\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else if ( geometryPosition !== undefined ) {\n\n\t\t\tconst array = geometryPosition.array;\n\t\t\tversion = geometryPosition.version;\n\n\t\t\tfor ( let i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {\n\n\t\t\t\tconst a = i + 0;\n\t\t\t\tconst b = i + 1;\n\t\t\t\tconst c = i + 2;\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );\n\t\tattribute.version = version;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates\n\n\t\t//\n\n\t\tconst previousAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( previousAttribute ) attributes.remove( previousAttribute );\n\n\t\t//\n\n\t\twireframeAttributes.set( geometry, attribute );\n\n\t}\n\n\tfunction getWireframeAttribute( geometry ) {\n\n\t\tconst currentAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( currentAttribute ) {\n\n\t\t\tconst geometryIndex = geometry.index;\n\n\t\t\tif ( geometryIndex !== null ) {\n\n\t\t\t\t// if the attribute is obsolete, create a new one\n\n\t\t\t\tif ( currentAttribute.version < geometryIndex.version ) {\n\n\t\t\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t}\n\n\t\treturn wireframeAttributes.get( geometry );\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tupdate: update,\n\n\t\tgetWireframeAttribute: getWireframeAttribute\n\n\t};\n\n}\n\nfunction WebGLIndexedBufferRenderer( gl, extensions, info ) {\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tlet type, bytesPerElement;\n\n\tfunction setIndex( value ) {\n\n\t\ttype = value.type;\n\t\tbytesPerElement = value.bytesPerElement;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawElements( mode, count, type, start * bytesPerElement );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tgl.drawElementsInstanced( mode, count, type, start * bytesPerElement, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\n\t\tif ( extension === null ) {\n\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\tthis.render( starts[ i ] / bytesPerElement, counts[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\textension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );\n\n\t\t\tlet elementCount = 0;\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\telementCount += counts[ i ];\n\n\t\t\t}\n\n\t\t\tinfo.update( elementCount, mode, 1 );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.setIndex = setIndex;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\tthis.renderMultiDraw = renderMultiDraw;\n\n}\n\nfunction WebGLInfo( gl ) {\n\n\tconst memory = {\n\t\tgeometries: 0,\n\t\ttextures: 0\n\t};\n\n\tconst render = {\n\t\tframe: 0,\n\t\tcalls: 0,\n\t\ttriangles: 0,\n\t\tpoints: 0,\n\t\tlines: 0\n\t};\n\n\tfunction update( count, mode, instanceCount ) {\n\n\t\trender.calls ++;\n\n\t\tswitch ( mode ) {\n\n\t\t\tcase gl.TRIANGLES:\n\t\t\t\trender.triangles += instanceCount * ( count / 3 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINES:\n\t\t\t\trender.lines += instanceCount * ( count / 2 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_STRIP:\n\t\t\t\trender.lines += instanceCount * ( count - 1 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_LOOP:\n\t\t\t\trender.lines += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tcase gl.POINTS:\n\t\t\t\trender.points += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.error( 'THREE.WebGLInfo: Unknown draw mode:', mode );\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\trender.calls = 0;\n\t\trender.triangles = 0;\n\t\trender.points = 0;\n\t\trender.lines = 0;\n\n\t}\n\n\treturn {\n\t\tmemory: memory,\n\t\trender: render,\n\t\tprograms: null,\n\t\tautoReset: true,\n\t\treset: reset,\n\t\tupdate: update\n\t};\n\n}\n\nfunction WebGLMorphtargets( gl, capabilities, textures ) {\n\n\tconst morphTextures = new WeakMap();\n\tconst morph = new Vector4();\n\n\tfunction update( object, geometry, program ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\t// instead of using attributes, the WebGL 2 code path encodes morph targets\n\t\t// into an array of data textures. Each layer represents a single morph target.\n\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\tlet entry = morphTextures.get( geometry );\n\n\t\tif ( entry === undefined || entry.count !== morphTargetsCount ) {\n\n\t\t\tif ( entry !== undefined ) entry.texture.dispose();\n\n\t\t\tconst hasMorphPosition = geometry.morphAttributes.position !== undefined;\n\t\t\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n\t\t\tconst hasMorphColors = geometry.morphAttributes.color !== undefined;\n\n\t\t\tconst morphTargets = geometry.morphAttributes.position || [];\n\t\t\tconst morphNormals = geometry.morphAttributes.normal || [];\n\t\t\tconst morphColors = geometry.morphAttributes.color || [];\n\n\t\t\tlet vertexDataCount = 0;\n\n\t\t\tif ( hasMorphPosition === true ) vertexDataCount = 1;\n\t\t\tif ( hasMorphNormals === true ) vertexDataCount = 2;\n\t\t\tif ( hasMorphColors === true ) vertexDataCount = 3;\n\n\t\t\tlet width = geometry.attributes.position.count * vertexDataCount;\n\t\t\tlet height = 1;\n\n\t\t\tif ( width > capabilities.maxTextureSize ) {\n\n\t\t\t\theight = Math.ceil( width / capabilities.maxTextureSize );\n\t\t\t\twidth = capabilities.maxTextureSize;\n\n\t\t\t}\n\n\t\t\tconst buffer = new Float32Array( width * height * 4 * morphTargetsCount );\n\n\t\t\tconst texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );\n\t\t\ttexture.type = FloatType;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\t// fill buffer\n\n\t\t\tconst vertexDataStride = vertexDataCount * 4;\n\n\t\t\tfor ( let i = 0; i < morphTargetsCount; i ++ ) {\n\n\t\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\t\tconst morphNormal = morphNormals[ i ];\n\t\t\t\tconst morphColor = morphColors[ i ];\n\n\t\t\t\tconst offset = width * height * 4 * i;\n\n\t\t\t\tfor ( let j = 0; j < morphTarget.count; j ++ ) {\n\n\t\t\t\t\tconst stride = j * vertexDataStride;\n\n\t\t\t\t\tif ( hasMorphPosition === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphTarget, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 0 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 1 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 2 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 3 ] = 0;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hasMorphNormals === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphNormal, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 4 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 5 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 6 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 7 ] = 0;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hasMorphColors === true ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphColor, j );\n\n\t\t\t\t\t\tbuffer[ offset + stride + 8 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 9 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 10 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tentry = {\n\t\t\t\tcount: morphTargetsCount,\n\t\t\t\ttexture: texture,\n\t\t\t\tsize: new Vector2( width, height )\n\t\t\t};\n\n\t\t\tmorphTextures.set( geometry, entry );\n\n\t\t\tfunction disposeTexture() {\n\n\t\t\t\ttexture.dispose();\n\n\t\t\t\tmorphTextures.delete( geometry );\n\n\t\t\t\tgeometry.removeEventListener( 'dispose', disposeTexture );\n\n\t\t\t}\n\n\t\t\tgeometry.addEventListener( 'dispose', disposeTexture );\n\n\t\t}\n\n\t\t//\n\t\tif ( object.isInstancedMesh === true && object.morphTexture !== null ) {\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );\n\n\t\t} else {\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );\n\n\t\t}\n\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );\n\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );\n\n\t}\n\n\treturn {\n\n\t\tupdate: update\n\n\t};\n\n}\n\nfunction WebGLObjects( gl, geometries, attributes, info ) {\n\n\tlet updateMap = new WeakMap();\n\n\tfunction update( object ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\tconst geometry = object.geometry;\n\t\tconst buffergeometry = geometries.get( object, geometry );\n\n\t\t// Update once per frame\n\n\t\tif ( updateMap.get( buffergeometry ) !== frame ) {\n\n\t\t\tgeometries.update( buffergeometry );\n\n\t\t\tupdateMap.set( buffergeometry, frame );\n\n\t\t}\n\n\t\tif ( object.isInstancedMesh ) {\n\n\t\t\tif ( object.hasEventListener( 'dispose', onInstancedMeshDispose ) === false ) {\n\n\t\t\t\tobject.addEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\t\t}\n\n\t\t\tif ( updateMap.get( object ) !== frame ) {\n\n\t\t\t\tattributes.update( object.instanceMatrix, gl.ARRAY_BUFFER );\n\n\t\t\t\tif ( object.instanceColor !== null ) {\n\n\t\t\t\t\tattributes.update( object.instanceColor, gl.ARRAY_BUFFER );\n\n\t\t\t\t}\n\n\t\t\t\tupdateMap.set( object, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\tconst skeleton = object.skeleton;\n\n\t\t\tif ( updateMap.get( skeleton ) !== frame ) {\n\n\t\t\t\tskeleton.update();\n\n\t\t\t\tupdateMap.set( skeleton, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn buffergeometry;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tupdateMap = new WeakMap();\n\n\t}\n\n\tfunction onInstancedMeshDispose( event ) {\n\n\t\tconst instancedMesh = event.target;\n\n\t\tinstancedMesh.removeEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\tattributes.remove( instancedMesh.instanceMatrix );\n\n\t\tif ( instancedMesh.instanceColor !== null ) attributes.remove( instancedMesh.instanceColor );\n\n\t}\n\n\treturn {\n\n\t\tupdate: update,\n\t\tdispose: dispose\n\n\t};\n\n}\n\nclass DepthTexture extends Texture {\n\n\tconstructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {\n\n\t\tformat = format !== undefined ? format : DepthFormat;\n\n\t\tif ( format !== DepthFormat && format !== DepthStencilFormat ) {\n\n\t\t\tthrow new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );\n\n\t\t}\n\n\t\tif ( type === undefined && format === DepthFormat ) type = UnsignedIntType;\n\t\tif ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isDepthTexture = true;\n\n\t\tthis.image = { width: width, height: height };\n\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : NearestFilter;\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : NearestFilter;\n\n\t\tthis.flipY = false;\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.compareFunction = null;\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.compareFunction = source.compareFunction;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Uniforms of a program.\n * Those form a tree structure with a special top-level container for the root,\n * which you get by calling 'new WebGLUniforms( gl, program )'.\n *\n *\n * Properties of inner nodes including the top-level container:\n *\n * .seq - array of nested uniforms\n * .map - nested uniforms by name\n *\n *\n * Methods of all nodes except the top-level container:\n *\n * .setValue( gl, value, [textures] )\n *\n * \t\tuploads a uniform value(s)\n * \tthe 'textures' parameter is needed for sampler uniforms\n *\n *\n * Static methods of the top-level container (textures factorizations):\n *\n * .upload( gl, seq, values, textures )\n *\n * \t\tsets uniforms in 'seq' to 'values[id].value'\n *\n * .seqWithValue( seq, values ) : filteredSeq\n *\n * \t\tfilters 'seq' entries with corresponding entry in values\n *\n *\n * Methods of the top-level container (textures factorizations):\n *\n * .setValue( gl, name, value, textures )\n *\n * \t\tsets uniform with name 'name' to 'value'\n *\n * .setOptional( gl, obj, prop )\n *\n * \t\tlike .set for an optional property of the object\n *\n */\n\n\nconst emptyTexture = /*@__PURE__*/ new Texture();\n\nconst emptyShadowTexture = /*@__PURE__*/ new DepthTexture( 1, 1 );\nemptyShadowTexture.compareFunction = LessEqualCompare;\n\nconst emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();\nconst empty3dTexture = /*@__PURE__*/ new Data3DTexture();\nconst emptyCubeTexture = /*@__PURE__*/ new CubeTexture();\n\n// --- Utilities ---\n\n// Array Caches (provide typed arrays for temporary by size)\n\nconst arrayCacheF32 = [];\nconst arrayCacheI32 = [];\n\n// Float32Array caches used for uploading Matrix uniforms\n\nconst mat4array = new Float32Array( 16 );\nconst mat3array = new Float32Array( 9 );\nconst mat2array = new Float32Array( 4 );\n\n// Flattening for arrays of vectors and matrices\n\nfunction flatten( array, nBlocks, blockSize ) {\n\n\tconst firstElem = array[ 0 ];\n\n\tif ( firstElem <= 0 || firstElem > 0 ) return array;\n\t// unoptimized: ! isNaN( firstElem )\n\t// see http://jacksondunstan.com/articles/983\n\n\tconst n = nBlocks * blockSize;\n\tlet r = arrayCacheF32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Float32Array( n );\n\t\tarrayCacheF32[ n ] = r;\n\n\t}\n\n\tif ( nBlocks !== 0 ) {\n\n\t\tfirstElem.toArray( r, 0 );\n\n\t\tfor ( let i = 1, offset = 0; i !== nBlocks; ++ i ) {\n\n\t\t\toffset += blockSize;\n\t\t\tarray[ i ].toArray( r, offset );\n\n\t\t}\n\n\t}\n\n\treturn r;\n\n}\n\nfunction arraysEqual( a, b ) {\n\n\tif ( a.length !== b.length ) return false;\n\n\tfor ( let i = 0, l = a.length; i < l; i ++ ) {\n\n\t\tif ( a[ i ] !== b[ i ] ) return false;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction copyArray( a, b ) {\n\n\tfor ( let i = 0, l = b.length; i < l; i ++ ) {\n\n\t\ta[ i ] = b[ i ];\n\n\t}\n\n}\n\n// Texture unit allocation\n\nfunction allocTexUnits( textures, n ) {\n\n\tlet r = arrayCacheI32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Int32Array( n );\n\t\tarrayCacheI32[ n ] = r;\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\tr[ i ] = textures.allocateTextureUnit();\n\n\t}\n\n\treturn r;\n\n}\n\n// --- Setters ---\n\n// Note: Defining these methods externally, because they come in a bunch\n// and this way their names minify.\n\n// Single scalar\n\nfunction setValueV1f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1f( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single float vector (from flat array or THREE.VectorN)\n\nfunction setValueV2f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2f( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3f( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else if ( v.r !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.r || cache[ 1 ] !== v.g || cache[ 2 ] !== v.b ) {\n\n\t\t\tgl.uniform3f( this.addr, v.r, v.g, v.b );\n\n\t\t\tcache[ 0 ] = v.r;\n\t\t\tcache[ 1 ] = v.g;\n\t\t\tcache[ 2 ] = v.b;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4f( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single matrix (from flat array or THREE.MatrixN)\n\nfunction setValueM2( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix2fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat2array.set( elements );\n\n\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM3( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix3fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat3array.set( elements );\n\n\t\tgl.uniformMatrix3fv( this.addr, false, mat3array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM4( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix4fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat4array.set( elements );\n\n\t\tgl.uniformMatrix4fv( this.addr, false, mat4array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\n// Single integer / boolean\n\nfunction setValueV1i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1i( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single integer / boolean vector (from flat array or THREE.VectorN)\n\nfunction setValueV2i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2i( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3i( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4i( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single unsigned integer\n\nfunction setValueV1ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1ui( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single unsigned integer vector (from flat array or THREE.VectorN)\n\nfunction setValueV2ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2ui( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3ui( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4ui( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n\n// Single texture (2D / Cube)\n\nfunction setValueT1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\tconst emptyTexture2D = ( this.type === gl.SAMPLER_2D_SHADOW ) ? emptyShadowTexture : emptyTexture;\n\n\ttextures.setTexture2D( v || emptyTexture2D, unit );\n\n}\n\nfunction setValueT3D1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture3D( v || empty3dTexture, unit );\n\n}\n\nfunction setValueT6( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTextureCube( v || emptyCubeTexture, unit );\n\n}\n\nfunction setValueT2DArray1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture2DArray( v || emptyArrayTexture, unit );\n\n}\n\n// Helper to pick the right setter for the singular case\n\nfunction getSingularSetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1f; // FLOAT\n\t\tcase 0x8b50: return setValueV2f; // _VEC2\n\t\tcase 0x8b51: return setValueV3f; // _VEC3\n\t\tcase 0x8b52: return setValueV4f; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2; // _MAT2\n\t\tcase 0x8b5b: return setValueM3; // _MAT3\n\t\tcase 0x8b5c: return setValueM4; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2i; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3i; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4i; // _VEC4\n\n\t\tcase 0x1405: return setValueV1ui; // UINT\n\t\tcase 0x8dc6: return setValueV2ui; // _VEC2\n\t\tcase 0x8dc7: return setValueV3ui; // _VEC3\n\t\tcase 0x8dc8: return setValueV4ui; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3D1;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArray1;\n\n\t}\n\n}\n\n\n// Array of scalars\n\nfunction setValueV1fArray( gl, v ) {\n\n\tgl.uniform1fv( this.addr, v );\n\n}\n\n// Array of vectors (from flat array or array of THREE.VectorN)\n\nfunction setValueV2fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 2 );\n\n\tgl.uniform2fv( this.addr, data );\n\n}\n\nfunction setValueV3fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 3 );\n\n\tgl.uniform3fv( this.addr, data );\n\n}\n\nfunction setValueV4fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniform4fv( this.addr, data );\n\n}\n\n// Array of matrices (from flat array or array of THREE.MatrixN)\n\nfunction setValueM2Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniformMatrix2fv( this.addr, false, data );\n\n}\n\nfunction setValueM3Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 9 );\n\n\tgl.uniformMatrix3fv( this.addr, false, data );\n\n}\n\nfunction setValueM4Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 16 );\n\n\tgl.uniformMatrix4fv( this.addr, false, data );\n\n}\n\n// Array of integer / boolean\n\nfunction setValueV1iArray( gl, v ) {\n\n\tgl.uniform1iv( this.addr, v );\n\n}\n\n// Array of integer / boolean vectors (from flat array)\n\nfunction setValueV2iArray( gl, v ) {\n\n\tgl.uniform2iv( this.addr, v );\n\n}\n\nfunction setValueV3iArray( gl, v ) {\n\n\tgl.uniform3iv( this.addr, v );\n\n}\n\nfunction setValueV4iArray( gl, v ) {\n\n\tgl.uniform4iv( this.addr, v );\n\n}\n\n// Array of unsigned integer\n\nfunction setValueV1uiArray( gl, v ) {\n\n\tgl.uniform1uiv( this.addr, v );\n\n}\n\n// Array of unsigned integer vectors (from flat array)\n\nfunction setValueV2uiArray( gl, v ) {\n\n\tgl.uniform2uiv( this.addr, v );\n\n}\n\nfunction setValueV3uiArray( gl, v ) {\n\n\tgl.uniform3uiv( this.addr, v );\n\n}\n\nfunction setValueV4uiArray( gl, v ) {\n\n\tgl.uniform4uiv( this.addr, v );\n\n}\n\n\n// Array of textures (2D / 3D / Cube / 2DArray)\n\nfunction setValueT1Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2D( v[ i ] || emptyTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT3DArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture3D( v[ i ] || empty3dTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT6Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTextureCube( v[ i ] || emptyCubeTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT2DArrayArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2DArray( v[ i ] || emptyArrayTexture, units[ i ] );\n\n\t}\n\n}\n\n\n// Helper to pick the right setter for a pure (bottom-level) array\n\nfunction getPureArraySetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1fArray; // FLOAT\n\t\tcase 0x8b50: return setValueV2fArray; // _VEC2\n\t\tcase 0x8b51: return setValueV3fArray; // _VEC3\n\t\tcase 0x8b52: return setValueV4fArray; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2Array; // _MAT2\n\t\tcase 0x8b5b: return setValueM3Array; // _MAT3\n\t\tcase 0x8b5c: return setValueM4Array; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4\n\n\t\tcase 0x1405: return setValueV1uiArray; // UINT\n\t\tcase 0x8dc6: return setValueV2uiArray; // _VEC2\n\t\tcase 0x8dc7: return setValueV3uiArray; // _VEC3\n\t\tcase 0x8dc8: return setValueV4uiArray; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1Array;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3DArray;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6Array;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArrayArray;\n\n\t}\n\n}\n\n// --- Uniform Classes ---\n\nclass SingleUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.type = activeInfo.type;\n\t\tthis.setValue = getSingularSetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass PureArrayUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.type = activeInfo.type;\n\t\tthis.size = activeInfo.size;\n\t\tthis.setValue = getPureArraySetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass StructuredUniform {\n\n\tconstructor( id ) {\n\n\t\tthis.id = id;\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t}\n\n\tsetValue( gl, value, textures ) {\n\n\t\tconst seq = this.seq;\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tu.setValue( gl, value[ u.id ], textures );\n\n\t\t}\n\n\t}\n\n}\n\n// --- Top-level ---\n\n// Parser - builds up the property tree from the path strings\n\nconst RePathPart = /(\\w+)(\\])?(\\[|\\.)?/g;\n\n// extracts\n// \t- the identifier (member name or array index)\n// - followed by an optional right bracket (found when array index)\n// - followed by an optional left bracket or dot (type of subscript)\n//\n// Note: These portions can be read in a non-overlapping fashion and\n// allow straightforward parsing of the hierarchy that WebGL encodes\n// in the uniform names.\n\nfunction addUniform( container, uniformObject ) {\n\n\tcontainer.seq.push( uniformObject );\n\tcontainer.map[ uniformObject.id ] = uniformObject;\n\n}\n\nfunction parseUniform( activeInfo, addr, container ) {\n\n\tconst path = activeInfo.name,\n\t\tpathLength = path.length;\n\n\t// reset RegExp object, because of the early exit of a previous run\n\tRePathPart.lastIndex = 0;\n\n\twhile ( true ) {\n\n\t\tconst match = RePathPart.exec( path ),\n\t\t\tmatchEnd = RePathPart.lastIndex;\n\n\t\tlet id = match[ 1 ];\n\t\tconst idIsIndex = match[ 2 ] === ']',\n\t\t\tsubscript = match[ 3 ];\n\n\t\tif ( idIsIndex ) id = id | 0; // convert to integer\n\n\t\tif ( subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength ) {\n\n\t\t\t// bare name or \"pure\" bottom-level array \"[0]\" suffix\n\n\t\t\taddUniform( container, subscript === undefined ?\n\t\t\t\tnew SingleUniform( id, activeInfo, addr ) :\n\t\t\t\tnew PureArrayUniform( id, activeInfo, addr ) );\n\n\t\t\tbreak;\n\n\t\t} else {\n\n\t\t\t// step into inner node / create it in case it doesn't exist\n\n\t\t\tconst map = container.map;\n\t\t\tlet next = map[ id ];\n\n\t\t\tif ( next === undefined ) {\n\n\t\t\t\tnext = new StructuredUniform( id );\n\t\t\t\taddUniform( container, next );\n\n\t\t\t}\n\n\t\t\tcontainer = next;\n\n\t\t}\n\n\t}\n\n}\n\n// Root Container\n\nclass WebGLUniforms {\n\n\tconstructor( gl, program ) {\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t\tconst n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS );\n\n\t\tfor ( let i = 0; i < n; ++ i ) {\n\n\t\t\tconst info = gl.getActiveUniform( program, i ),\n\t\t\t\taddr = gl.getUniformLocation( program, info.name );\n\n\t\t\tparseUniform( info, addr, this );\n\n\t\t}\n\n\t}\n\n\tsetValue( gl, name, value, textures ) {\n\n\t\tconst u = this.map[ name ];\n\n\t\tif ( u !== undefined ) u.setValue( gl, value, textures );\n\n\t}\n\n\tsetOptional( gl, object, name ) {\n\n\t\tconst v = object[ name ];\n\n\t\tif ( v !== undefined ) this.setValue( gl, name, v );\n\n\t}\n\n\tstatic upload( gl, seq, values, textures ) {\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ],\n\t\t\t\tv = values[ u.id ];\n\n\t\t\tif ( v.needsUpdate !== false ) {\n\n\t\t\t\t// note: always updating when .needsUpdate is undefined\n\t\t\t\tu.setValue( gl, v.value, textures );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tstatic seqWithValue( seq, values ) {\n\n\t\tconst r = [];\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tif ( u.id in values ) r.push( u );\n\n\t\t}\n\n\t\treturn r;\n\n\t}\n\n}\n\nfunction WebGLShader( gl, type, string ) {\n\n\tconst shader = gl.createShader( type );\n\n\tgl.shaderSource( shader, string );\n\tgl.compileShader( shader );\n\n\treturn shader;\n\n}\n\n// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/\nconst COMPLETION_STATUS_KHR = 0x91B1;\n\nlet programIdCount = 0;\n\nfunction handleSource( string, errorLine ) {\n\n\tconst lines = string.split( '\\n' );\n\tconst lines2 = [];\n\n\tconst from = Math.max( errorLine - 6, 0 );\n\tconst to = Math.min( errorLine + 6, lines.length );\n\n\tfor ( let i = from; i < to; i ++ ) {\n\n\t\tconst line = i + 1;\n\t\tlines2.push( `${line === errorLine ? '>' : ' '} ${line}: ${lines[ i ]}` );\n\n\t}\n\n\treturn lines2.join( '\\n' );\n\n}\n\nfunction getEncodingComponents( colorSpace ) {\n\n\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\tconst encodingPrimaries = ColorManagement.getPrimaries( colorSpace );\n\n\tlet gamutMapping;\n\n\tif ( workingPrimaries === encodingPrimaries ) {\n\n\t\tgamutMapping = '';\n\n\t} else if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) {\n\n\t\tgamutMapping = 'LinearDisplayP3ToLinearSRGB';\n\n\t} else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) {\n\n\t\tgamutMapping = 'LinearSRGBToLinearDisplayP3';\n\n\t}\n\n\tswitch ( colorSpace ) {\n\n\t\tcase LinearSRGBColorSpace:\n\t\tcase LinearDisplayP3ColorSpace:\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\n\n\t\tcase SRGBColorSpace:\n\t\tcase DisplayP3ColorSpace:\n\t\t\treturn [ gamutMapping, 'sRGBTransferOETF' ];\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\n\n\t}\n\n}\n\nfunction getShaderErrors( gl, shader, type ) {\n\n\tconst status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );\n\tconst errors = gl.getShaderInfoLog( shader ).trim();\n\n\tif ( status && errors === '' ) return '';\n\n\tconst errorMatches = /ERROR: 0:(\\d+)/.exec( errors );\n\tif ( errorMatches ) {\n\n\t\t// --enable-privileged-webgl-extension\n\t\t// console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\n\n\t\tconst errorLine = parseInt( errorMatches[ 1 ] );\n\t\treturn type.toUpperCase() + '\\n\\n' + errors + '\\n\\n' + handleSource( gl.getShaderSource( shader ), errorLine );\n\n\t} else {\n\n\t\treturn errors;\n\n\t}\n\n}\n\nfunction getTexelEncodingFunction( functionName, colorSpace ) {\n\n\tconst components = getEncodingComponents( colorSpace );\n\treturn `vec4 ${functionName}( vec4 value ) { return ${components[ 0 ]}( ${components[ 1 ]}( value ) ); }`;\n\n}\n\nfunction getToneMappingFunction( functionName, toneMapping ) {\n\n\tlet toneMappingName;\n\n\tswitch ( toneMapping ) {\n\n\t\tcase LinearToneMapping:\n\t\t\ttoneMappingName = 'Linear';\n\t\t\tbreak;\n\n\t\tcase ReinhardToneMapping:\n\t\t\ttoneMappingName = 'Reinhard';\n\t\t\tbreak;\n\n\t\tcase CineonToneMapping:\n\t\t\ttoneMappingName = 'OptimizedCineon';\n\t\t\tbreak;\n\n\t\tcase ACESFilmicToneMapping:\n\t\t\ttoneMappingName = 'ACESFilmic';\n\t\t\tbreak;\n\n\t\tcase AgXToneMapping:\n\t\t\ttoneMappingName = 'AgX';\n\t\t\tbreak;\n\n\t\tcase NeutralToneMapping:\n\t\t\ttoneMappingName = 'Neutral';\n\t\t\tbreak;\n\n\t\tcase CustomToneMapping:\n\t\t\ttoneMappingName = 'Custom';\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported toneMapping:', toneMapping );\n\t\t\ttoneMappingName = 'Linear';\n\n\t}\n\n\treturn 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';\n\n}\n\nfunction generateVertexExtensions( parameters ) {\n\n\tconst chunks = [\n\t\tparameters.extensionClipCullDistance ? '#extension GL_ANGLE_clip_cull_distance : require' : '',\n\t\tparameters.extensionMultiDraw ? '#extension GL_ANGLE_multi_draw : require' : '',\n\t];\n\n\treturn chunks.filter( filterEmptyLine ).join( '\\n' );\n\n}\n\nfunction generateDefines( defines ) {\n\n\tconst chunks = [];\n\n\tfor ( const name in defines ) {\n\n\t\tconst value = defines[ name ];\n\n\t\tif ( value === false ) continue;\n\n\t\tchunks.push( '#define ' + name + ' ' + value );\n\n\t}\n\n\treturn chunks.join( '\\n' );\n\n}\n\nfunction fetchAttributeLocations( gl, program ) {\n\n\tconst attributes = {};\n\n\tconst n = gl.getProgramParameter( program, gl.ACTIVE_ATTRIBUTES );\n\n\tfor ( let i = 0; i < n; i ++ ) {\n\n\t\tconst info = gl.getActiveAttrib( program, i );\n\t\tconst name = info.name;\n\n\t\tlet locationSize = 1;\n\t\tif ( info.type === gl.FLOAT_MAT2 ) locationSize = 2;\n\t\tif ( info.type === gl.FLOAT_MAT3 ) locationSize = 3;\n\t\tif ( info.type === gl.FLOAT_MAT4 ) locationSize = 4;\n\n\t\t// console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\n\n\t\tattributes[ name ] = {\n\t\t\ttype: info.type,\n\t\t\tlocation: gl.getAttribLocation( program, name ),\n\t\t\tlocationSize: locationSize\n\t\t};\n\n\t}\n\n\treturn attributes;\n\n}\n\nfunction filterEmptyLine( string ) {\n\n\treturn string !== '';\n\n}\n\nfunction replaceLightNums( string, parameters ) {\n\n\tconst numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;\n\n\treturn string\n\t\t.replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights )\n\t\t.replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights )\n\t\t.replace( /NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords )\n\t\t.replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights )\n\t\t.replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights )\n\t\t.replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights )\n\t\t.replace( /NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows )\n\t\t.replace( /NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows );\n\n}\n\nfunction replaceClippingPlaneNums( string, parameters ) {\n\n\treturn string\n\t\t.replace( /NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes )\n\t\t.replace( /UNION_CLIPPING_PLANES/g, ( parameters.numClippingPlanes - parameters.numClipIntersection ) );\n\n}\n\n// Resolve Includes\n\nconst includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\n\nfunction resolveIncludes( string ) {\n\n\treturn string.replace( includePattern, includeReplacer );\n\n}\n\nconst shaderChunkMap = new Map( [\n\t[ 'encodings_fragment', 'colorspace_fragment' ], // @deprecated, r154\n\t[ 'encodings_pars_fragment', 'colorspace_pars_fragment' ], // @deprecated, r154\n\t[ 'output_fragment', 'opaque_fragment' ], // @deprecated, r154\n] );\n\nfunction includeReplacer( match, include ) {\n\n\tlet string = ShaderChunk[ include ];\n\n\tif ( string === undefined ) {\n\n\t\tconst newInclude = shaderChunkMap.get( include );\n\n\t\tif ( newInclude !== undefined ) {\n\n\t\t\tstring = ShaderChunk[ newInclude ];\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Shader chunk \"%s\" has been deprecated. Use \"%s\" instead.', include, newInclude );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Can not resolve #include <' + include + '>' );\n\n\t\t}\n\n\t}\n\n\treturn resolveIncludes( string );\n\n}\n\n// Unroll Loops\n\nconst unrollLoopPattern = /#pragma unroll_loop_start\\s+for\\s*\\(\\s*int\\s+i\\s*=\\s*(\\d+)\\s*;\\s*i\\s*<\\s*(\\d+)\\s*;\\s*i\\s*\\+\\+\\s*\\)\\s*{([\\s\\S]+?)}\\s+#pragma unroll_loop_end/g;\n\nfunction unrollLoops( string ) {\n\n\treturn string.replace( unrollLoopPattern, loopReplacer );\n\n}\n\nfunction loopReplacer( match, start, end, snippet ) {\n\n\tlet string = '';\n\n\tfor ( let i = parseInt( start ); i < parseInt( end ); i ++ ) {\n\n\t\tstring += snippet\n\t\t\t.replace( /\\[\\s*i\\s*\\]/g, '[ ' + i + ' ]' )\n\t\t\t.replace( /UNROLLED_LOOP_INDEX/g, i );\n\n\t}\n\n\treturn string;\n\n}\n\n//\n\nfunction generatePrecision( parameters ) {\n\n\tlet precisionstring = `precision ${parameters.precision} float;\n\tprecision ${parameters.precision} int;\n\tprecision ${parameters.precision} sampler2D;\n\tprecision ${parameters.precision} samplerCube;\n\tprecision ${parameters.precision} sampler3D;\n\tprecision ${parameters.precision} sampler2DArray;\n\tprecision ${parameters.precision} sampler2DShadow;\n\tprecision ${parameters.precision} samplerCubeShadow;\n\tprecision ${parameters.precision} sampler2DArrayShadow;\n\tprecision ${parameters.precision} isampler2D;\n\tprecision ${parameters.precision} isampler3D;\n\tprecision ${parameters.precision} isamplerCube;\n\tprecision ${parameters.precision} isampler2DArray;\n\tprecision ${parameters.precision} usampler2D;\n\tprecision ${parameters.precision} usampler3D;\n\tprecision ${parameters.precision} usamplerCube;\n\tprecision ${parameters.precision} usampler2DArray;\n\t`;\n\n\tif ( parameters.precision === 'highp' ) {\n\n\t\tprecisionstring += '\\n#define HIGH_PRECISION';\n\n\t} else if ( parameters.precision === 'mediump' ) {\n\n\t\tprecisionstring += '\\n#define MEDIUM_PRECISION';\n\n\t} else if ( parameters.precision === 'lowp' ) {\n\n\t\tprecisionstring += '\\n#define LOW_PRECISION';\n\n\t}\n\n\treturn precisionstring;\n\n}\n\nfunction generateShadowMapTypeDefine( parameters ) {\n\n\tlet shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';\n\n\tif ( parameters.shadowMapType === PCFShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';\n\n\t} else if ( parameters.shadowMapType === PCFSoftShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';\n\n\t} else if ( parameters.shadowMapType === VSMShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';\n\n\t}\n\n\treturn shadowMapTypeDefine;\n\n}\n\nfunction generateEnvMapTypeDefine( parameters ) {\n\n\tlet envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeReflectionMapping:\n\t\t\tcase CubeRefractionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\t\t\t\tbreak;\n\n\t\t\tcase CubeUVReflectionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapTypeDefine;\n\n}\n\nfunction generateEnvMapModeDefine( parameters ) {\n\n\tlet envMapModeDefine = 'ENVMAP_MODE_REFLECTION';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeRefractionMapping:\n\n\t\t\t\tenvMapModeDefine = 'ENVMAP_MODE_REFRACTION';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapModeDefine;\n\n}\n\nfunction generateEnvMapBlendingDefine( parameters ) {\n\n\tlet envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.combine ) {\n\n\t\t\tcase MultiplyOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\n\t\t\t\tbreak;\n\n\t\t\tcase MixOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MIX';\n\t\t\t\tbreak;\n\n\t\t\tcase AddOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_ADD';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapBlendingDefine;\n\n}\n\nfunction generateCubeUVSize( parameters ) {\n\n\tconst imageHeight = parameters.envMapCubeUVHeight;\n\n\tif ( imageHeight === null ) return null;\n\n\tconst maxMip = Math.log2( imageHeight ) - 2;\n\n\tconst texelHeight = 1.0 / imageHeight;\n\n\tconst texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 * 16 ) );\n\n\treturn { texelWidth, texelHeight, maxMip };\n\n}\n\nfunction WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {\n\n\t// TODO Send this event to Three.js DevTools\n\t// console.log( 'WebGLProgram', cacheKey );\n\n\tconst gl = renderer.getContext();\n\n\tconst defines = parameters.defines;\n\n\tlet vertexShader = parameters.vertexShader;\n\tlet fragmentShader = parameters.fragmentShader;\n\n\tconst shadowMapTypeDefine = generateShadowMapTypeDefine( parameters );\n\tconst envMapTypeDefine = generateEnvMapTypeDefine( parameters );\n\tconst envMapModeDefine = generateEnvMapModeDefine( parameters );\n\tconst envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );\n\tconst envMapCubeUVSize = generateCubeUVSize( parameters );\n\n\tconst customVertexExtensions = generateVertexExtensions( parameters );\n\n\tconst customDefines = generateDefines( defines );\n\n\tconst program = gl.createProgram();\n\n\tlet prefixVertex, prefixFragment;\n\tlet versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\\n' : '';\n\n\tif ( parameters.isRawShaderMaterial ) {\n\n\t\tprefixVertex = [\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixVertex.length > 0 ) {\n\n\t\t\tprefixVertex += '\\n';\n\n\t\t}\n\n\t\tprefixFragment = [\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixFragment.length > 0 ) {\n\n\t\t\tprefixFragment += '\\n';\n\n\t\t}\n\n\t} else {\n\n\t\tprefixVertex = [\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',\n\t\t\tparameters.batching ? '#define USE_BATCHING' : '',\n\t\t\tparameters.instancing ? '#define USE_INSTANCING' : '',\n\t\t\tparameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',\n\t\t\tparameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\t//\n\n\t\t\tparameters.mapUv ? '#define MAP_UV ' + parameters.mapUv : '',\n\t\t\tparameters.alphaMapUv ? '#define ALPHAMAP_UV ' + parameters.alphaMapUv : '',\n\t\t\tparameters.lightMapUv ? '#define LIGHTMAP_UV ' + parameters.lightMapUv : '',\n\t\t\tparameters.aoMapUv ? '#define AOMAP_UV ' + parameters.aoMapUv : '',\n\t\t\tparameters.emissiveMapUv ? '#define EMISSIVEMAP_UV ' + parameters.emissiveMapUv : '',\n\t\t\tparameters.bumpMapUv ? '#define BUMPMAP_UV ' + parameters.bumpMapUv : '',\n\t\t\tparameters.normalMapUv ? '#define NORMALMAP_UV ' + parameters.normalMapUv : '',\n\t\t\tparameters.displacementMapUv ? '#define DISPLACEMENTMAP_UV ' + parameters.displacementMapUv : '',\n\n\t\t\tparameters.metalnessMapUv ? '#define METALNESSMAP_UV ' + parameters.metalnessMapUv : '',\n\t\t\tparameters.roughnessMapUv ? '#define ROUGHNESSMAP_UV ' + parameters.roughnessMapUv : '',\n\n\t\t\tparameters.anisotropyMapUv ? '#define ANISOTROPYMAP_UV ' + parameters.anisotropyMapUv : '',\n\n\t\t\tparameters.clearcoatMapUv ? '#define CLEARCOATMAP_UV ' + parameters.clearcoatMapUv : '',\n\t\t\tparameters.clearcoatNormalMapUv ? '#define CLEARCOAT_NORMALMAP_UV ' + parameters.clearcoatNormalMapUv : '',\n\t\t\tparameters.clearcoatRoughnessMapUv ? '#define CLEARCOAT_ROUGHNESSMAP_UV ' + parameters.clearcoatRoughnessMapUv : '',\n\n\t\t\tparameters.iridescenceMapUv ? '#define IRIDESCENCEMAP_UV ' + parameters.iridescenceMapUv : '',\n\t\t\tparameters.iridescenceThicknessMapUv ? '#define IRIDESCENCE_THICKNESSMAP_UV ' + parameters.iridescenceThicknessMapUv : '',\n\n\t\t\tparameters.sheenColorMapUv ? '#define SHEEN_COLORMAP_UV ' + parameters.sheenColorMapUv : '',\n\t\t\tparameters.sheenRoughnessMapUv ? '#define SHEEN_ROUGHNESSMAP_UV ' + parameters.sheenRoughnessMapUv : '',\n\n\t\t\tparameters.specularMapUv ? '#define SPECULARMAP_UV ' + parameters.specularMapUv : '',\n\t\t\tparameters.specularColorMapUv ? '#define SPECULAR_COLORMAP_UV ' + parameters.specularColorMapUv : '',\n\t\t\tparameters.specularIntensityMapUv ? '#define SPECULAR_INTENSITYMAP_UV ' + parameters.specularIntensityMapUv : '',\n\n\t\t\tparameters.transmissionMapUv ? '#define TRANSMISSIONMAP_UV ' + parameters.transmissionMapUv : '',\n\t\t\tparameters.thicknessMapUv ? '#define THICKNESSMAP_UV ' + parameters.thicknessMapUv : '',\n\n\t\t\t//\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.skinning ? '#define USE_SKINNING' : '',\n\n\t\t\tparameters.morphTargets ? '#define USE_MORPHTARGETS' : '',\n\t\t\tparameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',\n\t\t\t( parameters.morphColors ) ? '#define USE_MORPHCOLORS' : '',\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE' : '',\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',\n\t\t\t( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',\n\n\t\t\tparameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\n\t\t\t'uniform mat4 modelMatrix;',\n\t\t\t'uniform mat4 modelViewMatrix;',\n\t\t\t'uniform mat4 projectionMatrix;',\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform mat3 normalMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t'#ifdef USE_INSTANCING',\n\n\t\t\t'\tattribute mat4 instanceMatrix;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_INSTANCING_COLOR',\n\n\t\t\t'\tattribute vec3 instanceColor;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_INSTANCING_MORPH',\n\n\t\t\t'\tuniform sampler2D morphTexture;',\n\n\t\t\t'#endif',\n\n\t\t\t'attribute vec3 position;',\n\t\t\t'attribute vec3 normal;',\n\t\t\t'attribute vec2 uv;',\n\n\t\t\t'#ifdef USE_UV1',\n\n\t\t\t'\tattribute vec2 uv1;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV2',\n\n\t\t\t'\tattribute vec2 uv2;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV3',\n\n\t\t\t'\tattribute vec2 uv3;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_TANGENT',\n\n\t\t\t'\tattribute vec4 tangent;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if defined( USE_COLOR_ALPHA )',\n\n\t\t\t'\tattribute vec4 color;',\n\n\t\t\t'#elif defined( USE_COLOR )',\n\n\t\t\t'\tattribute vec3 color;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )',\n\n\t\t\t'\tattribute vec3 morphTarget0;',\n\t\t\t'\tattribute vec3 morphTarget1;',\n\t\t\t'\tattribute vec3 morphTarget2;',\n\t\t\t'\tattribute vec3 morphTarget3;',\n\n\t\t\t'\t#ifdef USE_MORPHNORMALS',\n\n\t\t\t'\t\tattribute vec3 morphNormal0;',\n\t\t\t'\t\tattribute vec3 morphNormal1;',\n\t\t\t'\t\tattribute vec3 morphNormal2;',\n\t\t\t'\t\tattribute vec3 morphNormal3;',\n\n\t\t\t'\t#else',\n\n\t\t\t'\t\tattribute vec3 morphTarget4;',\n\t\t\t'\t\tattribute vec3 morphTarget5;',\n\t\t\t'\t\tattribute vec3 morphTarget6;',\n\t\t\t'\t\tattribute vec3 morphTarget7;',\n\n\t\t\t'\t#endif',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_SKINNING',\n\n\t\t\t'\tattribute vec4 skinIndex;',\n\t\t\t'\tattribute vec4 skinWeight;',\n\n\t\t\t'#endif',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tprefixFragment = [\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.alphaToCoverage ? '#define ALPHA_TO_COVERAGE' : '',\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.matcap ? '#define USE_MATCAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapTypeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapBlendingDefine : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_WIDTH ' + envMapCubeUVSize.texelWidth : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_HEIGHT ' + envMapCubeUVSize.texelHeight : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_MAX_MIP ' + envMapCubeUVSize.maxMip + '.0' : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoat ? '#define USE_CLEARCOAT' : '',\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.iridescence ? '#define USE_IRIDESCENCE' : '',\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaTest ? '#define USE_ALPHATEST' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.sheen ? '#define USE_SHEEN' : '',\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.gradientMap ? '#define USE_GRADIENTMAP' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',\n\n\t\t\tparameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',\n\n\t\t\tparameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? '#define TONE_MAPPING' : '',\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',\n\n\t\t\tparameters.dithering ? '#define DITHERING' : '',\n\t\t\tparameters.opaque ? '#define OPAQUE' : '',\n\n\t\t\tShaderChunk[ 'colorspace_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below\n\t\t\tgetTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),\n\n\t\t\tparameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t}\n\n\tvertexShader = resolveIncludes( vertexShader );\n\tvertexShader = replaceLightNums( vertexShader, parameters );\n\tvertexShader = replaceClippingPlaneNums( vertexShader, parameters );\n\n\tfragmentShader = resolveIncludes( fragmentShader );\n\tfragmentShader = replaceLightNums( fragmentShader, parameters );\n\tfragmentShader = replaceClippingPlaneNums( fragmentShader, parameters );\n\n\tvertexShader = unrollLoops( vertexShader );\n\tfragmentShader = unrollLoops( fragmentShader );\n\n\tif ( parameters.isRawShaderMaterial !== true ) {\n\n\t\t// GLSL 3.0 conversion for built-in materials and ShaderMaterial\n\n\t\tversionString = '#version 300 es\\n';\n\n\t\tprefixVertex = [\n\t\t\tcustomVertexExtensions,\n\t\t\t'#define attribute in',\n\t\t\t'#define varying out',\n\t\t\t'#define texture2D texture'\n\t\t].join( '\\n' ) + '\\n' + prefixVertex;\n\n\t\tprefixFragment = [\n\t\t\t'#define varying in',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',\n\t\t\t'#define gl_FragDepthEXT gl_FragDepth',\n\t\t\t'#define texture2D texture',\n\t\t\t'#define textureCube texture',\n\t\t\t'#define texture2DProj textureProj',\n\t\t\t'#define texture2DLodEXT textureLod',\n\t\t\t'#define texture2DProjLodEXT textureProjLod',\n\t\t\t'#define textureCubeLodEXT textureLod',\n\t\t\t'#define texture2DGradEXT textureGrad',\n\t\t\t'#define texture2DProjGradEXT textureProjGrad',\n\t\t\t'#define textureCubeGradEXT textureGrad'\n\t\t].join( '\\n' ) + '\\n' + prefixFragment;\n\n\t}\n\n\tconst vertexGlsl = versionString + prefixVertex + vertexShader;\n\tconst fragmentGlsl = versionString + prefixFragment + fragmentShader;\n\n\t// console.log( '*VERTEX*', vertexGlsl );\n\t// console.log( '*FRAGMENT*', fragmentGlsl );\n\n\tconst glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );\n\tconst glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );\n\n\tgl.attachShader( program, glVertexShader );\n\tgl.attachShader( program, glFragmentShader );\n\n\t// Force a particular attribute to index 0.\n\n\tif ( parameters.index0AttributeName !== undefined ) {\n\n\t\tgl.bindAttribLocation( program, 0, parameters.index0AttributeName );\n\n\t} else if ( parameters.morphTargets === true ) {\n\n\t\t// programs with morphTargets displace position out of attribute 0\n\t\tgl.bindAttribLocation( program, 0, 'position' );\n\n\t}\n\n\tgl.linkProgram( program );\n\n\tfunction onFirstUse( self ) {\n\n\t\t// check for link errors\n\t\tif ( renderer.debug.checkShaderErrors ) {\n\n\t\t\tconst programLog = gl.getProgramInfoLog( program ).trim();\n\t\t\tconst vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();\n\t\t\tconst fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();\n\n\t\t\tlet runnable = true;\n\t\t\tlet haveDiagnostics = true;\n\n\t\t\tif ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {\n\n\t\t\t\trunnable = false;\n\n\t\t\t\tif ( typeof renderer.debug.onShaderError === 'function' ) {\n\n\t\t\t\t\trenderer.debug.onShaderError( gl, program, glVertexShader, glFragmentShader );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// default error reporting\n\n\t\t\t\t\tconst vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );\n\t\t\t\t\tconst fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );\n\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +\n\t\t\t\t\t\t'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\\n\\n' +\n\t\t\t\t\t\t'Material Name: ' + self.name + '\\n' +\n\t\t\t\t\t\t'Material Type: ' + self.type + '\\n\\n' +\n\t\t\t\t\t\t'Program Info Log: ' + programLog + '\\n' +\n\t\t\t\t\t\tvertexErrors + '\\n' +\n\t\t\t\t\t\tfragmentErrors\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t} else if ( programLog !== '' ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );\n\n\t\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\n\n\t\t\t\thaveDiagnostics = false;\n\n\t\t\t}\n\n\t\t\tif ( haveDiagnostics ) {\n\n\t\t\t\tself.diagnostics = {\n\n\t\t\t\t\trunnable: runnable,\n\n\t\t\t\t\tprogramLog: programLog,\n\n\t\t\t\t\tvertexShader: {\n\n\t\t\t\t\t\tlog: vertexLog,\n\t\t\t\t\t\tprefix: prefixVertex\n\n\t\t\t\t\t},\n\n\t\t\t\t\tfragmentShader: {\n\n\t\t\t\t\t\tlog: fragmentLog,\n\t\t\t\t\t\tprefix: prefixFragment\n\n\t\t\t\t\t}\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Clean up\n\n\t\t// Crashes in iOS9 and iOS10. #18402\n\t\t// gl.detachShader( program, glVertexShader );\n\t\t// gl.detachShader( program, glFragmentShader );\n\n\t\tgl.deleteShader( glVertexShader );\n\t\tgl.deleteShader( glFragmentShader );\n\n\t\tcachedUniforms = new WebGLUniforms( gl, program );\n\t\tcachedAttributes = fetchAttributeLocations( gl, program );\n\n\t}\n\n\t// set up caching for uniform locations\n\n\tlet cachedUniforms;\n\n\tthis.getUniforms = function () {\n\n\t\tif ( cachedUniforms === undefined ) {\n\n\t\t\t// Populates cachedUniforms and cachedAttributes\n\t\t\tonFirstUse( this );\n\n\t\t}\n\n\t\treturn cachedUniforms;\n\n\t};\n\n\t// set up caching for attribute locations\n\n\tlet cachedAttributes;\n\n\tthis.getAttributes = function () {\n\n\t\tif ( cachedAttributes === undefined ) {\n\n\t\t\t// Populates cachedAttributes and cachedUniforms\n\t\t\tonFirstUse( this );\n\n\t\t}\n\n\t\treturn cachedAttributes;\n\n\t};\n\n\t// indicate when the program is ready to be used. if the KHR_parallel_shader_compile extension isn't supported,\n\t// flag the program as ready immediately. It may cause a stall when it's first used.\n\n\tlet programReady = ( parameters.rendererExtensionParallelShaderCompile === false );\n\n\tthis.isReady = function () {\n\n\t\tif ( programReady === false ) {\n\n\t\t\tprogramReady = gl.getProgramParameter( program, COMPLETION_STATUS_KHR );\n\n\t\t}\n\n\t\treturn programReady;\n\n\t};\n\n\t// free resource\n\n\tthis.destroy = function () {\n\n\t\tbindingStates.releaseStatesOfProgram( this );\n\n\t\tgl.deleteProgram( program );\n\t\tthis.program = undefined;\n\n\t};\n\n\t//\n\n\tthis.type = parameters.shaderType;\n\tthis.name = parameters.shaderName;\n\tthis.id = programIdCount ++;\n\tthis.cacheKey = cacheKey;\n\tthis.usedTimes = 1;\n\tthis.program = program;\n\tthis.vertexShader = glVertexShader;\n\tthis.fragmentShader = glFragmentShader;\n\n\treturn this;\n\n}\n\nlet _id$1 = 0;\n\nclass WebGLShaderCache {\n\n\tconstructor() {\n\n\t\tthis.shaderCache = new Map();\n\t\tthis.materialCache = new Map();\n\n\t}\n\n\tupdate( material ) {\n\n\t\tconst vertexShader = material.vertexShader;\n\t\tconst fragmentShader = material.fragmentShader;\n\n\t\tconst vertexShaderStage = this._getShaderStage( vertexShader );\n\t\tconst fragmentShaderStage = this._getShaderStage( fragmentShader );\n\n\t\tconst materialShaders = this._getShaderCacheForMaterial( material );\n\n\t\tif ( materialShaders.has( vertexShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( vertexShaderStage );\n\t\t\tvertexShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\tif ( materialShaders.has( fragmentShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( fragmentShaderStage );\n\t\t\tfragmentShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( material ) {\n\n\t\tconst materialShaders = this.materialCache.get( material );\n\n\t\tfor ( const shaderStage of materialShaders ) {\n\n\t\t\tshaderStage.usedTimes --;\n\n\t\t\tif ( shaderStage.usedTimes === 0 ) this.shaderCache.delete( shaderStage.code );\n\n\t\t}\n\n\t\tthis.materialCache.delete( material );\n\n\t\treturn this;\n\n\t}\n\n\tgetVertexShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.vertexShader ).id;\n\n\t}\n\n\tgetFragmentShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.fragmentShader ).id;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shaderCache.clear();\n\t\tthis.materialCache.clear();\n\n\t}\n\n\t_getShaderCacheForMaterial( material ) {\n\n\t\tconst cache = this.materialCache;\n\t\tlet set = cache.get( material );\n\n\t\tif ( set === undefined ) {\n\n\t\t\tset = new Set();\n\t\t\tcache.set( material, set );\n\n\t\t}\n\n\t\treturn set;\n\n\t}\n\n\t_getShaderStage( code ) {\n\n\t\tconst cache = this.shaderCache;\n\t\tlet stage = cache.get( code );\n\n\t\tif ( stage === undefined ) {\n\n\t\t\tstage = new WebGLShaderStage( code );\n\t\t\tcache.set( code, stage );\n\n\t\t}\n\n\t\treturn stage;\n\n\t}\n\n}\n\nclass WebGLShaderStage {\n\n\tconstructor( code ) {\n\n\t\tthis.id = _id$1 ++;\n\n\t\tthis.code = code;\n\t\tthis.usedTimes = 0;\n\n\t}\n\n}\n\nfunction WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping ) {\n\n\tconst _programLayers = new Layers();\n\tconst _customShaders = new WebGLShaderCache();\n\tconst _activeChannels = new Set();\n\tconst programs = [];\n\n\tconst logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\n\tconst SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;\n\n\tlet precision = capabilities.precision;\n\n\tconst shaderIDs = {\n\t\tMeshDepthMaterial: 'depth',\n\t\tMeshDistanceMaterial: 'distanceRGBA',\n\t\tMeshNormalMaterial: 'normal',\n\t\tMeshBasicMaterial: 'basic',\n\t\tMeshLambertMaterial: 'lambert',\n\t\tMeshPhongMaterial: 'phong',\n\t\tMeshToonMaterial: 'toon',\n\t\tMeshStandardMaterial: 'physical',\n\t\tMeshPhysicalMaterial: 'physical',\n\t\tMeshMatcapMaterial: 'matcap',\n\t\tLineBasicMaterial: 'basic',\n\t\tLineDashedMaterial: 'dashed',\n\t\tPointsMaterial: 'points',\n\t\tShadowMaterial: 'shadow',\n\t\tSpriteMaterial: 'sprite'\n\t};\n\n\tfunction getChannel( value ) {\n\n\t\t_activeChannels.add( value );\n\n\t\tif ( value === 0 ) return 'uv';\n\n\t\treturn `uv${ value }`;\n\n\t}\n\n\tfunction getParameters( material, lights, shadows, scene, object ) {\n\n\t\tconst fog = scene.fog;\n\t\tconst geometry = object.geometry;\n\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\n\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\tconst envMapCubeUVHeight = ( !! envMap ) && ( envMap.mapping === CubeUVReflectionMapping ) ? envMap.image.height : null;\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\n\t\t// heuristics to create shader parameters according to lights in the scene\n\t\t// (not to blow over maxLights budget)\n\n\t\tif ( material.precision !== null ) {\n\n\t\t\tprecision = capabilities.getMaxPrecision( material.precision );\n\n\t\t\tif ( precision !== material.precision ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\tlet morphTextureStride = 0;\n\n\t\tif ( geometry.morphAttributes.position !== undefined ) morphTextureStride = 1;\n\t\tif ( geometry.morphAttributes.normal !== undefined ) morphTextureStride = 2;\n\t\tif ( geometry.morphAttributes.color !== undefined ) morphTextureStride = 3;\n\n\t\t//\n\n\t\tlet vertexShader, fragmentShader;\n\t\tlet customVertexShaderID, customFragmentShaderID;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\n\t\t\tvertexShader = shader.vertexShader;\n\t\t\tfragmentShader = shader.fragmentShader;\n\n\t\t} else {\n\n\t\t\tvertexShader = material.vertexShader;\n\t\t\tfragmentShader = material.fragmentShader;\n\n\t\t\t_customShaders.update( material );\n\n\t\t\tcustomVertexShaderID = _customShaders.getVertexShaderID( material );\n\t\t\tcustomFragmentShaderID = _customShaders.getFragmentShaderID( material );\n\n\t\t}\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tconst IS_INSTANCEDMESH = object.isInstancedMesh === true;\n\t\tconst IS_BATCHEDMESH = object.isBatchedMesh === true;\n\n\t\tconst HAS_MAP = !! material.map;\n\t\tconst HAS_MATCAP = !! material.matcap;\n\t\tconst HAS_ENVMAP = !! envMap;\n\t\tconst HAS_AOMAP = !! material.aoMap;\n\t\tconst HAS_LIGHTMAP = !! material.lightMap;\n\t\tconst HAS_BUMPMAP = !! material.bumpMap;\n\t\tconst HAS_NORMALMAP = !! material.normalMap;\n\t\tconst HAS_DISPLACEMENTMAP = !! material.displacementMap;\n\t\tconst HAS_EMISSIVEMAP = !! material.emissiveMap;\n\n\t\tconst HAS_METALNESSMAP = !! material.metalnessMap;\n\t\tconst HAS_ROUGHNESSMAP = !! material.roughnessMap;\n\n\t\tconst HAS_ANISOTROPY = material.anisotropy > 0;\n\t\tconst HAS_CLEARCOAT = material.clearcoat > 0;\n\t\tconst HAS_IRIDESCENCE = material.iridescence > 0;\n\t\tconst HAS_SHEEN = material.sheen > 0;\n\t\tconst HAS_TRANSMISSION = material.transmission > 0;\n\n\t\tconst HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !! material.anisotropyMap;\n\n\t\tconst HAS_CLEARCOATMAP = HAS_CLEARCOAT && !! material.clearcoatMap;\n\t\tconst HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !! material.clearcoatNormalMap;\n\t\tconst HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !! material.clearcoatRoughnessMap;\n\n\t\tconst HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !! material.iridescenceMap;\n\t\tconst HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !! material.iridescenceThicknessMap;\n\n\t\tconst HAS_SHEEN_COLORMAP = HAS_SHEEN && !! material.sheenColorMap;\n\t\tconst HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !! material.sheenRoughnessMap;\n\n\t\tconst HAS_SPECULARMAP = !! material.specularMap;\n\t\tconst HAS_SPECULAR_COLORMAP = !! material.specularColorMap;\n\t\tconst HAS_SPECULAR_INTENSITYMAP = !! material.specularIntensityMap;\n\n\t\tconst HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !! material.transmissionMap;\n\t\tconst HAS_THICKNESSMAP = HAS_TRANSMISSION && !! material.thicknessMap;\n\n\t\tconst HAS_GRADIENTMAP = !! material.gradientMap;\n\n\t\tconst HAS_ALPHAMAP = !! material.alphaMap;\n\n\t\tconst HAS_ALPHATEST = material.alphaTest > 0;\n\n\t\tconst HAS_ALPHAHASH = !! material.alphaHash;\n\n\t\tconst HAS_EXTENSIONS = !! material.extensions;\n\n\t\tlet toneMapping = NoToneMapping;\n\n\t\tif ( material.toneMapped ) {\n\n\t\t\tif ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\ttoneMapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst parameters = {\n\n\t\t\tshaderID: shaderID,\n\t\t\tshaderType: material.type,\n\t\t\tshaderName: material.name,\n\n\t\t\tvertexShader: vertexShader,\n\t\t\tfragmentShader: fragmentShader,\n\t\t\tdefines: material.defines,\n\n\t\t\tcustomVertexShaderID: customVertexShaderID,\n\t\t\tcustomFragmentShaderID: customFragmentShaderID,\n\n\t\t\tisRawShaderMaterial: material.isRawShaderMaterial === true,\n\t\t\tglslVersion: material.glslVersion,\n\n\t\t\tprecision: precision,\n\n\t\t\tbatching: IS_BATCHEDMESH,\n\t\t\tinstancing: IS_INSTANCEDMESH,\n\t\t\tinstancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\n\t\t\tinstancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,\n\n\t\t\tsupportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,\n\t\t\toutputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),\n\t\t\talphaToCoverage: !! material.alphaToCoverage,\n\n\t\t\tmap: HAS_MAP,\n\t\t\tmatcap: HAS_MATCAP,\n\t\t\tenvMap: HAS_ENVMAP,\n\t\t\tenvMapMode: HAS_ENVMAP && envMap.mapping,\n\t\t\tenvMapCubeUVHeight: envMapCubeUVHeight,\n\t\t\taoMap: HAS_AOMAP,\n\t\t\tlightMap: HAS_LIGHTMAP,\n\t\t\tbumpMap: HAS_BUMPMAP,\n\t\t\tnormalMap: HAS_NORMALMAP,\n\t\t\tdisplacementMap: SUPPORTS_VERTEX_TEXTURES && HAS_DISPLACEMENTMAP,\n\t\t\temissiveMap: HAS_EMISSIVEMAP,\n\n\t\t\tnormalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,\n\t\t\tnormalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,\n\n\t\t\tmetalnessMap: HAS_METALNESSMAP,\n\t\t\troughnessMap: HAS_ROUGHNESSMAP,\n\n\t\t\tanisotropy: HAS_ANISOTROPY,\n\t\t\tanisotropyMap: HAS_ANISOTROPYMAP,\n\n\t\t\tclearcoat: HAS_CLEARCOAT,\n\t\t\tclearcoatMap: HAS_CLEARCOATMAP,\n\t\t\tclearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,\n\t\t\tclearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,\n\n\t\t\tiridescence: HAS_IRIDESCENCE,\n\t\t\tiridescenceMap: HAS_IRIDESCENCEMAP,\n\t\t\tiridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,\n\n\t\t\tsheen: HAS_SHEEN,\n\t\t\tsheenColorMap: HAS_SHEEN_COLORMAP,\n\t\t\tsheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP,\n\n\t\t\tspecularMap: HAS_SPECULARMAP,\n\t\t\tspecularColorMap: HAS_SPECULAR_COLORMAP,\n\t\t\tspecularIntensityMap: HAS_SPECULAR_INTENSITYMAP,\n\n\t\t\ttransmission: HAS_TRANSMISSION,\n\t\t\ttransmissionMap: HAS_TRANSMISSIONMAP,\n\t\t\tthicknessMap: HAS_THICKNESSMAP,\n\n\t\t\tgradientMap: HAS_GRADIENTMAP,\n\n\t\t\topaque: material.transparent === false && material.blending === NormalBlending && material.alphaToCoverage === false,\n\n\t\t\talphaMap: HAS_ALPHAMAP,\n\t\t\talphaTest: HAS_ALPHATEST,\n\t\t\talphaHash: HAS_ALPHAHASH,\n\n\t\t\tcombine: material.combine,\n\n\t\t\t//\n\n\t\t\tmapUv: HAS_MAP && getChannel( material.map.channel ),\n\t\t\taoMapUv: HAS_AOMAP && getChannel( material.aoMap.channel ),\n\t\t\tlightMapUv: HAS_LIGHTMAP && getChannel( material.lightMap.channel ),\n\t\t\tbumpMapUv: HAS_BUMPMAP && getChannel( material.bumpMap.channel ),\n\t\t\tnormalMapUv: HAS_NORMALMAP && getChannel( material.normalMap.channel ),\n\t\t\tdisplacementMapUv: HAS_DISPLACEMENTMAP && getChannel( material.displacementMap.channel ),\n\t\t\temissiveMapUv: HAS_EMISSIVEMAP && getChannel( material.emissiveMap.channel ),\n\n\t\t\tmetalnessMapUv: HAS_METALNESSMAP && getChannel( material.metalnessMap.channel ),\n\t\t\troughnessMapUv: HAS_ROUGHNESSMAP && getChannel( material.roughnessMap.channel ),\n\n\t\t\tanisotropyMapUv: HAS_ANISOTROPYMAP && getChannel( material.anisotropyMap.channel ),\n\n\t\t\tclearcoatMapUv: HAS_CLEARCOATMAP && getChannel( material.clearcoatMap.channel ),\n\t\t\tclearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel( material.clearcoatNormalMap.channel ),\n\t\t\tclearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel( material.clearcoatRoughnessMap.channel ),\n\n\t\t\tiridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel( material.iridescenceMap.channel ),\n\t\t\tiridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel( material.iridescenceThicknessMap.channel ),\n\n\t\t\tsheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel( material.sheenColorMap.channel ),\n\t\t\tsheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel( material.sheenRoughnessMap.channel ),\n\n\t\t\tspecularMapUv: HAS_SPECULARMAP && getChannel( material.specularMap.channel ),\n\t\t\tspecularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel( material.specularColorMap.channel ),\n\t\t\tspecularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel( material.specularIntensityMap.channel ),\n\n\t\t\ttransmissionMapUv: HAS_TRANSMISSIONMAP && getChannel( material.transmissionMap.channel ),\n\t\t\tthicknessMapUv: HAS_THICKNESSMAP && getChannel( material.thicknessMap.channel ),\n\n\t\t\talphaMapUv: HAS_ALPHAMAP && getChannel( material.alphaMap.channel ),\n\n\t\t\t//\n\n\t\t\tvertexTangents: !! geometry.attributes.tangent && ( HAS_NORMALMAP || HAS_ANISOTROPY ),\n\t\t\tvertexColors: material.vertexColors,\n\t\t\tvertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,\n\n\t\t\tpointsUvs: object.isPoints === true && !! geometry.attributes.uv && ( HAS_MAP || HAS_ALPHAMAP ),\n\n\t\t\tfog: !! fog,\n\t\t\tuseFog: material.fog === true,\n\t\t\tfogExp2: ( !! fog && fog.isFogExp2 ),\n\n\t\t\tflatShading: material.flatShading === true,\n\n\t\t\tsizeAttenuation: material.sizeAttenuation === true,\n\t\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\t\tskinning: object.isSkinnedMesh === true,\n\n\t\t\tmorphTargets: geometry.morphAttributes.position !== undefined,\n\t\t\tmorphNormals: geometry.morphAttributes.normal !== undefined,\n\t\t\tmorphColors: geometry.morphAttributes.color !== undefined,\n\t\t\tmorphTargetsCount: morphTargetsCount,\n\t\t\tmorphTextureStride: morphTextureStride,\n\n\t\t\tnumDirLights: lights.directional.length,\n\t\t\tnumPointLights: lights.point.length,\n\t\t\tnumSpotLights: lights.spot.length,\n\t\t\tnumSpotLightMaps: lights.spotLightMap.length,\n\t\t\tnumRectAreaLights: lights.rectArea.length,\n\t\t\tnumHemiLights: lights.hemi.length,\n\n\t\t\tnumDirLightShadows: lights.directionalShadowMap.length,\n\t\t\tnumPointLightShadows: lights.pointShadowMap.length,\n\t\t\tnumSpotLightShadows: lights.spotShadowMap.length,\n\t\t\tnumSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,\n\n\t\t\tnumLightProbes: lights.numLightProbes,\n\n\t\t\tnumClippingPlanes: clipping.numPlanes,\n\t\t\tnumClipIntersection: clipping.numIntersection,\n\n\t\t\tdithering: material.dithering,\n\n\t\t\tshadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\n\t\t\tshadowMapType: renderer.shadowMap.type,\n\n\t\t\ttoneMapping: toneMapping,\n\t\t\tuseLegacyLights: renderer._useLegacyLights,\n\n\t\t\tdecodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),\n\n\t\t\tpremultipliedAlpha: material.premultipliedAlpha,\n\n\t\t\tdoubleSided: material.side === DoubleSide,\n\t\t\tflipSided: material.side === BackSide,\n\n\t\t\tuseDepthPacking: material.depthPacking >= 0,\n\t\t\tdepthPacking: material.depthPacking || 0,\n\n\t\t\tindex0AttributeName: material.index0AttributeName,\n\n\t\t\textensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),\n\t\t\textensionMultiDraw: HAS_EXTENSIONS && material.extensions.multiDraw === true && extensions.has( 'WEBGL_multi_draw' ),\n\n\t\t\trendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),\n\n\t\t\tcustomProgramCacheKey: material.customProgramCacheKey()\n\n\t\t};\n\n\t\t// the usage of getChannel() determines the active texture channels for this shader\n\n\t\tparameters.vertexUv1s = _activeChannels.has( 1 );\n\t\tparameters.vertexUv2s = _activeChannels.has( 2 );\n\t\tparameters.vertexUv3s = _activeChannels.has( 3 );\n\n\t\t_activeChannels.clear();\n\n\t\treturn parameters;\n\n\t}\n\n\tfunction getProgramCacheKey( parameters ) {\n\n\t\tconst array = [];\n\n\t\tif ( parameters.shaderID ) {\n\n\t\t\tarray.push( parameters.shaderID );\n\n\t\t} else {\n\n\t\t\tarray.push( parameters.customVertexShaderID );\n\t\t\tarray.push( parameters.customFragmentShaderID );\n\n\t\t}\n\n\t\tif ( parameters.defines !== undefined ) {\n\n\t\t\tfor ( const name in parameters.defines ) {\n\n\t\t\t\tarray.push( name );\n\t\t\t\tarray.push( parameters.defines[ name ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( parameters.isRawShaderMaterial === false ) {\n\n\t\t\tgetProgramCacheKeyParameters( array, parameters );\n\t\t\tgetProgramCacheKeyBooleans( array, parameters );\n\t\t\tarray.push( renderer.outputColorSpace );\n\n\t\t}\n\n\t\tarray.push( parameters.customProgramCacheKey );\n\n\t\treturn array.join();\n\n\t}\n\n\tfunction getProgramCacheKeyParameters( array, parameters ) {\n\n\t\tarray.push( parameters.precision );\n\t\tarray.push( parameters.outputColorSpace );\n\t\tarray.push( parameters.envMapMode );\n\t\tarray.push( parameters.envMapCubeUVHeight );\n\t\tarray.push( parameters.mapUv );\n\t\tarray.push( parameters.alphaMapUv );\n\t\tarray.push( parameters.lightMapUv );\n\t\tarray.push( parameters.aoMapUv );\n\t\tarray.push( parameters.bumpMapUv );\n\t\tarray.push( parameters.normalMapUv );\n\t\tarray.push( parameters.displacementMapUv );\n\t\tarray.push( parameters.emissiveMapUv );\n\t\tarray.push( parameters.metalnessMapUv );\n\t\tarray.push( parameters.roughnessMapUv );\n\t\tarray.push( parameters.anisotropyMapUv );\n\t\tarray.push( parameters.clearcoatMapUv );\n\t\tarray.push( parameters.clearcoatNormalMapUv );\n\t\tarray.push( parameters.clearcoatRoughnessMapUv );\n\t\tarray.push( parameters.iridescenceMapUv );\n\t\tarray.push( parameters.iridescenceThicknessMapUv );\n\t\tarray.push( parameters.sheenColorMapUv );\n\t\tarray.push( parameters.sheenRoughnessMapUv );\n\t\tarray.push( parameters.specularMapUv );\n\t\tarray.push( parameters.specularColorMapUv );\n\t\tarray.push( parameters.specularIntensityMapUv );\n\t\tarray.push( parameters.transmissionMapUv );\n\t\tarray.push( parameters.thicknessMapUv );\n\t\tarray.push( parameters.combine );\n\t\tarray.push( parameters.fogExp2 );\n\t\tarray.push( parameters.sizeAttenuation );\n\t\tarray.push( parameters.morphTargetsCount );\n\t\tarray.push( parameters.morphAttributeCount );\n\t\tarray.push( parameters.numDirLights );\n\t\tarray.push( parameters.numPointLights );\n\t\tarray.push( parameters.numSpotLights );\n\t\tarray.push( parameters.numSpotLightMaps );\n\t\tarray.push( parameters.numHemiLights );\n\t\tarray.push( parameters.numRectAreaLights );\n\t\tarray.push( parameters.numDirLightShadows );\n\t\tarray.push( parameters.numPointLightShadows );\n\t\tarray.push( parameters.numSpotLightShadows );\n\t\tarray.push( parameters.numSpotLightShadowsWithMaps );\n\t\tarray.push( parameters.numLightProbes );\n\t\tarray.push( parameters.shadowMapType );\n\t\tarray.push( parameters.toneMapping );\n\t\tarray.push( parameters.numClippingPlanes );\n\t\tarray.push( parameters.numClipIntersection );\n\t\tarray.push( parameters.depthPacking );\n\n\t}\n\n\tfunction getProgramCacheKeyBooleans( array, parameters ) {\n\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.supportsVertexTextures )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.instancing )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.instancingColor )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.instancingMorph )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.matcap )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.envMap )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.normalMapObjectSpace )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.normalMapTangentSpace )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.clearcoat )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.iridescence )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.alphaTest )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.vertexColors )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.vertexAlphas )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.vertexUv1s )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.vertexUv2s )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.vertexUv3s )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.vertexTangents )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.anisotropy )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.alphaHash )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.batching )\n\t\t\t_programLayers.enable( 19 );\n\n\t\tarray.push( _programLayers.mask );\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.fog )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.useFog )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.flatShading )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.logarithmicDepthBuffer )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.skinning )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.morphTargets )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.morphNormals )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.morphColors )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.premultipliedAlpha )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.shadowMapEnabled )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.useLegacyLights )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.doubleSided )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.flipSided )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.useDepthPacking )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.dithering )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.transmission )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.sheen )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.opaque )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.pointsUvs )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.decodeVideoTexture )\n\t\t\t_programLayers.enable( 19 );\n\t\tif ( parameters.alphaToCoverage )\n\t\t\t_programLayers.enable( 20 );\n\n\t\tarray.push( _programLayers.mask );\n\n\t}\n\n\tfunction getUniforms( material ) {\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\t\tlet uniforms;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\t\t\tuniforms = UniformsUtils.clone( shader.uniforms );\n\n\t\t} else {\n\n\t\t\tuniforms = material.uniforms;\n\n\t\t}\n\n\t\treturn uniforms;\n\n\t}\n\n\tfunction acquireProgram( parameters, cacheKey ) {\n\n\t\tlet program;\n\n\t\t// Check if code has been already compiled\n\t\tfor ( let p = 0, pl = programs.length; p < pl; p ++ ) {\n\n\t\t\tconst preexistingProgram = programs[ p ];\n\n\t\t\tif ( preexistingProgram.cacheKey === cacheKey ) {\n\n\t\t\t\tprogram = preexistingProgram;\n\t\t\t\t++ program.usedTimes;\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( program === undefined ) {\n\n\t\t\tprogram = new WebGLProgram( renderer, cacheKey, parameters, bindingStates );\n\t\t\tprograms.push( program );\n\n\t\t}\n\n\t\treturn program;\n\n\t}\n\n\tfunction releaseProgram( program ) {\n\n\t\tif ( -- program.usedTimes === 0 ) {\n\n\t\t\t// Remove from unordered set\n\t\t\tconst i = programs.indexOf( program );\n\t\t\tprograms[ i ] = programs[ programs.length - 1 ];\n\t\t\tprograms.pop();\n\n\t\t\t// Free WebGL resources\n\t\t\tprogram.destroy();\n\n\t\t}\n\n\t}\n\n\tfunction releaseShaderCache( material ) {\n\n\t\t_customShaders.remove( material );\n\n\t}\n\n\tfunction dispose() {\n\n\t\t_customShaders.dispose();\n\n\t}\n\n\treturn {\n\t\tgetParameters: getParameters,\n\t\tgetProgramCacheKey: getProgramCacheKey,\n\t\tgetUniforms: getUniforms,\n\t\tacquireProgram: acquireProgram,\n\t\treleaseProgram: releaseProgram,\n\t\treleaseShaderCache: releaseShaderCache,\n\t\t// Exposed for resource monitoring & error feedback via renderer.info:\n\t\tprograms: programs,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLProperties() {\n\n\tlet properties = new WeakMap();\n\n\tfunction get( object ) {\n\n\t\tlet map = properties.get( object );\n\n\t\tif ( map === undefined ) {\n\n\t\t\tmap = {};\n\t\t\tproperties.set( object, map );\n\n\t\t}\n\n\t\treturn map;\n\n\t}\n\n\tfunction remove( object ) {\n\n\t\tproperties.delete( object );\n\n\t}\n\n\tfunction update( object, key, value ) {\n\n\t\tproperties.get( object )[ key ] = value;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tproperties = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction painterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.material.id !== b.material.id ) {\n\n\t\treturn a.material.id - b.material.id;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn a.z - b.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\nfunction reversePainterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn b.z - a.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\n\nfunction WebGLRenderList() {\n\n\tconst renderItems = [];\n\tlet renderItemsIndex = 0;\n\n\tconst opaque = [];\n\tconst transmissive = [];\n\tconst transparent = [];\n\n\tfunction init() {\n\n\t\trenderItemsIndex = 0;\n\n\t\topaque.length = 0;\n\t\ttransmissive.length = 0;\n\t\ttransparent.length = 0;\n\n\t}\n\n\tfunction getNextRenderItem( object, geometry, material, groupOrder, z, group ) {\n\n\t\tlet renderItem = renderItems[ renderItemsIndex ];\n\n\t\tif ( renderItem === undefined ) {\n\n\t\t\trenderItem = {\n\t\t\t\tid: object.id,\n\t\t\t\tobject: object,\n\t\t\t\tgeometry: geometry,\n\t\t\t\tmaterial: material,\n\t\t\t\tgroupOrder: groupOrder,\n\t\t\t\trenderOrder: object.renderOrder,\n\t\t\t\tz: z,\n\t\t\t\tgroup: group\n\t\t\t};\n\n\t\t\trenderItems[ renderItemsIndex ] = renderItem;\n\n\t\t} else {\n\n\t\t\trenderItem.id = object.id;\n\t\t\trenderItem.object = object;\n\t\t\trenderItem.geometry = geometry;\n\t\t\trenderItem.material = material;\n\t\t\trenderItem.groupOrder = groupOrder;\n\t\t\trenderItem.renderOrder = object.renderOrder;\n\t\t\trenderItem.z = z;\n\t\t\trenderItem.group = group;\n\n\t\t}\n\n\t\trenderItemsIndex ++;\n\n\t\treturn renderItem;\n\n\t}\n\n\tfunction push( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.push( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.push( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.push( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction unshift( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.unshift( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.unshift( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.unshift( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction sort( customOpaqueSort, customTransparentSort ) {\n\n\t\tif ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );\n\t\tif ( transmissive.length > 1 ) transmissive.sort( customTransparentSort || reversePainterSortStable );\n\t\tif ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );\n\n\t}\n\n\tfunction finish() {\n\n\t\t// Clear references from inactive renderItems in the list\n\n\t\tfor ( let i = renderItemsIndex, il = renderItems.length; i < il; i ++ ) {\n\n\t\t\tconst renderItem = renderItems[ i ];\n\n\t\t\tif ( renderItem.id === null ) break;\n\n\t\t\trenderItem.id = null;\n\t\t\trenderItem.object = null;\n\t\t\trenderItem.geometry = null;\n\t\t\trenderItem.material = null;\n\t\t\trenderItem.group = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\topaque: opaque,\n\t\ttransmissive: transmissive,\n\t\ttransparent: transparent,\n\n\t\tinit: init,\n\t\tpush: push,\n\t\tunshift: unshift,\n\t\tfinish: finish,\n\n\t\tsort: sort\n\t};\n\n}\n\nfunction WebGLRenderLists() {\n\n\tlet lists = new WeakMap();\n\n\tfunction get( scene, renderCallDepth ) {\n\n\t\tconst listArray = lists.get( scene );\n\t\tlet list;\n\n\t\tif ( listArray === undefined ) {\n\n\t\t\tlist = new WebGLRenderList();\n\t\t\tlists.set( scene, [ list ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= listArray.length ) {\n\n\t\t\t\tlist = new WebGLRenderList();\n\t\t\t\tlistArray.push( list );\n\n\t\t\t} else {\n\n\t\t\t\tlist = listArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn list;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tlists = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction UniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tconeCos: 0,\n\t\t\t\t\t\tpenumbraCos: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'HemisphereLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tskyColor: new Color(),\n\t\t\t\t\t\tgroundColor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RectAreaLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\thalfWidth: new Vector3(),\n\t\t\t\t\t\thalfHeight: new Vector3()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\nfunction ShadowUniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2(),\n\t\t\t\t\t\tshadowCameraNear: 1,\n\t\t\t\t\t\tshadowCameraFar: 1000\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\t// TODO (abelnation): set RectAreaLight shadow uniforms\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\n\n\nlet nextVersion = 0;\n\nfunction shadowCastingAndTexturingLightsFirst( lightA, lightB ) {\n\n\treturn ( lightB.castShadow ? 2 : 0 ) - ( lightA.castShadow ? 2 : 0 ) + ( lightB.map ? 1 : 0 ) - ( lightA.map ? 1 : 0 );\n\n}\n\nfunction WebGLLights( extensions ) {\n\n\tconst cache = new UniformsCache();\n\n\tconst shadowCache = ShadowUniformsCache();\n\n\tconst state = {\n\n\t\tversion: 0,\n\n\t\thash: {\n\t\t\tdirectionalLength: - 1,\n\t\t\tpointLength: - 1,\n\t\t\tspotLength: - 1,\n\t\t\trectAreaLength: - 1,\n\t\t\themiLength: - 1,\n\n\t\t\tnumDirectionalShadows: - 1,\n\t\t\tnumPointShadows: - 1,\n\t\t\tnumSpotShadows: - 1,\n\t\t\tnumSpotMaps: - 1,\n\n\t\t\tnumLightProbes: - 1\n\t\t},\n\n\t\tambient: [ 0, 0, 0 ],\n\t\tprobe: [],\n\t\tdirectional: [],\n\t\tdirectionalShadow: [],\n\t\tdirectionalShadowMap: [],\n\t\tdirectionalShadowMatrix: [],\n\t\tspot: [],\n\t\tspotLightMap: [],\n\t\tspotShadow: [],\n\t\tspotShadowMap: [],\n\t\tspotLightMatrix: [],\n\t\trectArea: [],\n\t\trectAreaLTC1: null,\n\t\trectAreaLTC2: null,\n\t\tpoint: [],\n\t\tpointShadow: [],\n\t\tpointShadowMap: [],\n\t\tpointShadowMatrix: [],\n\t\themi: [],\n\t\tnumSpotLightShadowsWithMaps: 0,\n\t\tnumLightProbes: 0\n\n\t};\n\n\tfor ( let i = 0; i < 9; i ++ ) state.probe.push( new Vector3() );\n\n\tconst vector3 = new Vector3();\n\tconst matrix4 = new Matrix4();\n\tconst matrix42 = new Matrix4();\n\n\tfunction setup( lights, useLegacyLights ) {\n\n\t\tlet r = 0, g = 0, b = 0;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) state.probe[ i ].set( 0, 0, 0 );\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tlet numDirectionalShadows = 0;\n\t\tlet numPointShadows = 0;\n\t\tlet numSpotShadows = 0;\n\t\tlet numSpotMaps = 0;\n\t\tlet numSpotShadowsWithMaps = 0;\n\n\t\tlet numLightProbes = 0;\n\n\t\t// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\n\t\tlights.sort( shadowCastingAndTexturingLightsFirst );\n\n\t\t// artist-friendly light intensity scaling factor\n\t\tconst scaleFactor = ( useLegacyLights === true ) ? Math.PI : 1;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tconst color = light.color;\n\t\t\tconst intensity = light.intensity;\n\t\t\tconst distance = light.distance;\n\n\t\t\tconst shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null;\n\n\t\t\tif ( light.isAmbientLight ) {\n\n\t\t\t\tr += color.r * intensity * scaleFactor;\n\t\t\t\tg += color.g * intensity * scaleFactor;\n\t\t\t\tb += color.b * intensity * scaleFactor;\n\n\t\t\t} else if ( light.isLightProbe ) {\n\n\t\t\t\tfor ( let j = 0; j < 9; j ++ ) {\n\n\t\t\t\t\tstate.probe[ j ].addScaledVector( light.sh.coefficients[ j ], intensity );\n\n\t\t\t\t}\n\n\t\t\t\tnumLightProbes ++;\n\n\t\t\t} else if ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity * scaleFactor );\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.directionalShadow[ directionalLength ] = shadowUniforms;\n\t\t\t\t\tstate.directionalShadowMap[ directionalLength ] = shadowMap;\n\t\t\t\t\tstate.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumDirectionalShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.directional[ directionalLength ] = uniforms;\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity * scaleFactor );\n\t\t\t\tuniforms.distance = distance;\n\n\t\t\t\tuniforms.coneCos = Math.cos( light.angle );\n\t\t\t\tuniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) );\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tstate.spot[ spotLength ] = uniforms;\n\n\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\tif ( light.map ) {\n\n\t\t\t\t\tstate.spotLightMap[ numSpotMaps ] = light.map;\n\t\t\t\t\tnumSpotMaps ++;\n\n\t\t\t\t\t// make sure the lightMatrix is up to date\n\t\t\t\t\t// TODO : do it if required only\n\t\t\t\t\tshadow.updateMatrices( light );\n\n\t\t\t\t\tif ( light.castShadow ) numSpotShadowsWithMaps ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.spotLightMatrix[ spotLength ] = shadow.matrix;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.spotShadow[ spotLength ] = shadowUniforms;\n\t\t\t\t\tstate.spotShadowMap[ spotLength ] = shadowMap;\n\n\t\t\t\t\tnumSpotShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tstate.rectArea[ rectAreaLength ] = uniforms;\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity * scaleFactor );\n\t\t\t\tuniforms.distance = light.distance;\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\t\t\t\t\tshadowUniforms.shadowCameraNear = shadow.camera.near;\n\t\t\t\t\tshadowUniforms.shadowCameraFar = shadow.camera.far;\n\n\t\t\t\t\tstate.pointShadow[ pointLength ] = shadowUniforms;\n\t\t\t\t\tstate.pointShadowMap[ pointLength ] = shadowMap;\n\t\t\t\t\tstate.pointShadowMatrix[ pointLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumPointShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.point[ pointLength ] = uniforms;\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.skyColor.copy( light.color ).multiplyScalar( intensity * scaleFactor );\n\t\t\t\tuniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity * scaleFactor );\n\n\t\t\t\tstate.hemi[ hemiLength ] = uniforms;\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( rectAreaLength > 0 ) {\n\n\t\t\tif ( extensions.has( 'OES_texture_float_linear' ) === true ) {\n\n\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t} else {\n\n\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.ambient[ 0 ] = r;\n\t\tstate.ambient[ 1 ] = g;\n\t\tstate.ambient[ 2 ] = b;\n\n\t\tconst hash = state.hash;\n\n\t\tif ( hash.directionalLength !== directionalLength ||\n\t\t\thash.pointLength !== pointLength ||\n\t\t\thash.spotLength !== spotLength ||\n\t\t\thash.rectAreaLength !== rectAreaLength ||\n\t\t\thash.hemiLength !== hemiLength ||\n\t\t\thash.numDirectionalShadows !== numDirectionalShadows ||\n\t\t\thash.numPointShadows !== numPointShadows ||\n\t\t\thash.numSpotShadows !== numSpotShadows ||\n\t\t\thash.numSpotMaps !== numSpotMaps ||\n\t\t\thash.numLightProbes !== numLightProbes ) {\n\n\t\t\tstate.directional.length = directionalLength;\n\t\t\tstate.spot.length = spotLength;\n\t\t\tstate.rectArea.length = rectAreaLength;\n\t\t\tstate.point.length = pointLength;\n\t\t\tstate.hemi.length = hemiLength;\n\n\t\t\tstate.directionalShadow.length = numDirectionalShadows;\n\t\t\tstate.directionalShadowMap.length = numDirectionalShadows;\n\t\t\tstate.pointShadow.length = numPointShadows;\n\t\t\tstate.pointShadowMap.length = numPointShadows;\n\t\t\tstate.spotShadow.length = numSpotShadows;\n\t\t\tstate.spotShadowMap.length = numSpotShadows;\n\t\t\tstate.directionalShadowMatrix.length = numDirectionalShadows;\n\t\t\tstate.pointShadowMatrix.length = numPointShadows;\n\t\t\tstate.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;\n\t\t\tstate.spotLightMap.length = numSpotMaps;\n\t\t\tstate.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;\n\t\t\tstate.numLightProbes = numLightProbes;\n\n\t\t\thash.directionalLength = directionalLength;\n\t\t\thash.pointLength = pointLength;\n\t\t\thash.spotLength = spotLength;\n\t\t\thash.rectAreaLength = rectAreaLength;\n\t\t\thash.hemiLength = hemiLength;\n\n\t\t\thash.numDirectionalShadows = numDirectionalShadows;\n\t\t\thash.numPointShadows = numPointShadows;\n\t\t\thash.numSpotShadows = numSpotShadows;\n\t\t\thash.numSpotMaps = numSpotMaps;\n\n\t\t\thash.numLightProbes = numLightProbes;\n\n\t\t\tstate.version = nextVersion ++;\n\n\t\t}\n\n\t}\n\n\tfunction setupView( lights, camera ) {\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tconst viewMatrix = camera.matrixWorldInverse;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tif ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = state.directional[ directionalLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = state.spot[ spotLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = state.rectArea[ rectAreaLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\t// extract local rotation of light to derive width/height half vectors\n\t\t\t\tmatrix42.identity();\n\t\t\t\tmatrix4.copy( light.matrixWorld );\n\t\t\t\tmatrix4.premultiply( viewMatrix );\n\t\t\t\tmatrix42.extractRotation( matrix4 );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tuniforms.halfWidth.applyMatrix4( matrix42 );\n\t\t\t\tuniforms.halfHeight.applyMatrix4( matrix42 );\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = state.point[ pointLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = state.hemi[ hemiLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tsetup: setup,\n\t\tsetupView: setupView,\n\t\tstate: state\n\t};\n\n}\n\nfunction WebGLRenderState( extensions ) {\n\n\tconst lights = new WebGLLights( extensions );\n\n\tconst lightsArray = [];\n\tconst shadowsArray = [];\n\n\tfunction init() {\n\n\t\tlightsArray.length = 0;\n\t\tshadowsArray.length = 0;\n\n\t}\n\n\tfunction pushLight( light ) {\n\n\t\tlightsArray.push( light );\n\n\t}\n\n\tfunction pushShadow( shadowLight ) {\n\n\t\tshadowsArray.push( shadowLight );\n\n\t}\n\n\tfunction setupLights( useLegacyLights ) {\n\n\t\tlights.setup( lightsArray, useLegacyLights );\n\n\t}\n\n\tfunction setupLightsView( camera ) {\n\n\t\tlights.setupView( lightsArray, camera );\n\n\t}\n\n\tconst state = {\n\t\tlightsArray: lightsArray,\n\t\tshadowsArray: shadowsArray,\n\n\t\tlights: lights,\n\n\t\ttransmissionRenderTarget: null\n\t};\n\n\treturn {\n\t\tinit: init,\n\t\tstate: state,\n\t\tsetupLights: setupLights,\n\t\tsetupLightsView: setupLightsView,\n\n\t\tpushLight: pushLight,\n\t\tpushShadow: pushShadow\n\t};\n\n}\n\nfunction WebGLRenderStates( extensions ) {\n\n\tlet renderStates = new WeakMap();\n\n\tfunction get( scene, renderCallDepth = 0 ) {\n\n\t\tconst renderStateArray = renderStates.get( scene );\n\t\tlet renderState;\n\n\t\tif ( renderStateArray === undefined ) {\n\n\t\t\trenderState = new WebGLRenderState( extensions );\n\t\t\trenderStates.set( scene, [ renderState ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= renderStateArray.length ) {\n\n\t\t\t\trenderState = new WebGLRenderState( extensions );\n\t\t\t\trenderStateArray.push( renderState );\n\n\t\t\t} else {\n\n\t\t\t\trenderState = renderStateArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn renderState;\n\n\t}\n\n\tfunction dispose() {\n\n\t\trenderStates = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass MeshDepthMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshDepthMaterial = true;\n\n\t\tthis.type = 'MeshDepthMaterial';\n\n\t\tthis.depthPacking = BasicDepthPacking;\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.depthPacking = source.depthPacking;\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshDistanceMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshDistanceMaterial = true;\n\n\t\tthis.type = 'MeshDistanceMaterial';\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst vertex = \"void main() {\\n\\tgl_Position = vec4( position, 1.0 );\\n}\";\n\nconst fragment = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\n#include \\nvoid main() {\\n\\tconst float samples = float( VSM_SAMPLES );\\n\\tfloat mean = 0.0;\\n\\tfloat squared_mean = 0.0;\\n\\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\\n\\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\\n\\tfor ( float i = 0.0; i < samples; i ++ ) {\\n\\t\\tfloat uvOffset = uvStart + i * uvStride;\\n\\t\\t#ifdef HORIZONTAL_PASS\\n\\t\\t\\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\\n\\t\\t\\tmean += distribution.x;\\n\\t\\t\\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\n\\t\\t#else\\n\\t\\t\\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\\n\\t\\t\\tmean += depth;\\n\\t\\t\\tsquared_mean += depth * depth;\\n\\t\\t#endif\\n\\t}\\n\\tmean = mean / samples;\\n\\tsquared_mean = squared_mean / samples;\\n\\tfloat std_dev = sqrt( squared_mean - mean * mean );\\n\\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\\n}\";\n\nfunction WebGLShadowMap( _renderer, _objects, _capabilities ) {\n\n\tlet _frustum = new Frustum();\n\n\tconst _shadowMapSize = new Vector2(),\n\t\t_viewportSize = new Vector2(),\n\n\t\t_viewport = new Vector4(),\n\n\t\t_depthMaterial = new MeshDepthMaterial( { depthPacking: RGBADepthPacking } ),\n\t\t_distanceMaterial = new MeshDistanceMaterial(),\n\n\t\t_materialCache = {},\n\n\t\t_maxTextureSize = _capabilities.maxTextureSize;\n\n\tconst shadowSide = { [ FrontSide ]: BackSide, [ BackSide ]: FrontSide, [ DoubleSide ]: DoubleSide };\n\n\tconst shadowMaterialVertical = new ShaderMaterial( {\n\t\tdefines: {\n\t\t\tVSM_SAMPLES: 8\n\t\t},\n\t\tuniforms: {\n\t\t\tshadow_pass: { value: null },\n\t\t\tresolution: { value: new Vector2() },\n\t\t\tradius: { value: 4.0 }\n\t\t},\n\n\t\tvertexShader: vertex,\n\t\tfragmentShader: fragment\n\n\t} );\n\n\tconst shadowMaterialHorizontal = shadowMaterialVertical.clone();\n\tshadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;\n\n\tconst fullScreenTri = new BufferGeometry();\n\tfullScreenTri.setAttribute(\n\t\t'position',\n\t\tnew BufferAttribute(\n\t\t\tnew Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),\n\t\t\t3\n\t\t)\n\t);\n\n\tconst fullScreenMesh = new Mesh( fullScreenTri, shadowMaterialVertical );\n\n\tconst scope = this;\n\n\tthis.enabled = false;\n\n\tthis.autoUpdate = true;\n\tthis.needsUpdate = false;\n\n\tthis.type = PCFShadowMap;\n\tlet _previousType = this.type;\n\n\tthis.render = function ( lights, scene, camera ) {\n\n\t\tif ( scope.enabled === false ) return;\n\t\tif ( scope.autoUpdate === false && scope.needsUpdate === false ) return;\n\n\t\tif ( lights.length === 0 ) return;\n\n\t\tconst currentRenderTarget = _renderer.getRenderTarget();\n\t\tconst activeCubeFace = _renderer.getActiveCubeFace();\n\t\tconst activeMipmapLevel = _renderer.getActiveMipmapLevel();\n\n\t\tconst _state = _renderer.state;\n\n\t\t// Set GL state for depth map.\n\t\t_state.setBlending( NoBlending );\n\t\t_state.buffers.color.setClear( 1, 1, 1, 1 );\n\t\t_state.buffers.depth.setTest( true );\n\t\t_state.setScissorTest( false );\n\n\t\t// check for shadow map type changes\n\n\t\tconst toVSM = ( _previousType !== VSMShadowMap && this.type === VSMShadowMap );\n\t\tconst fromVSM = ( _previousType === VSMShadowMap && this.type !== VSMShadowMap );\n\n\t\t// render depth map\n\n\t\tfor ( let i = 0, il = lights.length; i < il; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\t\t\tconst shadow = light.shadow;\n\n\t\t\tif ( shadow === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( shadow.autoUpdate === false && shadow.needsUpdate === false ) continue;\n\n\t\t\t_shadowMapSize.copy( shadow.mapSize );\n\n\t\t\tconst shadowFrameExtents = shadow.getFrameExtents();\n\n\t\t\t_shadowMapSize.multiply( shadowFrameExtents );\n\n\t\t\t_viewportSize.copy( shadow.mapSize );\n\n\t\t\tif ( _shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\tif ( _shadowMapSize.x > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.x = Math.floor( _maxTextureSize / shadowFrameExtents.x );\n\t\t\t\t\t_shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\n\t\t\t\t\tshadow.mapSize.x = _viewportSize.x;\n\n\t\t\t\t}\n\n\t\t\t\tif ( _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.y = Math.floor( _maxTextureSize / shadowFrameExtents.y );\n\t\t\t\t\t_shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\n\t\t\t\t\tshadow.mapSize.y = _viewportSize.y;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( shadow.map === null || toVSM === true || fromVSM === true ) {\n\n\t\t\t\tconst pars = ( this.type !== VSMShadowMap ) ? { minFilter: NearestFilter, magFilter: NearestFilter } : {};\n\n\t\t\t\tif ( shadow.map !== null ) {\n\n\t\t\t\t\tshadow.map.dispose();\n\n\t\t\t\t}\n\n\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\n\t\t\t\tshadow.map.texture.name = light.name + '.shadowMap';\n\n\t\t\t\tshadow.camera.updateProjectionMatrix();\n\n\t\t\t}\n\n\t\t\t_renderer.setRenderTarget( shadow.map );\n\t\t\t_renderer.clear();\n\n\t\t\tconst viewportCount = shadow.getViewportCount();\n\n\t\t\tfor ( let vp = 0; vp < viewportCount; vp ++ ) {\n\n\t\t\t\tconst viewport = shadow.getViewport( vp );\n\n\t\t\t\t_viewport.set(\n\t\t\t\t\t_viewportSize.x * viewport.x,\n\t\t\t\t\t_viewportSize.y * viewport.y,\n\t\t\t\t\t_viewportSize.x * viewport.z,\n\t\t\t\t\t_viewportSize.y * viewport.w\n\t\t\t\t);\n\n\t\t\t\t_state.viewport( _viewport );\n\n\t\t\t\tshadow.updateMatrices( light, vp );\n\n\t\t\t\t_frustum = shadow.getFrustum();\n\n\t\t\t\trenderObject( scene, camera, shadow.camera, light, this.type );\n\n\t\t\t}\n\n\t\t\t// do blur pass for VSM\n\n\t\t\tif ( shadow.isPointLightShadow !== true && this.type === VSMShadowMap ) {\n\n\t\t\t\tVSMPass( shadow, camera );\n\n\t\t\t}\n\n\t\t\tshadow.needsUpdate = false;\n\n\t\t}\n\n\t\t_previousType = this.type;\n\n\t\tscope.needsUpdate = false;\n\n\t\t_renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );\n\n\t};\n\n\tfunction VSMPass( shadow, camera ) {\n\n\t\tconst geometry = _objects.update( fullScreenMesh );\n\n\t\tif ( shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples ) {\n\n\t\t\tshadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;\n\t\t\tshadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;\n\n\t\t\tshadowMaterialVertical.needsUpdate = true;\n\t\t\tshadowMaterialHorizontal.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( shadow.mapPass === null ) {\n\n\t\t\tshadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y );\n\n\t\t}\n\n\t\t// vertical pass\n\n\t\tshadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;\n\t\tshadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialVertical.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.mapPass );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );\n\n\t\t// horizontal pass\n\n\t\tshadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;\n\t\tshadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialHorizontal.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.map );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );\n\n\t}\n\n\tfunction getDepthMaterial( object, material, light, type ) {\n\n\t\tlet result = null;\n\n\t\tconst customMaterial = ( light.isPointLight === true ) ? object.customDistanceMaterial : object.customDepthMaterial;\n\n\t\tif ( customMaterial !== undefined ) {\n\n\t\t\tresult = customMaterial;\n\n\t\t} else {\n\n\t\t\tresult = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;\n\n\t\t\tif ( ( _renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||\n\t\t\t\t( material.displacementMap && material.displacementScale !== 0 ) ||\n\t\t\t\t( material.alphaMap && material.alphaTest > 0 ) ||\n\t\t\t\t( material.map && material.alphaTest > 0 ) ) {\n\n\t\t\t\t// in this case we need a unique material instance reflecting the\n\t\t\t\t// appropriate state\n\n\t\t\t\tconst keyA = result.uuid, keyB = material.uuid;\n\n\t\t\t\tlet materialsForVariant = _materialCache[ keyA ];\n\n\t\t\t\tif ( materialsForVariant === undefined ) {\n\n\t\t\t\t\tmaterialsForVariant = {};\n\t\t\t\t\t_materialCache[ keyA ] = materialsForVariant;\n\n\t\t\t\t}\n\n\t\t\t\tlet cachedMaterial = materialsForVariant[ keyB ];\n\n\t\t\t\tif ( cachedMaterial === undefined ) {\n\n\t\t\t\t\tcachedMaterial = result.clone();\n\t\t\t\t\tmaterialsForVariant[ keyB ] = cachedMaterial;\n\t\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t\t\t}\n\n\t\t\t\tresult = cachedMaterial;\n\n\t\t\t}\n\n\t\t}\n\n\t\tresult.visible = material.visible;\n\t\tresult.wireframe = material.wireframe;\n\n\t\tif ( type === VSMShadowMap ) {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : material.side;\n\n\t\t} else {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : shadowSide[ material.side ];\n\n\t\t}\n\n\t\tresult.alphaMap = material.alphaMap;\n\t\tresult.alphaTest = material.alphaTest;\n\t\tresult.map = material.map;\n\n\t\tresult.clipShadows = material.clipShadows;\n\t\tresult.clippingPlanes = material.clippingPlanes;\n\t\tresult.clipIntersection = material.clipIntersection;\n\n\t\tresult.displacementMap = material.displacementMap;\n\t\tresult.displacementScale = material.displacementScale;\n\t\tresult.displacementBias = material.displacementBias;\n\n\t\tresult.wireframeLinewidth = material.wireframeLinewidth;\n\t\tresult.linewidth = material.linewidth;\n\n\t\tif ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {\n\n\t\t\tconst materialProperties = _renderer.properties.get( result );\n\t\t\tmaterialProperties.light = light;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tfunction renderObject( object, camera, shadowCamera, light, type ) {\n\n\t\tif ( object.visible === false ) return;\n\n\t\tconst visible = object.layers.test( camera.layers );\n\n\t\tif ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) {\n\n\t\t\tif ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) {\n\n\t\t\t\tobject.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );\n\n\t\t\t\tconst geometry = _objects.update( object );\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\tfor ( let k = 0, kl = groups.length; k < kl; k ++ ) {\n\n\t\t\t\t\t\tconst group = groups[ k ];\n\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, groupMaterial, light, type );\n\n\t\t\t\t\t\t\tobject.onBeforeShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, group );\n\n\t\t\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );\n\n\t\t\t\t\t\t\tobject.onAfterShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, group );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, material, light, type );\n\n\t\t\t\t\tobject.onBeforeShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, null );\n\n\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );\n\n\t\t\t\t\tobject.onAfterShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, null );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( children[ i ], camera, shadowCamera, light, type );\n\n\t\t}\n\n\t}\n\n\tfunction onMaterialDispose( event ) {\n\n\t\tconst material = event.target;\n\n\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t// make sure to remove the unique distance/depth materials used for shadow map rendering\n\n\t\tfor ( const id in _materialCache ) {\n\n\t\t\tconst cache = _materialCache[ id ];\n\n\t\t\tconst uuid = event.target.uuid;\n\n\t\t\tif ( uuid in cache ) {\n\n\t\t\t\tconst shadowMaterial = cache[ uuid ];\n\t\t\t\tshadowMaterial.dispose();\n\t\t\t\tdelete cache[ uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction WebGLState( gl ) {\n\n\tfunction ColorBuffer() {\n\n\t\tlet locked = false;\n\n\t\tconst color = new Vector4();\n\t\tlet currentColorMask = null;\n\t\tconst currentColorClear = new Vector4( 0, 0, 0, 0 );\n\n\t\treturn {\n\n\t\t\tsetMask: function ( colorMask ) {\n\n\t\t\t\tif ( currentColorMask !== colorMask && ! locked ) {\n\n\t\t\t\t\tgl.colorMask( colorMask, colorMask, colorMask, colorMask );\n\t\t\t\t\tcurrentColorMask = colorMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( r, g, b, a, premultipliedAlpha ) {\n\n\t\t\t\tif ( premultipliedAlpha === true ) {\n\n\t\t\t\t\tr *= a; g *= a; b *= a;\n\n\t\t\t\t}\n\n\t\t\t\tcolor.set( r, g, b, a );\n\n\t\t\t\tif ( currentColorClear.equals( color ) === false ) {\n\n\t\t\t\t\tgl.clearColor( r, g, b, a );\n\t\t\t\t\tcurrentColorClear.copy( color );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentColorMask = null;\n\t\t\t\tcurrentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction DepthBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentDepthMask = null;\n\t\tlet currentDepthFunc = null;\n\t\tlet currentDepthClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( depthTest ) {\n\n\t\t\t\tif ( depthTest ) {\n\n\t\t\t\t\tenable( gl.DEPTH_TEST );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdisable( gl.DEPTH_TEST );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( depthMask ) {\n\n\t\t\t\tif ( currentDepthMask !== depthMask && ! locked ) {\n\n\t\t\t\t\tgl.depthMask( depthMask );\n\t\t\t\t\tcurrentDepthMask = depthMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( depthFunc ) {\n\n\t\t\t\tif ( currentDepthFunc !== depthFunc ) {\n\n\t\t\t\t\tswitch ( depthFunc ) {\n\n\t\t\t\t\t\tcase NeverDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NEVER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AlwaysDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.ALWAYS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LESS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase EqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.EQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GREATER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase NotEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NOTEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrentDepthFunc = depthFunc;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( depth ) {\n\n\t\t\t\tif ( currentDepthClear !== depth ) {\n\n\t\t\t\t\tgl.clearDepth( depth );\n\t\t\t\t\tcurrentDepthClear = depth;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentDepthMask = null;\n\t\t\t\tcurrentDepthFunc = null;\n\t\t\t\tcurrentDepthClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction StencilBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentStencilMask = null;\n\t\tlet currentStencilFunc = null;\n\t\tlet currentStencilRef = null;\n\t\tlet currentStencilFuncMask = null;\n\t\tlet currentStencilFail = null;\n\t\tlet currentStencilZFail = null;\n\t\tlet currentStencilZPass = null;\n\t\tlet currentStencilClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( stencilTest ) {\n\n\t\t\t\tif ( ! locked ) {\n\n\t\t\t\t\tif ( stencilTest ) {\n\n\t\t\t\t\t\tenable( gl.STENCIL_TEST );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tdisable( gl.STENCIL_TEST );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( stencilMask ) {\n\n\t\t\t\tif ( currentStencilMask !== stencilMask && ! locked ) {\n\n\t\t\t\t\tgl.stencilMask( stencilMask );\n\t\t\t\t\tcurrentStencilMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( stencilFunc, stencilRef, stencilMask ) {\n\n\t\t\t\tif ( currentStencilFunc !== stencilFunc ||\n\t\t\t\t currentStencilRef !== stencilRef ||\n\t\t\t\t currentStencilFuncMask !== stencilMask ) {\n\n\t\t\t\t\tgl.stencilFunc( stencilFunc, stencilRef, stencilMask );\n\n\t\t\t\t\tcurrentStencilFunc = stencilFunc;\n\t\t\t\t\tcurrentStencilRef = stencilRef;\n\t\t\t\t\tcurrentStencilFuncMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetOp: function ( stencilFail, stencilZFail, stencilZPass ) {\n\n\t\t\t\tif ( currentStencilFail !== stencilFail ||\n\t\t\t\t currentStencilZFail !== stencilZFail ||\n\t\t\t\t currentStencilZPass !== stencilZPass ) {\n\n\t\t\t\t\tgl.stencilOp( stencilFail, stencilZFail, stencilZPass );\n\n\t\t\t\t\tcurrentStencilFail = stencilFail;\n\t\t\t\t\tcurrentStencilZFail = stencilZFail;\n\t\t\t\t\tcurrentStencilZPass = stencilZPass;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( stencil ) {\n\n\t\t\t\tif ( currentStencilClear !== stencil ) {\n\n\t\t\t\t\tgl.clearStencil( stencil );\n\t\t\t\t\tcurrentStencilClear = stencil;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentStencilMask = null;\n\t\t\t\tcurrentStencilFunc = null;\n\t\t\t\tcurrentStencilRef = null;\n\t\t\t\tcurrentStencilFuncMask = null;\n\t\t\t\tcurrentStencilFail = null;\n\t\t\t\tcurrentStencilZFail = null;\n\t\t\t\tcurrentStencilZPass = null;\n\t\t\t\tcurrentStencilClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t//\n\n\tconst colorBuffer = new ColorBuffer();\n\tconst depthBuffer = new DepthBuffer();\n\tconst stencilBuffer = new StencilBuffer();\n\n\tconst uboBindings = new WeakMap();\n\tconst uboProgramMap = new WeakMap();\n\n\tlet enabledCapabilities = {};\n\n\tlet currentBoundFramebuffers = {};\n\tlet currentDrawbuffers = new WeakMap();\n\tlet defaultDrawbuffers = [];\n\n\tlet currentProgram = null;\n\n\tlet currentBlendingEnabled = false;\n\tlet currentBlending = null;\n\tlet currentBlendEquation = null;\n\tlet currentBlendSrc = null;\n\tlet currentBlendDst = null;\n\tlet currentBlendEquationAlpha = null;\n\tlet currentBlendSrcAlpha = null;\n\tlet currentBlendDstAlpha = null;\n\tlet currentBlendColor = new Color( 0, 0, 0 );\n\tlet currentBlendAlpha = 0;\n\tlet currentPremultipledAlpha = false;\n\n\tlet currentFlipSided = null;\n\tlet currentCullFace = null;\n\n\tlet currentLineWidth = null;\n\n\tlet currentPolygonOffsetFactor = null;\n\tlet currentPolygonOffsetUnits = null;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS );\n\n\tlet lineWidthAvailable = false;\n\tlet version = 0;\n\tconst glVersion = gl.getParameter( gl.VERSION );\n\n\tif ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^WebGL (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 1.0 );\n\n\t} else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^OpenGL ES (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 2.0 );\n\n\t}\n\n\tlet currentTextureSlot = null;\n\tlet currentBoundTextures = {};\n\n\tconst scissorParam = gl.getParameter( gl.SCISSOR_BOX );\n\tconst viewportParam = gl.getParameter( gl.VIEWPORT );\n\n\tconst currentScissor = new Vector4().fromArray( scissorParam );\n\tconst currentViewport = new Vector4().fromArray( viewportParam );\n\n\tfunction createTexture( type, target, count, dimensions ) {\n\n\t\tconst data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture( type, texture );\n\t\tgl.texParameteri( type, gl.TEXTURE_MIN_FILTER, gl.NEAREST );\n\t\tgl.texParameteri( type, gl.TEXTURE_MAG_FILTER, gl.NEAREST );\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tif ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\tgl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t} else {\n\n\t\t\t\tgl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tconst emptyTextures = {};\n\temptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );\n\temptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );\n\temptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );\n\temptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );\n\n\t// init\n\n\tcolorBuffer.setClear( 0, 0, 0, 1 );\n\tdepthBuffer.setClear( 1 );\n\tstencilBuffer.setClear( 0 );\n\n\tenable( gl.DEPTH_TEST );\n\tdepthBuffer.setFunc( LessEqualDepth );\n\n\tsetFlipSided( false );\n\tsetCullFace( CullFaceBack );\n\tenable( gl.CULL_FACE );\n\n\tsetBlending( NoBlending );\n\n\t//\n\n\tfunction enable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== true ) {\n\n\t\t\tgl.enable( id );\n\t\t\tenabledCapabilities[ id ] = true;\n\n\t\t}\n\n\t}\n\n\tfunction disable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== false ) {\n\n\t\t\tgl.disable( id );\n\t\t\tenabledCapabilities[ id ] = false;\n\n\t\t}\n\n\t}\n\n\tfunction bindFramebuffer( target, framebuffer ) {\n\n\t\tif ( currentBoundFramebuffers[ target ] !== framebuffer ) {\n\n\t\t\tgl.bindFramebuffer( target, framebuffer );\n\n\t\t\tcurrentBoundFramebuffers[ target ] = framebuffer;\n\n\t\t\t// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER\n\n\t\t\tif ( target === gl.DRAW_FRAMEBUFFER ) {\n\n\t\t\t\tcurrentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;\n\n\t\t\t}\n\n\t\t\tif ( target === gl.FRAMEBUFFER ) {\n\n\t\t\t\tcurrentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction drawBuffers( renderTarget, framebuffer ) {\n\n\t\tlet drawBuffers = defaultDrawbuffers;\n\n\t\tlet needsUpdate = false;\n\n\t\tif ( renderTarget ) {\n\n\t\t\tdrawBuffers = currentDrawbuffers.get( framebuffer );\n\n\t\t\tif ( drawBuffers === undefined ) {\n\n\t\t\t\tdrawBuffers = [];\n\t\t\t\tcurrentDrawbuffers.set( framebuffer, drawBuffers );\n\n\t\t\t}\n\n\t\t\tconst textures = renderTarget.textures;\n\n\t\t\tif ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\tdrawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;\n\n\t\t\t\t}\n\n\t\t\t\tdrawBuffers.length = textures.length;\n\n\t\t\t\tneedsUpdate = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( drawBuffers[ 0 ] !== gl.BACK ) {\n\n\t\t\t\tdrawBuffers[ 0 ] = gl.BACK;\n\n\t\t\t\tneedsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tgl.drawBuffers( drawBuffers );\n\n\t\t}\n\n\t}\n\n\tfunction useProgram( program ) {\n\n\t\tif ( currentProgram !== program ) {\n\n\t\t\tgl.useProgram( program );\n\n\t\t\tcurrentProgram = program;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tconst equationToGL = {\n\t\t[ AddEquation ]: gl.FUNC_ADD,\n\t\t[ SubtractEquation ]: gl.FUNC_SUBTRACT,\n\t\t[ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT\n\t};\n\n\tequationToGL[ MinEquation ] = gl.MIN;\n\tequationToGL[ MaxEquation ] = gl.MAX;\n\n\tconst factorToGL = {\n\t\t[ ZeroFactor ]: gl.ZERO,\n\t\t[ OneFactor ]: gl.ONE,\n\t\t[ SrcColorFactor ]: gl.SRC_COLOR,\n\t\t[ SrcAlphaFactor ]: gl.SRC_ALPHA,\n\t\t[ SrcAlphaSaturateFactor ]: gl.SRC_ALPHA_SATURATE,\n\t\t[ DstColorFactor ]: gl.DST_COLOR,\n\t\t[ DstAlphaFactor ]: gl.DST_ALPHA,\n\t\t[ OneMinusSrcColorFactor ]: gl.ONE_MINUS_SRC_COLOR,\n\t\t[ OneMinusSrcAlphaFactor ]: gl.ONE_MINUS_SRC_ALPHA,\n\t\t[ OneMinusDstColorFactor ]: gl.ONE_MINUS_DST_COLOR,\n\t\t[ OneMinusDstAlphaFactor ]: gl.ONE_MINUS_DST_ALPHA,\n\t\t[ ConstantColorFactor ]: gl.CONSTANT_COLOR,\n\t\t[ OneMinusConstantColorFactor ]: gl.ONE_MINUS_CONSTANT_COLOR,\n\t\t[ ConstantAlphaFactor ]: gl.CONSTANT_ALPHA,\n\t\t[ OneMinusConstantAlphaFactor ]: gl.ONE_MINUS_CONSTANT_ALPHA\n\t};\n\n\tfunction setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, blendColor, blendAlpha, premultipliedAlpha ) {\n\n\t\tif ( blending === NoBlending ) {\n\n\t\t\tif ( currentBlendingEnabled === true ) {\n\n\t\t\t\tdisable( gl.BLEND );\n\t\t\t\tcurrentBlendingEnabled = false;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( currentBlendingEnabled === false ) {\n\n\t\t\tenable( gl.BLEND );\n\t\t\tcurrentBlendingEnabled = true;\n\n\t\t}\n\n\t\tif ( blending !== CustomBlending ) {\n\n\t\t\tif ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) {\n\n\t\t\t\tif ( currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation ) {\n\n\t\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\n\n\t\t\t\t\tcurrentBlendEquation = AddEquation;\n\t\t\t\t\tcurrentBlendEquationAlpha = AddEquation;\n\n\t\t\t\t}\n\n\t\t\t\tif ( premultipliedAlpha ) {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ONE, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.SRC_ALPHA, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ZERO, gl.SRC_COLOR );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tcurrentBlendSrc = null;\n\t\t\t\tcurrentBlendDst = null;\n\t\t\t\tcurrentBlendSrcAlpha = null;\n\t\t\t\tcurrentBlendDstAlpha = null;\n\t\t\t\tcurrentBlendColor.set( 0, 0, 0 );\n\t\t\t\tcurrentBlendAlpha = 0;\n\n\t\t\t\tcurrentBlending = blending;\n\t\t\t\tcurrentPremultipledAlpha = premultipliedAlpha;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// custom blending\n\n\t\tblendEquationAlpha = blendEquationAlpha || blendEquation;\n\t\tblendSrcAlpha = blendSrcAlpha || blendSrc;\n\t\tblendDstAlpha = blendDstAlpha || blendDst;\n\n\t\tif ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {\n\n\t\t\tgl.blendEquationSeparate( equationToGL[ blendEquation ], equationToGL[ blendEquationAlpha ] );\n\n\t\t\tcurrentBlendEquation = blendEquation;\n\t\t\tcurrentBlendEquationAlpha = blendEquationAlpha;\n\n\t\t}\n\n\t\tif ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {\n\n\t\t\tgl.blendFuncSeparate( factorToGL[ blendSrc ], factorToGL[ blendDst ], factorToGL[ blendSrcAlpha ], factorToGL[ blendDstAlpha ] );\n\n\t\t\tcurrentBlendSrc = blendSrc;\n\t\t\tcurrentBlendDst = blendDst;\n\t\t\tcurrentBlendSrcAlpha = blendSrcAlpha;\n\t\t\tcurrentBlendDstAlpha = blendDstAlpha;\n\n\t\t}\n\n\t\tif ( blendColor.equals( currentBlendColor ) === false || blendAlpha !== currentBlendAlpha ) {\n\n\t\t\tgl.blendColor( blendColor.r, blendColor.g, blendColor.b, blendAlpha );\n\n\t\t\tcurrentBlendColor.copy( blendColor );\n\t\t\tcurrentBlendAlpha = blendAlpha;\n\n\t\t}\n\n\t\tcurrentBlending = blending;\n\t\tcurrentPremultipledAlpha = false;\n\n\t}\n\n\tfunction setMaterial( material, frontFaceCW ) {\n\n\t\tmaterial.side === DoubleSide\n\t\t\t? disable( gl.CULL_FACE )\n\t\t\t: enable( gl.CULL_FACE );\n\n\t\tlet flipSided = ( material.side === BackSide );\n\t\tif ( frontFaceCW ) flipSided = ! flipSided;\n\n\t\tsetFlipSided( flipSided );\n\n\t\t( material.blending === NormalBlending && material.transparent === false )\n\t\t\t? setBlending( NoBlending )\n\t\t\t: setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.blendColor, material.blendAlpha, material.premultipliedAlpha );\n\n\t\tdepthBuffer.setFunc( material.depthFunc );\n\t\tdepthBuffer.setTest( material.depthTest );\n\t\tdepthBuffer.setMask( material.depthWrite );\n\t\tcolorBuffer.setMask( material.colorWrite );\n\n\t\tconst stencilWrite = material.stencilWrite;\n\t\tstencilBuffer.setTest( stencilWrite );\n\t\tif ( stencilWrite ) {\n\n\t\t\tstencilBuffer.setMask( material.stencilWriteMask );\n\t\t\tstencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilFuncMask );\n\t\t\tstencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass );\n\n\t\t}\n\n\t\tsetPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );\n\n\t\tmaterial.alphaToCoverage === true\n\t\t\t? enable( gl.SAMPLE_ALPHA_TO_COVERAGE )\n\t\t\t: disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t}\n\n\t//\n\n\tfunction setFlipSided( flipSided ) {\n\n\t\tif ( currentFlipSided !== flipSided ) {\n\n\t\t\tif ( flipSided ) {\n\n\t\t\t\tgl.frontFace( gl.CW );\n\n\t\t\t} else {\n\n\t\t\t\tgl.frontFace( gl.CCW );\n\n\t\t\t}\n\n\t\t\tcurrentFlipSided = flipSided;\n\n\t\t}\n\n\t}\n\n\tfunction setCullFace( cullFace ) {\n\n\t\tif ( cullFace !== CullFaceNone ) {\n\n\t\t\tenable( gl.CULL_FACE );\n\n\t\t\tif ( cullFace !== currentCullFace ) {\n\n\t\t\t\tif ( cullFace === CullFaceBack ) {\n\n\t\t\t\t\tgl.cullFace( gl.BACK );\n\n\t\t\t\t} else if ( cullFace === CullFaceFront ) {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT_AND_BACK );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.CULL_FACE );\n\n\t\t}\n\n\t\tcurrentCullFace = cullFace;\n\n\t}\n\n\tfunction setLineWidth( width ) {\n\n\t\tif ( width !== currentLineWidth ) {\n\n\t\t\tif ( lineWidthAvailable ) gl.lineWidth( width );\n\n\t\t\tcurrentLineWidth = width;\n\n\t\t}\n\n\t}\n\n\tfunction setPolygonOffset( polygonOffset, factor, units ) {\n\n\t\tif ( polygonOffset ) {\n\n\t\t\tenable( gl.POLYGON_OFFSET_FILL );\n\n\t\t\tif ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) {\n\n\t\t\t\tgl.polygonOffset( factor, units );\n\n\t\t\t\tcurrentPolygonOffsetFactor = factor;\n\t\t\t\tcurrentPolygonOffsetUnits = units;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.POLYGON_OFFSET_FILL );\n\n\t\t}\n\n\t}\n\n\tfunction setScissorTest( scissorTest ) {\n\n\t\tif ( scissorTest ) {\n\n\t\t\tenable( gl.SCISSOR_TEST );\n\n\t\t} else {\n\n\t\t\tdisable( gl.SCISSOR_TEST );\n\n\t\t}\n\n\t}\n\n\t// texture\n\n\tfunction activeTexture( webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\tgl.activeTexture( webglSlot );\n\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t}\n\n\t}\n\n\tfunction bindTexture( webglType, webglTexture, webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) {\n\n\t\t\tif ( currentTextureSlot === null ) {\n\n\t\t\t\twebglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\t\t} else {\n\n\t\t\t\twebglSlot = currentTextureSlot;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet boundTexture = currentBoundTextures[ webglSlot ];\n\n\t\tif ( boundTexture === undefined ) {\n\n\t\t\tboundTexture = { type: undefined, texture: undefined };\n\t\t\tcurrentBoundTextures[ webglSlot ] = boundTexture;\n\n\t\t}\n\n\t\tif ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {\n\n\t\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\t\tgl.activeTexture( webglSlot );\n\t\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t\t}\n\n\t\t\tgl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] );\n\n\t\t\tboundTexture.type = webglType;\n\t\t\tboundTexture.texture = webglTexture;\n\n\t\t}\n\n\t}\n\n\tfunction unbindTexture() {\n\n\t\tconst boundTexture = currentBoundTextures[ currentTextureSlot ];\n\n\t\tif ( boundTexture !== undefined && boundTexture.type !== undefined ) {\n\n\t\t\tgl.bindTexture( boundTexture.type, null );\n\n\t\t\tboundTexture.type = undefined;\n\t\t\tboundTexture.texture = undefined;\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction scissor( scissor ) {\n\n\t\tif ( currentScissor.equals( scissor ) === false ) {\n\n\t\t\tgl.scissor( scissor.x, scissor.y, scissor.z, scissor.w );\n\t\t\tcurrentScissor.copy( scissor );\n\n\t\t}\n\n\t}\n\n\tfunction viewport( viewport ) {\n\n\t\tif ( currentViewport.equals( viewport ) === false ) {\n\n\t\t\tgl.viewport( viewport.x, viewport.y, viewport.z, viewport.w );\n\t\t\tcurrentViewport.copy( viewport );\n\n\t\t}\n\n\t}\n\n\tfunction updateUBOMapping( uniformsGroup, program ) {\n\n\t\tlet mapping = uboProgramMap.get( program );\n\n\t\tif ( mapping === undefined ) {\n\n\t\t\tmapping = new WeakMap();\n\n\t\t\tuboProgramMap.set( program, mapping );\n\n\t\t}\n\n\t\tlet blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( blockIndex === undefined ) {\n\n\t\t\tblockIndex = gl.getUniformBlockIndex( program, uniformsGroup.name );\n\n\t\t\tmapping.set( uniformsGroup, blockIndex );\n\n\t\t}\n\n\t}\n\n\tfunction uniformBlockBinding( uniformsGroup, program ) {\n\n\t\tconst mapping = uboProgramMap.get( program );\n\t\tconst blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( uboBindings.get( program ) !== blockIndex ) {\n\n\t\t\t// bind shader specific block index to global block point\n\t\t\tgl.uniformBlockBinding( program, blockIndex, uniformsGroup.__bindingPointIndex );\n\n\t\t\tuboBindings.set( program, blockIndex );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction reset() {\n\n\t\t// reset state\n\n\t\tgl.disable( gl.BLEND );\n\t\tgl.disable( gl.CULL_FACE );\n\t\tgl.disable( gl.DEPTH_TEST );\n\t\tgl.disable( gl.POLYGON_OFFSET_FILL );\n\t\tgl.disable( gl.SCISSOR_TEST );\n\t\tgl.disable( gl.STENCIL_TEST );\n\t\tgl.disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t\tgl.blendEquation( gl.FUNC_ADD );\n\t\tgl.blendFunc( gl.ONE, gl.ZERO );\n\t\tgl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );\n\t\tgl.blendColor( 0, 0, 0, 0 );\n\n\t\tgl.colorMask( true, true, true, true );\n\t\tgl.clearColor( 0, 0, 0, 0 );\n\n\t\tgl.depthMask( true );\n\t\tgl.depthFunc( gl.LESS );\n\t\tgl.clearDepth( 1 );\n\n\t\tgl.stencilMask( 0xffffffff );\n\t\tgl.stencilFunc( gl.ALWAYS, 0, 0xffffffff );\n\t\tgl.stencilOp( gl.KEEP, gl.KEEP, gl.KEEP );\n\t\tgl.clearStencil( 0 );\n\n\t\tgl.cullFace( gl.BACK );\n\t\tgl.frontFace( gl.CCW );\n\n\t\tgl.polygonOffset( 0, 0 );\n\n\t\tgl.activeTexture( gl.TEXTURE0 );\n\n\t\tgl.bindFramebuffer( gl.FRAMEBUFFER, null );\n\t\tgl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );\n\t\tgl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );\n\n\t\tgl.useProgram( null );\n\n\t\tgl.lineWidth( 1 );\n\n\t\tgl.scissor( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tgl.viewport( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\t// reset internals\n\n\t\tenabledCapabilities = {};\n\n\t\tcurrentTextureSlot = null;\n\t\tcurrentBoundTextures = {};\n\n\t\tcurrentBoundFramebuffers = {};\n\t\tcurrentDrawbuffers = new WeakMap();\n\t\tdefaultDrawbuffers = [];\n\n\t\tcurrentProgram = null;\n\n\t\tcurrentBlendingEnabled = false;\n\t\tcurrentBlending = null;\n\t\tcurrentBlendEquation = null;\n\t\tcurrentBlendSrc = null;\n\t\tcurrentBlendDst = null;\n\t\tcurrentBlendEquationAlpha = null;\n\t\tcurrentBlendSrcAlpha = null;\n\t\tcurrentBlendDstAlpha = null;\n\t\tcurrentBlendColor = new Color( 0, 0, 0 );\n\t\tcurrentBlendAlpha = 0;\n\t\tcurrentPremultipledAlpha = false;\n\n\t\tcurrentFlipSided = null;\n\t\tcurrentCullFace = null;\n\n\t\tcurrentLineWidth = null;\n\n\t\tcurrentPolygonOffsetFactor = null;\n\t\tcurrentPolygonOffsetUnits = null;\n\n\t\tcurrentScissor.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tcurrentViewport.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\tcolorBuffer.reset();\n\t\tdepthBuffer.reset();\n\t\tstencilBuffer.reset();\n\n\t}\n\n\treturn {\n\n\t\tbuffers: {\n\t\t\tcolor: colorBuffer,\n\t\t\tdepth: depthBuffer,\n\t\t\tstencil: stencilBuffer\n\t\t},\n\n\t\tenable: enable,\n\t\tdisable: disable,\n\n\t\tbindFramebuffer: bindFramebuffer,\n\t\tdrawBuffers: drawBuffers,\n\n\t\tuseProgram: useProgram,\n\n\t\tsetBlending: setBlending,\n\t\tsetMaterial: setMaterial,\n\n\t\tsetFlipSided: setFlipSided,\n\t\tsetCullFace: setCullFace,\n\n\t\tsetLineWidth: setLineWidth,\n\t\tsetPolygonOffset: setPolygonOffset,\n\n\t\tsetScissorTest: setScissorTest,\n\n\t\tactiveTexture: activeTexture,\n\t\tbindTexture: bindTexture,\n\t\tunbindTexture: unbindTexture,\n\t\tcompressedTexImage2D: compressedTexImage2D,\n\t\tcompressedTexImage3D: compressedTexImage3D,\n\t\ttexImage2D: texImage2D,\n\t\ttexImage3D: texImage3D,\n\n\t\tupdateUBOMapping: updateUBOMapping,\n\t\tuniformBlockBinding: uniformBlockBinding,\n\n\t\ttexStorage2D: texStorage2D,\n\t\ttexStorage3D: texStorage3D,\n\t\ttexSubImage2D: texSubImage2D,\n\t\ttexSubImage3D: texSubImage3D,\n\t\tcompressedTexSubImage2D: compressedTexSubImage2D,\n\t\tcompressedTexSubImage3D: compressedTexSubImage3D,\n\n\t\tscissor: scissor,\n\t\tviewport: viewport,\n\n\t\treset: reset\n\n\t};\n\n}\n\nfunction WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {\n\n\tconst multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;\n\tconst supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );\n\n\tconst _imageDimensions = new Vector2();\n\tconst _videoTextures = new WeakMap();\n\tlet _canvas;\n\n\tconst _sources = new WeakMap(); // maps WebglTexture objects to instances of Source\n\n\t// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\n\t// also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\n\t// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\n\n\tlet useOffscreenCanvas = false;\n\n\ttry {\n\n\t\tuseOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'\n\t\t\t// eslint-disable-next-line compat/compat\n\t\t\t&& ( new OffscreenCanvas( 1, 1 ).getContext( '2d' ) ) !== null;\n\n\t} catch ( err ) {\n\n\t\t// Ignore any errors\n\n\t}\n\n\tfunction createCanvas( width, height ) {\n\n\t\t// Use OffscreenCanvas when available. Specially needed in web workers\n\n\t\treturn useOffscreenCanvas ?\n\t\t\t// eslint-disable-next-line compat/compat\n\t\t\tnew OffscreenCanvas( width, height ) : createElementNS( 'canvas' );\n\n\t}\n\n\tfunction resizeImage( image, needsNewCanvas, maxSize ) {\n\n\t\tlet scale = 1;\n\n\t\tconst dimensions = getDimensions( image );\n\n\t\t// handle case if texture exceeds max size\n\n\t\tif ( dimensions.width > maxSize || dimensions.height > maxSize ) {\n\n\t\t\tscale = maxSize / Math.max( dimensions.width, dimensions.height );\n\n\t\t}\n\n\t\t// only perform resize if necessary\n\n\t\tif ( scale < 1 ) {\n\n\t\t\t// only perform resize for certain image types\n\n\t\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ||\n\t\t\t\t( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {\n\n\t\t\t\tconst width = Math.floor( scale * dimensions.width );\n\t\t\t\tconst height = Math.floor( scale * dimensions.height );\n\n\t\t\t\tif ( _canvas === undefined ) _canvas = createCanvas( width, height );\n\n\t\t\t\t// cube textures can't reuse the same canvas\n\n\t\t\t\tconst canvas = needsNewCanvas ? createCanvas( width, height ) : _canvas;\n\n\t\t\t\tcanvas.width = width;\n\t\t\t\tcanvas.height = height;\n\n\t\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\t\tcontext.drawImage( image, 0, 0, width, height );\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + dimensions.width + 'x' + dimensions.height + ') to (' + width + 'x' + height + ').' );\n\n\t\t\t\treturn canvas;\n\n\t\t\t} else {\n\n\t\t\t\tif ( 'data' in image ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + dimensions.width + 'x' + dimensions.height + ').' );\n\n\t\t\t\t}\n\n\t\t\t\treturn image;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\tfunction textureNeedsGenerateMipmaps( texture ) {\n\n\t\treturn texture.generateMipmaps && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;\n\n\t}\n\n\tfunction generateMipmap( target ) {\n\n\t\t_gl.generateMipmap( target );\n\n\t}\n\n\tfunction getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {\n\n\t\tif ( internalFormatName !== null ) {\n\n\t\t\tif ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \\'' + internalFormatName + '\\'' );\n\n\t\t}\n\n\t\tlet internalFormat = glFormat;\n\n\t\tif ( glFormat === _gl.RED ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.R32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.R16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RED_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.R16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.R32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.R8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.R16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.R32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RG ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RG32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RG16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RG_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RG16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RG32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.RG8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.RG16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.RG32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGB ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGBA ) {\n\n\t\t\tconst transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( transfer === SRGBTransfer ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;\n\n\t\t}\n\n\t\tif ( internalFormat === _gl.R16F || internalFormat === _gl.R32F ||\n\t\t\tinternalFormat === _gl.RG16F || internalFormat === _gl.RG32F ||\n\t\t\tinternalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F ) {\n\n\t\t\textensions.get( 'EXT_color_buffer_float' );\n\n\t\t}\n\n\t\treturn internalFormat;\n\n\t}\n\n\tfunction getMipLevels( texture, image ) {\n\n\t\tif ( textureNeedsGenerateMipmaps( texture ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {\n\n\t\t\treturn Math.log2( Math.max( image.width, image.height ) ) + 1;\n\n\t\t} else if ( texture.mipmaps !== undefined && texture.mipmaps.length > 0 ) {\n\n\t\t\t// user-defined mipmaps\n\n\t\t\treturn texture.mipmaps.length;\n\n\t\t} else if ( texture.isCompressedTexture && Array.isArray( texture.image ) ) {\n\n\t\t\treturn image.mipmaps.length;\n\n\t\t} else {\n\n\t\t\t// texture without mipmaps (only base level)\n\n\t\t\treturn 1;\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tdeallocateTexture( texture );\n\n\t\tif ( texture.isVideoTexture ) {\n\n\t\t\t_videoTextures.delete( texture );\n\n\t\t}\n\n\t}\n\n\tfunction onRenderTargetDispose( event ) {\n\n\t\tconst renderTarget = event.target;\n\n\t\trenderTarget.removeEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tdeallocateRenderTarget( renderTarget );\n\n\t}\n\n\t//\n\n\tfunction deallocateTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglInit === undefined ) return;\n\n\t\t// check if it's necessary to remove the WebGLTexture object\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures ) {\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\t\t\twebglTexture.usedTimes --;\n\n\t\t\t// the WebGLTexture object is not used anymore, remove it\n\n\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\tdeleteTexture( texture );\n\n\t\t\t}\n\n\t\t\t// remove the weak map entry if no WebGLTexture uses the source anymore\n\n\t\t\tif ( Object.keys( webglTextures ).length === 0 ) {\n\n\t\t\t\t_sources.delete( source );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( texture );\n\n\t}\n\n\tfunction deleteTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\t\tdelete webglTextures[ textureProperties.__cacheKey ];\n\n\t\tinfo.memory.textures --;\n\n\t}\n\n\tfunction deallocateRenderTarget( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( renderTarget.depthTexture ) {\n\n\t\t\trenderTarget.depthTexture.dispose();\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer[ i ] ) ) {\n\n\t\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer[ i ].length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ][ level ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer ) ) {\n\n\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ level ] );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer );\n\t\t\tif ( renderTargetProperties.__webglMultisampledFramebuffer ) _gl.deleteFramebuffer( renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer ) {\n\n\t\t\t\tfor ( let i = 0; i < renderTargetProperties.__webglColorRenderbuffer.length; i ++ ) {\n\n\t\t\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer[ i ] ) _gl.deleteRenderbuffer( renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthRenderbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthRenderbuffer );\n\n\t\t}\n\n\t\tconst textures = renderTarget.textures;\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\tif ( attachmentProperties.__webglTexture ) {\n\n\t\t\t\t_gl.deleteTexture( attachmentProperties.__webglTexture );\n\n\t\t\t\tinfo.memory.textures --;\n\n\t\t\t}\n\n\t\t\tproperties.remove( textures[ i ] );\n\n\t\t}\n\n\t\tproperties.remove( renderTarget );\n\n\t}\n\n\t//\n\n\tlet textureUnits = 0;\n\n\tfunction resetTextureUnits() {\n\n\t\ttextureUnits = 0;\n\n\t}\n\n\tfunction allocateTextureUnit() {\n\n\t\tconst textureUnit = textureUnits;\n\n\t\tif ( textureUnit >= capabilities.maxTextures ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures );\n\n\t\t}\n\n\t\ttextureUnits += 1;\n\n\t\treturn textureUnit;\n\n\t}\n\n\tfunction getTextureCacheKey( texture ) {\n\n\t\tconst array = [];\n\n\t\tarray.push( texture.wrapS );\n\t\tarray.push( texture.wrapT );\n\t\tarray.push( texture.wrapR || 0 );\n\t\tarray.push( texture.magFilter );\n\t\tarray.push( texture.minFilter );\n\t\tarray.push( texture.anisotropy );\n\t\tarray.push( texture.internalFormat );\n\t\tarray.push( texture.format );\n\t\tarray.push( texture.type );\n\t\tarray.push( texture.generateMipmaps );\n\t\tarray.push( texture.premultiplyAlpha );\n\t\tarray.push( texture.flipY );\n\t\tarray.push( texture.unpackAlignment );\n\t\tarray.push( texture.colorSpace );\n\n\t\treturn array.join();\n\n\t}\n\n\t//\n\n\tfunction setTexture2D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.isVideoTexture ) updateVideoTexture( texture );\n\n\t\tif ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tconst image = texture.image;\n\n\t\t\tif ( image === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but no image data found.' );\n\n\t\t\t} else if ( image.complete === false ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete' );\n\n\t\t\t} else {\n\n\t\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture2DArray( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture3D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTextureCube( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadCubeTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tconst wrappingToGL = {\n\t\t[ RepeatWrapping ]: _gl.REPEAT,\n\t\t[ ClampToEdgeWrapping ]: _gl.CLAMP_TO_EDGE,\n\t\t[ MirroredRepeatWrapping ]: _gl.MIRRORED_REPEAT\n\t};\n\n\tconst filterToGL = {\n\t\t[ NearestFilter ]: _gl.NEAREST,\n\t\t[ NearestMipmapNearestFilter ]: _gl.NEAREST_MIPMAP_NEAREST,\n\t\t[ NearestMipmapLinearFilter ]: _gl.NEAREST_MIPMAP_LINEAR,\n\n\t\t[ LinearFilter ]: _gl.LINEAR,\n\t\t[ LinearMipmapNearestFilter ]: _gl.LINEAR_MIPMAP_NEAREST,\n\t\t[ LinearMipmapLinearFilter ]: _gl.LINEAR_MIPMAP_LINEAR\n\t};\n\n\tconst compareToGL = {\n\t\t[ NeverCompare ]: _gl.NEVER,\n\t\t[ AlwaysCompare ]: _gl.ALWAYS,\n\t\t[ LessCompare ]: _gl.LESS,\n\t\t[ LessEqualCompare ]: _gl.LEQUAL,\n\t\t[ EqualCompare ]: _gl.EQUAL,\n\t\t[ GreaterEqualCompare ]: _gl.GEQUAL,\n\t\t[ GreaterCompare ]: _gl.GREATER,\n\t\t[ NotEqualCompare ]: _gl.NOTEQUAL\n\t};\n\n\tfunction setTextureParameters( textureType, texture ) {\n\n\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&\n\t\t\t( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||\n\t\t\ttexture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter ) ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.' );\n\n\t\t}\n\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );\n\n\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );\n\n\t\t}\n\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );\n\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );\n\n\t\tif ( texture.compareFunction ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[ texture.compareFunction ] );\n\n\t\t}\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tif ( texture.magFilter === NearestFilter ) return;\n\t\t\tif ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;\n\t\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension\n\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\n\n\t\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\t\t\t\t_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );\n\t\t\t\tproperties.get( texture ).__currentAnisotropy = texture.anisotropy;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction initTexture( textureProperties, texture ) {\n\n\t\tlet forceUpload = false;\n\n\t\tif ( textureProperties.__webglInit === undefined ) {\n\n\t\t\ttextureProperties.__webglInit = true;\n\n\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t}\n\n\t\t// create Source <-> WebGLTextures mapping if necessary\n\n\t\tconst source = texture.source;\n\t\tlet webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures === undefined ) {\n\n\t\t\twebglTextures = {};\n\t\t\t_sources.set( source, webglTextures );\n\n\t\t}\n\n\t\t// check if there is already a WebGLTexture object for the given texture parameters\n\n\t\tconst textureCacheKey = getTextureCacheKey( texture );\n\n\t\tif ( textureCacheKey !== textureProperties.__cacheKey ) {\n\n\t\t\t// if not, create a new instance of WebGLTexture\n\n\t\t\tif ( webglTextures[ textureCacheKey ] === undefined ) {\n\n\t\t\t\t// create new entry\n\n\t\t\t\twebglTextures[ textureCacheKey ] = {\n\t\t\t\t\ttexture: _gl.createTexture(),\n\t\t\t\t\tusedTimes: 0\n\t\t\t\t};\n\n\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t// when a new instance of WebGLTexture was created, a texture upload is required\n\t\t\t\t// even if the image contents are identical\n\n\t\t\t\tforceUpload = true;\n\n\t\t\t}\n\n\t\t\twebglTextures[ textureCacheKey ].usedTimes ++;\n\n\t\t\t// every time the texture cache key changes, it's necessary to check if an instance of\n\t\t\t// WebGLTexture can be deleted in order to avoid a memory leak.\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\n\t\t\tif ( webglTexture !== undefined ) {\n\n\t\t\t\twebglTextures[ textureProperties.__cacheKey ].usedTimes --;\n\n\t\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\t\tdeleteTexture( texture );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// store references to cache key and WebGLTexture object\n\n\t\t\ttextureProperties.__cacheKey = textureCacheKey;\n\t\t\ttextureProperties.__webglTexture = webglTextures[ textureCacheKey ].texture;\n\n\t\t}\n\n\t\treturn forceUpload;\n\n\t}\n\n\tfunction uploadTexture( textureProperties, texture, slot ) {\n\n\t\tlet textureType = _gl.TEXTURE_2D;\n\n\t\tif ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;\n\t\tif ( texture.isData3DTexture ) textureType = _gl.TEXTURE_3D;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );\n\n\t\t\tlet image = resizeImage( texture.image, false, capabilities.maxTextureSize );\n\t\t\timage = verifyColorSpace( texture, image );\n\n\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\n\t\t\tconst glType = utils.convert( texture.type );\n\t\t\tlet glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );\n\n\t\t\tsetTextureParameters( textureType, texture );\n\n\t\t\tlet mipmap;\n\t\t\tconst mipmaps = texture.mipmaps;\n\n\t\t\tconst useTexStorage = ( texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst dataReady = source.dataReady;\n\t\t\tconst levels = getMipLevels( texture, image );\n\n\t\t\tif ( texture.isDepthTexture ) {\n\n\t\t\t\t// populate depth texture with dummy data\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT16;\n\n\t\t\t\tif ( texture.type === FloatType ) {\n\n\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t\t} else if ( texture.type === UnsignedIntType ) {\n\n\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t\t} else if ( texture.type === UnsignedInt248Type ) {\n\n\t\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\n\t\t\t\t}\n\n\t\t\t\t//\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataTexture ) {\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isCompressedTexture ) {\n\n\t\t\t\tif ( texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataArrayTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isFramebufferTexture ) {\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tlet width = image.width, height = image.height;\n\n\t\t\t\t\t\tfor ( let i = 0; i < levels; i ++ ) {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t\t\t\t\twidth >>= 1;\n\t\t\t\t\t\t\theight >>= 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// regular Texture (image, video, canvas)\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tconst dimensions = getDimensions( mipmaps[ 0 ] );\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tconst dimensions = getDimensions( image );\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\tgenerateMipmap( textureType );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\tfunction uploadCubeTexture( textureProperties, texture, slot ) {\n\n\t\tif ( texture.image.length !== 6 ) return;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );\n\n\t\t\tconst isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );\n\t\t\tconst isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );\n\n\t\t\tconst cubeImage = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( ! isCompressed && ! isDataTexture ) {\n\n\t\t\t\t\tcubeImage[ i ] = resizeImage( texture.image[ i ], true, capabilities.maxCubemapSize );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tcubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];\n\n\t\t\t\t}\n\n\t\t\t\tcubeImage[ i ] = verifyColorSpace( texture, cubeImage[ i ] );\n\n\t\t\t}\n\n\t\t\tconst image = cubeImage[ 0 ],\n\t\t\t\tglFormat = utils.convert( texture.format, texture.colorSpace ),\n\t\t\t\tglType = utils.convert( texture.type ),\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\n\t\t\tconst useTexStorage = ( texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst dataReady = source.dataReady;\n\t\t\tlet levels = getMipLevels( texture, image );\n\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );\n\n\t\t\tlet mipmaps;\n\n\t\t\tif ( isCompressed ) {\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tmipmaps = cubeImage[ i ].mipmaps;\n\n\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tmipmaps = texture.mipmaps;\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t// TODO: Uniformly handle mipmap definitions\n\t\t\t\t\t// Normal textures and compressed cube textures define base level + mips with their mipmap array\n\t\t\t\t\t// Uncompressed cube textures use their mipmap array only for mips (no base level)\n\n\t\t\t\t\tif ( mipmaps.length > 0 ) levels ++;\n\n\t\t\t\t\tconst dimensions = getDimensions( cubeImage[ 0 ] );\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, dimensions.width, dimensions.height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tif ( isDataTexture ) {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\t\t\t\t\t\t\tconst mipmapImage = mipmap.image[ i ].image;\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tif ( dataReady ) {\n\n\t\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\t// We assume images for cube map have the same size.\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\t// Render targets\n\n\t// Setup storage for target texture and bind it to correct framebuffer\n\tfunction setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget, level ) {\n\n\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\tconst glType = utils.convert( texture.type );\n\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( ! renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\tconst width = Math.max( 1, renderTarget.width >> level );\n\t\t\tconst height = Math.max( 1, renderTarget.height >> level );\n\n\t\t\tif ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\tstate.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );\n\n\t\t\t} else {\n\n\t\t\t\tstate.texImage2D( textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );\n\n\t\t} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753\n\n\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, level );\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\n\t// Setup storage for internal depth/stencil buffers and bind to correct framebuffer\n\tfunction setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\n\n\t\tif ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {\n\n\t\t\tlet glInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\tif ( isMultisample || useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tconst depthTexture = renderTarget.depthTexture;\n\n\t\t\t\tif ( depthTexture && depthTexture.isDepthTexture ) {\n\n\t\t\t\t\tif ( depthTexture.type === FloatType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t\t\t} else if ( depthTexture.type === UnsignedIntType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\n\n\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\tif ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );\n\n\t\t\t} else if ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else {\n\n\t\t\tconst textures = renderTarget.textures;\n\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\tconst texture = textures[ i ];\n\n\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\tif ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else if ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t}\n\n\t// Setup resources for a Depth Texture for a FBO (needs an extension)\n\tfunction setupDepthTexture( framebuffer, renderTarget ) {\n\n\t\tconst isCube = ( renderTarget && renderTarget.isWebGLCubeRenderTarget );\n\t\tif ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' );\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {\n\n\t\t\tthrow new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );\n\n\t\t}\n\n\t\t// upload an empty depth texture with framebuffer size\n\t\tif ( ! properties.get( renderTarget.depthTexture ).__webglTexture ||\n\t\t\t\trenderTarget.depthTexture.image.width !== renderTarget.width ||\n\t\t\t\trenderTarget.depthTexture.image.height !== renderTarget.height ) {\n\n\t\t\trenderTarget.depthTexture.image.width = renderTarget.width;\n\t\t\trenderTarget.depthTexture.image.height = renderTarget.height;\n\t\t\trenderTarget.depthTexture.needsUpdate = true;\n\n\t\t}\n\n\t\tsetTexture2D( renderTarget.depthTexture, 0 );\n\n\t\tconst webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;\n\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\tif ( renderTarget.depthTexture.format === DepthFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Unknown depthTexture format' );\n\n\t\t}\n\n\t}\n\n\t// Setup GL resources for a non-texture depth buffer\n\tfunction setupDepthRenderbuffer( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\n\t\tif ( renderTarget.depthTexture && ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\tif ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );\n\n\t\t\tsetupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );\n\n\t\t} else {\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = [];\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] );\n\t\t\t\t\trenderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget, false );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\n\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\t// rebind framebuffer with external textures\n\tfunction rebindTextures( renderTarget, colorTexture, depthTexture ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( colorTexture !== undefined ) {\n\n\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0 );\n\n\t\t}\n\n\t\tif ( depthTexture !== undefined ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\t// Set up GL resources for the render target\n\tfunction setupRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\trenderTarget.addEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tconst textures = renderTarget.textures;\n\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\t\tconst isMultipleRenderTargets = ( textures.length > 1 );\n\n\t\tif ( ! isMultipleRenderTargets ) {\n\n\t\t\tif ( textureProperties.__webglTexture === undefined ) {\n\n\t\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t}\n\n\t\t\ttextureProperties.__version = texture.version;\n\t\t\tinfo.memory.textures ++;\n\n\t\t}\n\n\t\t// Setup framebuffer\n\n\t\tif ( isCube ) {\n\n\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = [];\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ][ level ] = _gl.createFramebuffer();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ level ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\n\n\t\t\t}\n\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\t\t\tif ( attachmentProperties.__webglTexture === undefined ) {\n\n\t\t\t\t\t\tattachmentProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\trenderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\n\t\t\t\trenderTargetProperties.__webglColorRenderbuffer = [];\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tconst texture = textures[ i ];\n\t\t\t\t\trenderTargetProperties.__webglColorRenderbuffer[ i ] = _gl.createRenderbuffer();\n\n\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, renderTarget.isXRRenderTarget === true );\n\t\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\trenderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true );\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Setup color buffer\n\n\t\tif ( isCube ) {\n\n\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ][ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else if ( isMultipleRenderTargets ) {\n\n\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachment = textures[ i ];\n\t\t\t\tconst attachmentProperties = properties.get( attachment );\n\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_2D, attachment );\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );\n\n\t\t\t\tif ( textureNeedsGenerateMipmaps( attachment ) ) {\n\n\t\t\t\t\tgenerateMipmap( _gl.TEXTURE_2D );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else {\n\n\t\t\tlet glTextureType = _gl.TEXTURE_2D;\n\n\t\t\tif ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {\n\n\t\t\t\tglTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t}\n\n\t\t\tstate.bindTexture( glTextureType, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( glTextureType, texture );\n\n\t\t\tif ( texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0 );\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\tgenerateMipmap( glTextureType );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t}\n\n\t\t// Setup depth and stencil buffers\n\n\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\tfunction updateRenderTargetMipmap( renderTarget ) {\n\n\t\tconst textures = renderTarget.textures;\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst texture = textures[ i ];\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture ) ) {\n\n\t\t\t\tconst target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;\n\t\t\t\tconst webglTexture = properties.get( texture ).__webglTexture;\n\n\t\t\t\tstate.bindTexture( target, webglTexture );\n\t\t\t\tgenerateMipmap( target );\n\t\t\t\tstate.unbindTexture();\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateMultisampleRenderTarget( renderTarget ) {\n\n\t\tif ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\tconst textures = renderTarget.textures;\n\t\t\tconst width = renderTarget.width;\n\t\t\tconst height = renderTarget.height;\n\t\t\tlet mask = _gl.COLOR_BUFFER_BIT;\n\t\t\tconst invalidationArray = [];\n\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\tconst isMultipleRenderTargets = ( textures.length > 1 );\n\n\t\t\t// If MRT we need to remove FBO attachments\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\tinvalidationArray.push( _gl.COLOR_ATTACHMENT0 + i );\n\n\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\tinvalidationArray.push( depthStyle );\n\n\t\t\t\t}\n\n\t\t\t\tconst ignoreDepthValues = ( renderTargetProperties.__ignoreDepthValues !== undefined ) ? renderTargetProperties.__ignoreDepthValues : false;\n\n\t\t\t\tif ( ignoreDepthValues === false ) {\n\n\t\t\t\t\tif ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;\n\n\t\t\t\t\t// resolving stencil is slow with a D3D backend. disable it for all transmission render targets (see #27799)\n\n\t\t\t\t\tif ( renderTarget.stencilBuffer && renderTargetProperties.__isTransmissionRenderTarget !== true ) mask |= _gl.STENCIL_BUFFER_BIT;\n\n\t\t\t\t}\n\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( ignoreDepthValues === true ) {\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] );\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t}\n\n\t\t\t\t_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );\n\n\t\t\t\tif ( supportsInvalidateFramebuffer ) {\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArray );\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );\n\n\t\t\t// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t}\n\n\t}\n\n\tfunction getRenderTargetSamples( renderTarget ) {\n\n\t\treturn Math.min( capabilities.maxSamples, renderTarget.samples );\n\n\t}\n\n\tfunction useMultisampledRTT( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\treturn renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;\n\n\t}\n\n\tfunction updateVideoTexture( texture ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\t// Check the last frame we updated the VideoTexture\n\n\t\tif ( _videoTextures.get( texture ) !== frame ) {\n\n\t\t\t_videoTextures.set( texture, frame );\n\t\t\ttexture.update();\n\n\t\t}\n\n\t}\n\n\tfunction verifyColorSpace( texture, image ) {\n\n\t\tconst colorSpace = texture.colorSpace;\n\t\tconst format = texture.format;\n\t\tconst type = texture.type;\n\n\t\tif ( texture.isCompressedTexture === true || texture.isVideoTexture === true ) return image;\n\n\t\tif ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {\n\n\t\t\t// sRGB\n\n\t\t\tif ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {\n\n\t\t\t\t// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format\n\n\t\t\t\tif ( format !== RGBAFormat || type !== UnsignedByteType ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( 'THREE.WebGLTextures: Unsupported texture color space:', colorSpace );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\tfunction getDimensions( image ) {\n\n\t\tif ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) {\n\n\t\t\t// if intrinsic data are not available, fallback to width/height\n\n\t\t\t_imageDimensions.width = image.naturalWidth || image.width;\n\t\t\t_imageDimensions.height = image.naturalHeight || image.height;\n\n\t\t} else if ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) {\n\n\t\t\t_imageDimensions.width = image.displayWidth;\n\t\t\t_imageDimensions.height = image.displayHeight;\n\n\t\t} else {\n\n\t\t\t_imageDimensions.width = image.width;\n\t\t\t_imageDimensions.height = image.height;\n\n\t\t}\n\n\t\treturn _imageDimensions;\n\n\t}\n\n\t//\n\n\tthis.allocateTextureUnit = allocateTextureUnit;\n\tthis.resetTextureUnits = resetTextureUnits;\n\n\tthis.setTexture2D = setTexture2D;\n\tthis.setTexture2DArray = setTexture2DArray;\n\tthis.setTexture3D = setTexture3D;\n\tthis.setTextureCube = setTextureCube;\n\tthis.rebindTextures = rebindTextures;\n\tthis.setupRenderTarget = setupRenderTarget;\n\tthis.updateRenderTargetMipmap = updateRenderTargetMipmap;\n\tthis.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\n\tthis.setupDepthRenderbuffer = setupDepthRenderbuffer;\n\tthis.setupFrameBufferTexture = setupFrameBufferTexture;\n\tthis.useMultisampledRTT = useMultisampledRTT;\n\n}\n\nfunction WebGLUtils( gl, extensions ) {\n\n\tfunction convert( p, colorSpace = NoColorSpace ) {\n\n\t\tlet extension;\n\n\t\tconst transfer = ColorManagement.getTransfer( colorSpace );\n\n\t\tif ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;\n\t\tif ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;\n\t\tif ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;\n\t\tif ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;\n\n\t\tif ( p === ByteType ) return gl.BYTE;\n\t\tif ( p === ShortType ) return gl.SHORT;\n\t\tif ( p === UnsignedShortType ) return gl.UNSIGNED_SHORT;\n\t\tif ( p === IntType ) return gl.INT;\n\t\tif ( p === UnsignedIntType ) return gl.UNSIGNED_INT;\n\t\tif ( p === FloatType ) return gl.FLOAT;\n\t\tif ( p === HalfFloatType ) return gl.HALF_FLOAT;\n\n\t\tif ( p === AlphaFormat ) return gl.ALPHA;\n\t\tif ( p === RGBFormat ) return gl.RGB;\n\t\tif ( p === RGBAFormat ) return gl.RGBA;\n\t\tif ( p === LuminanceFormat ) return gl.LUMINANCE;\n\t\tif ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;\n\t\tif ( p === DepthFormat ) return gl.DEPTH_COMPONENT;\n\t\tif ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;\n\n\t\t// WebGL2 formats.\n\n\t\tif ( p === RedFormat ) return gl.RED;\n\t\tif ( p === RedIntegerFormat ) return gl.RED_INTEGER;\n\t\tif ( p === RGFormat ) return gl.RG;\n\t\tif ( p === RGIntegerFormat ) return gl.RG_INTEGER;\n\t\tif ( p === RGBAIntegerFormat ) return gl.RGBA_INTEGER;\n\n\t\t// S3TC\n\n\t\tif ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {\n\n\t\t\tif ( transfer === SRGBTransfer ) {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// PVRTC\n\n\t\tif ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ETC1\n\n\t\tif ( p === RGB_ETC1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc1' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.COMPRESSED_RGB_ETC1_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ETC2\n\n\t\tif ( p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n\t\t\t\tif ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ASTC\n\n\t\tif ( p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format ||\n\t\t\tp === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||\n\t\t\tp === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||\n\t\t\tp === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||\n\t\t\tp === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_astc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_ASTC_4x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x12_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// BPTC\n\n\t\tif ( p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_bptc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n\t\t\t\tif ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;\n\t\t\t\tif ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// RGTC\n\n\t\tif ( p === RED_RGTC1_Format || p === SIGNED_RED_RGTC1_Format || p === RED_GREEN_RGTC2_Format || p === SIGNED_RED_GREEN_RGTC2_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_rgtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;\n\t\t\t\tif ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( p === UnsignedInt248Type ) return gl.UNSIGNED_INT_24_8;\n\n\t\t// if \"p\" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)\n\n\t\treturn ( gl[ p ] !== undefined ) ? gl[ p ] : null;\n\n\t}\n\n\treturn { convert: convert };\n\n}\n\nclass ArrayCamera extends PerspectiveCamera {\n\n\tconstructor( array = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isArrayCamera = true;\n\n\t\tthis.cameras = array;\n\n\t}\n\n}\n\nclass Group extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isGroup = true;\n\n\t\tthis.type = 'Group';\n\n\t}\n\n}\n\nconst _moveEvent = { type: 'move' };\n\nclass WebXRController {\n\n\tconstructor() {\n\n\t\tthis._targetRay = null;\n\t\tthis._grip = null;\n\t\tthis._hand = null;\n\n\t}\n\n\tgetHandSpace() {\n\n\t\tif ( this._hand === null ) {\n\n\t\t\tthis._hand = new Group();\n\t\t\tthis._hand.matrixAutoUpdate = false;\n\t\t\tthis._hand.visible = false;\n\n\t\t\tthis._hand.joints = {};\n\t\t\tthis._hand.inputState = { pinching: false };\n\n\t\t}\n\n\t\treturn this._hand;\n\n\t}\n\n\tgetTargetRaySpace() {\n\n\t\tif ( this._targetRay === null ) {\n\n\t\t\tthis._targetRay = new Group();\n\t\t\tthis._targetRay.matrixAutoUpdate = false;\n\t\t\tthis._targetRay.visible = false;\n\t\t\tthis._targetRay.hasLinearVelocity = false;\n\t\t\tthis._targetRay.linearVelocity = new Vector3();\n\t\t\tthis._targetRay.hasAngularVelocity = false;\n\t\t\tthis._targetRay.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._targetRay;\n\n\t}\n\n\tgetGripSpace() {\n\n\t\tif ( this._grip === null ) {\n\n\t\t\tthis._grip = new Group();\n\t\t\tthis._grip.matrixAutoUpdate = false;\n\t\t\tthis._grip.visible = false;\n\t\t\tthis._grip.hasLinearVelocity = false;\n\t\t\tthis._grip.linearVelocity = new Vector3();\n\t\t\tthis._grip.hasAngularVelocity = false;\n\t\t\tthis._grip.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._grip;\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.dispatchEvent( event );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tconnect( inputSource ) {\n\n\t\tif ( inputSource && inputSource.hand ) {\n\n\t\t\tconst hand = this._hand;\n\n\t\t\tif ( hand ) {\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Initialize hand with joints when connected\n\t\t\t\t\tthis._getHandJoint( hand, inputjoint );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.dispatchEvent( { type: 'connected', data: inputSource } );\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect( inputSource ) {\n\n\t\tthis.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.visible = false;\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.visible = false;\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.visible = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tupdate( inputSource, frame, referenceSpace ) {\n\n\t\tlet inputPose = null;\n\t\tlet gripPose = null;\n\t\tlet handPose = null;\n\n\t\tconst targetRay = this._targetRay;\n\t\tconst grip = this._grip;\n\t\tconst hand = this._hand;\n\n\t\tif ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) {\n\n\t\t\tif ( hand && inputSource.hand ) {\n\n\t\t\t\thandPose = true;\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Update the joints groups with the XRJoint poses\n\t\t\t\t\tconst jointPose = frame.getJointPose( inputjoint, referenceSpace );\n\n\t\t\t\t\t// The transform of this joint will be updated with the joint pose on each frame\n\t\t\t\t\tconst joint = this._getHandJoint( hand, inputjoint );\n\n\t\t\t\t\tif ( jointPose !== null ) {\n\n\t\t\t\t\t\tjoint.matrix.fromArray( jointPose.transform.matrix );\n\t\t\t\t\t\tjoint.matrix.decompose( joint.position, joint.rotation, joint.scale );\n\t\t\t\t\t\tjoint.matrixWorldNeedsUpdate = true;\n\t\t\t\t\t\tjoint.jointRadius = jointPose.radius;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tjoint.visible = jointPose !== null;\n\n\t\t\t\t}\n\n\t\t\t\t// Custom events\n\n\t\t\t\t// Check pinchz\n\t\t\t\tconst indexTip = hand.joints[ 'index-finger-tip' ];\n\t\t\t\tconst thumbTip = hand.joints[ 'thumb-tip' ];\n\t\t\t\tconst distance = indexTip.position.distanceTo( thumbTip.position );\n\n\t\t\t\tconst distanceToPinch = 0.02;\n\t\t\t\tconst threshold = 0.005;\n\n\t\t\t\tif ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = false;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchend',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t} else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = true;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchstart',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( grip !== null && inputSource.gripSpace ) {\n\n\t\t\t\t\tgripPose = frame.getPose( inputSource.gripSpace, referenceSpace );\n\n\t\t\t\t\tif ( gripPose !== null ) {\n\n\t\t\t\t\t\tgrip.matrix.fromArray( gripPose.transform.matrix );\n\t\t\t\t\t\tgrip.matrix.decompose( grip.position, grip.rotation, grip.scale );\n\t\t\t\t\t\tgrip.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\t\tif ( gripPose.linearVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = true;\n\t\t\t\t\t\t\tgrip.linearVelocity.copy( gripPose.linearVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( gripPose.angularVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = true;\n\t\t\t\t\t\t\tgrip.angularVelocity.copy( gripPose.angularVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( targetRay !== null ) {\n\n\t\t\t\tinputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );\n\n\t\t\t\t// Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it\n\t\t\t\tif ( inputPose === null && gripPose !== null ) {\n\n\t\t\t\t\tinputPose = gripPose;\n\n\t\t\t\t}\n\n\t\t\t\tif ( inputPose !== null ) {\n\n\t\t\t\t\ttargetRay.matrix.fromArray( inputPose.transform.matrix );\n\t\t\t\t\ttargetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );\n\t\t\t\t\ttargetRay.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\tif ( inputPose.linearVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = true;\n\t\t\t\t\t\ttargetRay.linearVelocity.copy( inputPose.linearVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( inputPose.angularVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = true;\n\t\t\t\t\t\ttargetRay.angularVelocity.copy( inputPose.angularVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.dispatchEvent( _moveEvent );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t}\n\n\t\tif ( targetRay !== null ) {\n\n\t\t\ttargetRay.visible = ( inputPose !== null );\n\n\t\t}\n\n\t\tif ( grip !== null ) {\n\n\t\t\tgrip.visible = ( gripPose !== null );\n\n\t\t}\n\n\t\tif ( hand !== null ) {\n\n\t\t\thand.visible = ( handPose !== null );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// private method\n\n\t_getHandJoint( hand, inputjoint ) {\n\n\t\tif ( hand.joints[ inputjoint.jointName ] === undefined ) {\n\n\t\t\tconst joint = new Group();\n\t\t\tjoint.matrixAutoUpdate = false;\n\t\t\tjoint.visible = false;\n\t\t\thand.joints[ inputjoint.jointName ] = joint;\n\n\t\t\thand.add( joint );\n\n\t\t}\n\n\t\treturn hand.joints[ inputjoint.jointName ];\n\n\t}\n\n}\n\nconst _occlusion_vertex = `\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}`;\n\nconst _occlusion_fragment = `\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}`;\n\nclass WebXRDepthSensing {\n\n\tconstructor() {\n\n\t\tthis.texture = null;\n\t\tthis.mesh = null;\n\n\t\tthis.depthNear = 0;\n\t\tthis.depthFar = 0;\n\n\t}\n\n\tinit( renderer, depthData, renderState ) {\n\n\t\tif ( this.texture === null ) {\n\n\t\t\tconst texture = new Texture();\n\n\t\t\tconst texProps = renderer.properties.get( texture );\n\t\t\ttexProps.__webglTexture = depthData.texture;\n\n\t\t\tif ( ( depthData.depthNear != renderState.depthNear ) || ( depthData.depthFar != renderState.depthFar ) ) {\n\n\t\t\t\tthis.depthNear = depthData.depthNear;\n\t\t\t\tthis.depthFar = depthData.depthFar;\n\n\t\t\t}\n\n\t\t\tthis.texture = texture;\n\n\t\t}\n\n\t}\n\n\trender( renderer, cameraXR ) {\n\n\t\tif ( this.texture !== null ) {\n\n\t\t\tif ( this.mesh === null ) {\n\n\t\t\t\tconst viewport = cameraXR.cameras[ 0 ].viewport;\n\t\t\t\tconst material = new ShaderMaterial( {\n\t\t\t\t\tvertexShader: _occlusion_vertex,\n\t\t\t\t\tfragmentShader: _occlusion_fragment,\n\t\t\t\t\tuniforms: {\n\t\t\t\t\t\tdepthColor: { value: this.texture },\n\t\t\t\t\t\tdepthWidth: { value: viewport.z },\n\t\t\t\t\t\tdepthHeight: { value: viewport.w }\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tthis.mesh = new Mesh( new PlaneGeometry( 20, 20 ), material );\n\n\t\t\t}\n\n\t\t\trenderer.render( this.mesh, cameraXR );\n\n\t\t}\n\n\t}\n\n\treset() {\n\n\t\tthis.texture = null;\n\t\tthis.mesh = null;\n\n\t}\n\n}\n\nclass WebXRManager extends EventDispatcher {\n\n\tconstructor( renderer, gl ) {\n\n\t\tsuper();\n\n\t\tconst scope = this;\n\n\t\tlet session = null;\n\n\t\tlet framebufferScaleFactor = 1.0;\n\n\t\tlet referenceSpace = null;\n\t\tlet referenceSpaceType = 'local-floor';\n\t\t// Set default foveation to maximum.\n\t\tlet foveation = 1.0;\n\t\tlet customReferenceSpace = null;\n\n\t\tlet pose = null;\n\t\tlet glBinding = null;\n\t\tlet glProjLayer = null;\n\t\tlet glBaseLayer = null;\n\t\tlet xrFrame = null;\n\n\t\tconst depthSensing = new WebXRDepthSensing();\n\t\tconst attributes = gl.getContextAttributes();\n\n\t\tlet initialRenderTarget = null;\n\t\tlet newRenderTarget = null;\n\n\t\tconst controllers = [];\n\t\tconst controllerInputSources = [];\n\n\t\tconst currentSize = new Vector2();\n\t\tlet currentPixelRatio = null;\n\n\t\t//\n\n\t\tconst cameraL = new PerspectiveCamera();\n\t\tcameraL.layers.enable( 1 );\n\t\tcameraL.viewport = new Vector4();\n\n\t\tconst cameraR = new PerspectiveCamera();\n\t\tcameraR.layers.enable( 2 );\n\t\tcameraR.viewport = new Vector4();\n\n\t\tconst cameras = [ cameraL, cameraR ];\n\n\t\tconst cameraXR = new ArrayCamera();\n\t\tcameraXR.layers.enable( 1 );\n\t\tcameraXR.layers.enable( 2 );\n\n\t\tlet _currentDepthNear = null;\n\t\tlet _currentDepthFar = null;\n\n\t\t//\n\n\t\tthis.cameraAutoUpdate = true;\n\t\tthis.enabled = false;\n\n\t\tthis.isPresenting = false;\n\n\t\tthis.getController = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getTargetRaySpace();\n\n\t\t};\n\n\t\tthis.getControllerGrip = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getGripSpace();\n\n\t\t};\n\n\t\tthis.getHand = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getHandSpace();\n\n\t\t};\n\n\t\t//\n\n\t\tfunction onSessionEvent( event ) {\n\n\t\t\tconst controllerIndex = controllerInputSources.indexOf( event.inputSource );\n\n\t\t\tif ( controllerIndex === - 1 ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\tif ( controller !== undefined ) {\n\n\t\t\t\tcontroller.update( event.inputSource, event.frame, customReferenceSpace || referenceSpace );\n\t\t\t\tcontroller.dispatchEvent( { type: event.type, data: event.inputSource } );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onSessionEnd() {\n\n\t\t\tsession.removeEventListener( 'select', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectstart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeeze', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezestart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezeend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'end', onSessionEnd );\n\t\t\tsession.removeEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\n\t\t\t\tif ( inputSource === null ) continue;\n\n\t\t\t\tcontrollerInputSources[ i ] = null;\n\n\t\t\t\tcontrollers[ i ].disconnect( inputSource );\n\n\t\t\t}\n\n\t\t\t_currentDepthNear = null;\n\t\t\t_currentDepthFar = null;\n\n\t\t\tdepthSensing.reset();\n\n\t\t\t// restore framebuffer/rendering state\n\n\t\t\trenderer.setRenderTarget( initialRenderTarget );\n\n\t\t\tglBaseLayer = null;\n\t\t\tglProjLayer = null;\n\t\t\tglBinding = null;\n\t\t\tsession = null;\n\t\t\tnewRenderTarget = null;\n\n\t\t\t//\n\n\t\t\tanimation.stop();\n\n\t\t\tscope.isPresenting = false;\n\n\t\t\trenderer.setPixelRatio( currentPixelRatio );\n\t\t\trenderer.setSize( currentSize.width, currentSize.height, false );\n\n\t\t\tscope.dispatchEvent( { type: 'sessionend' } );\n\n\t\t}\n\n\t\tthis.setFramebufferScaleFactor = function ( value ) {\n\n\t\t\tframebufferScaleFactor = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change framebuffer scale while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setReferenceSpaceType = function ( value ) {\n\n\t\t\treferenceSpaceType = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change reference space type while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getReferenceSpace = function () {\n\n\t\t\treturn customReferenceSpace || referenceSpace;\n\n\t\t};\n\n\t\tthis.setReferenceSpace = function ( space ) {\n\n\t\t\tcustomReferenceSpace = space;\n\n\t\t};\n\n\t\tthis.getBaseLayer = function () {\n\n\t\t\treturn glProjLayer !== null ? glProjLayer : glBaseLayer;\n\n\t\t};\n\n\t\tthis.getBinding = function () {\n\n\t\t\treturn glBinding;\n\n\t\t};\n\n\t\tthis.getFrame = function () {\n\n\t\t\treturn xrFrame;\n\n\t\t};\n\n\t\tthis.getSession = function () {\n\n\t\t\treturn session;\n\n\t\t};\n\n\t\tthis.setSession = async function ( value ) {\n\n\t\t\tsession = value;\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\tinitialRenderTarget = renderer.getRenderTarget();\n\n\t\t\t\tsession.addEventListener( 'select', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectstart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeeze', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezestart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezeend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'end', onSessionEnd );\n\t\t\t\tsession.addEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\t\tif ( attributes.xrCompatible !== true ) {\n\n\t\t\t\t\tawait gl.makeXRCompatible();\n\n\t\t\t\t}\n\n\t\t\t\tcurrentPixelRatio = renderer.getPixelRatio();\n\t\t\t\trenderer.getSize( currentSize );\n\n\t\t\t\tif ( session.renderState.layers === undefined ) {\n\n\t\t\t\t\tconst layerInit = {\n\t\t\t\t\t\tantialias: attributes.antialias,\n\t\t\t\t\t\talpha: true,\n\t\t\t\t\t\tdepth: attributes.depth,\n\t\t\t\t\t\tstencil: attributes.stencil,\n\t\t\t\t\t\tframebufferScaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBaseLayer = new XRWebGLLayer( session, gl, layerInit );\n\n\t\t\t\t\tsession.updateRenderState( { baseLayer: glBaseLayer } );\n\n\t\t\t\t\trenderer.setPixelRatio( 1 );\n\t\t\t\t\trenderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglBaseLayer.framebufferWidth,\n\t\t\t\t\t\tglBaseLayer.framebufferHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\tlet depthFormat = null;\n\t\t\t\t\tlet depthType = null;\n\t\t\t\t\tlet glDepthFormat = null;\n\n\t\t\t\t\tif ( attributes.depth ) {\n\n\t\t\t\t\t\tglDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\n\t\t\t\t\t\tdepthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;\n\t\t\t\t\t\tdepthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst projectionlayerInit = {\n\t\t\t\t\t\tcolorFormat: gl.RGBA8,\n\t\t\t\t\t\tdepthFormat: glDepthFormat,\n\t\t\t\t\t\tscaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBinding = new XRWebGLBinding( session, gl );\n\n\t\t\t\t\tglProjLayer = glBinding.createProjectionLayer( projectionlayerInit );\n\n\t\t\t\t\tsession.updateRenderState( { layers: [ glProjLayer ] } );\n\n\t\t\t\t\trenderer.setPixelRatio( 1 );\n\t\t\t\t\trenderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglProjLayer.textureWidth,\n\t\t\t\t\t\tglProjLayer.textureHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tdepthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tsamples: attributes.antialias ? 4 : 0\n\t\t\t\t\t\t} );\n\n\t\t\t\t\tconst renderTargetProperties = renderer.properties.get( newRenderTarget );\n\t\t\t\t\trenderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;\n\n\t\t\t\t}\n\n\t\t\t\tnewRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278\n\n\t\t\t\tthis.setFoveation( foveation );\n\n\t\t\t\tcustomReferenceSpace = null;\n\t\t\t\treferenceSpace = await session.requestReferenceSpace( referenceSpaceType );\n\n\t\t\t\tanimation.setContext( session );\n\t\t\t\tanimation.start();\n\n\t\t\t\tscope.isPresenting = true;\n\n\t\t\t\tscope.dispatchEvent( { type: 'sessionstart' } );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getEnvironmentBlendMode = function () {\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\treturn session.environmentBlendMode;\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction onInputSourcesChange( event ) {\n\n\t\t\t// Notify disconnected\n\n\t\t\tfor ( let i = 0; i < event.removed.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.removed[ i ];\n\t\t\t\tconst index = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( index >= 0 ) {\n\n\t\t\t\t\tcontrollerInputSources[ index ] = null;\n\t\t\t\t\tcontrollers[ index ].disconnect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Notify connected\n\n\t\t\tfor ( let i = 0; i < event.added.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.added[ i ];\n\n\t\t\t\tlet controllerIndex = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( controllerIndex === - 1 ) {\n\n\t\t\t\t\t// Assign input source a controller that currently has no input source\n\n\t\t\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\t\t\tif ( i >= controllerInputSources.length ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources.push( inputSource );\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t} else if ( controllerInputSources[ i ] === null ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources[ i ] = inputSource;\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// If all controllers do currently receive input we ignore new ones\n\n\t\t\t\t\tif ( controllerIndex === - 1 ) break;\n\n\t\t\t\t}\n\n\t\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\t\tif ( controller ) {\n\n\t\t\t\t\tcontroller.connect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst cameraLPos = new Vector3();\n\t\tconst cameraRPos = new Vector3();\n\n\t\t/**\n\t\t * Assumes 2 cameras that are parallel and share an X-axis, and that\n\t\t * the cameras' projection and world matrices have already been set.\n\t\t * And that near and far planes are identical for both cameras.\n\t\t * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\n\t\t */\n\t\tfunction setProjectionFromUnion( camera, cameraL, cameraR ) {\n\n\t\t\tcameraLPos.setFromMatrixPosition( cameraL.matrixWorld );\n\t\t\tcameraRPos.setFromMatrixPosition( cameraR.matrixWorld );\n\n\t\t\tconst ipd = cameraLPos.distanceTo( cameraRPos );\n\n\t\t\tconst projL = cameraL.projectionMatrix.elements;\n\t\t\tconst projR = cameraR.projectionMatrix.elements;\n\n\t\t\t// VR systems will have identical far and near planes, and\n\t\t\t// most likely identical top and bottom frustum extents.\n\t\t\t// Use the left camera for these values.\n\t\t\tconst near = projL[ 14 ] / ( projL[ 10 ] - 1 );\n\t\t\tconst far = projL[ 14 ] / ( projL[ 10 ] + 1 );\n\t\t\tconst topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];\n\t\t\tconst bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];\n\n\t\t\tconst leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];\n\t\t\tconst rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];\n\t\t\tconst left = near * leftFov;\n\t\t\tconst right = near * rightFov;\n\n\t\t\t// Calculate the new camera's position offset from the\n\t\t\t// left camera. xOffset should be roughly half `ipd`.\n\t\t\tconst zOffset = ipd / ( - leftFov + rightFov );\n\t\t\tconst xOffset = zOffset * - leftFov;\n\n\t\t\t// TODO: Better way to apply this offset?\n\t\t\tcameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.translateX( xOffset );\n\t\t\tcamera.translateZ( zOffset );\n\t\t\tcamera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t\t// Find the union of the frustum values of the cameras and scale\n\t\t\t// the values so that the near plane's position does not change in world space,\n\t\t\t// although must now be relative to the new union camera.\n\t\t\tconst near2 = near + zOffset;\n\t\t\tconst far2 = far + zOffset;\n\t\t\tconst left2 = left - xOffset;\n\t\t\tconst right2 = right + ( ipd - xOffset );\n\t\t\tconst top2 = topFov * far / far2 * near2;\n\t\t\tconst bottom2 = bottomFov * far / far2 * near2;\n\n\t\t\tcamera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );\n\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\n\t\t}\n\n\t\tfunction updateCamera( camera, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrixWorld.copy( camera.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrixWorld.multiplyMatrices( parent.matrixWorld, camera.matrix );\n\n\t\t\t}\n\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t}\n\n\t\tthis.updateCamera = function ( camera ) {\n\n\t\t\tif ( session === null ) return;\n\n\t\t\tif ( depthSensing.texture !== null ) {\n\n\t\t\t\tcamera.near = depthSensing.depthNear;\n\t\t\t\tcamera.far = depthSensing.depthFar;\n\n\t\t\t}\n\n\t\t\tcameraXR.near = cameraR.near = cameraL.near = camera.near;\n\t\t\tcameraXR.far = cameraR.far = cameraL.far = camera.far;\n\n\t\t\tif ( _currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far ) {\n\n\t\t\t\t// Note that the new renderState won't apply until the next frame. See #18320\n\n\t\t\t\tsession.updateRenderState( {\n\t\t\t\t\tdepthNear: cameraXR.near,\n\t\t\t\t\tdepthFar: cameraXR.far\n\t\t\t\t} );\n\n\t\t\t\t_currentDepthNear = cameraXR.near;\n\t\t\t\t_currentDepthFar = cameraXR.far;\n\n\t\t\t\tcameraL.near = _currentDepthNear;\n\t\t\t\tcameraL.far = _currentDepthFar;\n\t\t\t\tcameraR.near = _currentDepthNear;\n\t\t\t\tcameraR.far = _currentDepthFar;\n\n\t\t\t\tcameraL.updateProjectionMatrix();\n\t\t\t\tcameraR.updateProjectionMatrix();\n\t\t\t\tcamera.updateProjectionMatrix();\n\n\t\t\t}\n\n\t\t\tconst parent = camera.parent;\n\t\t\tconst cameras = cameraXR.cameras;\n\n\t\t\tupdateCamera( cameraXR, parent );\n\n\t\t\tfor ( let i = 0; i < cameras.length; i ++ ) {\n\n\t\t\t\tupdateCamera( cameras[ i ], parent );\n\n\t\t\t}\n\n\t\t\t// update projection matrix for proper view frustum culling\n\n\t\t\tif ( cameras.length === 2 ) {\n\n\t\t\t\tsetProjectionFromUnion( cameraXR, cameraL, cameraR );\n\n\t\t\t} else {\n\n\t\t\t\t// assume single camera setup (AR)\n\n\t\t\t\tcameraXR.projectionMatrix.copy( cameraL.projectionMatrix );\n\n\t\t\t}\n\n\t\t\t// update user camera and its children\n\n\t\t\tupdateUserCamera( camera, cameraXR, parent );\n\n\t\t};\n\n\t\tfunction updateUserCamera( camera, cameraXR, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrix.copy( cameraXR.matrixWorld );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrix.copy( parent.matrixWorld );\n\t\t\t\tcamera.matrix.invert();\n\t\t\t\tcamera.matrix.multiply( cameraXR.matrixWorld );\n\n\t\t\t}\n\n\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.updateMatrixWorld( true );\n\n\t\t\tcamera.projectionMatrix.copy( cameraXR.projectionMatrix );\n\t\t\tcamera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );\n\n\t\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\t\tcamera.fov = RAD2DEG * 2 * Math.atan( 1 / camera.projectionMatrix.elements[ 5 ] );\n\t\t\t\tcamera.zoom = 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.getCamera = function () {\n\n\t\t\treturn cameraXR;\n\n\t\t};\n\n\t\tthis.getFoveation = function () {\n\n\t\t\tif ( glProjLayer === null && glBaseLayer === null ) {\n\n\t\t\t\treturn undefined;\n\n\t\t\t}\n\n\t\t\treturn foveation;\n\n\t\t};\n\n\t\tthis.setFoveation = function ( value ) {\n\n\t\t\t// 0 = no foveation = full resolution\n\t\t\t// 1 = maximum foveation = the edges render at lower resolution\n\n\t\t\tfoveation = value;\n\n\t\t\tif ( glProjLayer !== null ) {\n\n\t\t\t\tglProjLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t\tif ( glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined ) {\n\n\t\t\t\tglBaseLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.hasDepthSensing = function () {\n\n\t\t\treturn depthSensing.texture !== null;\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time, frame ) {\n\n\t\t\tpose = frame.getViewerPose( customReferenceSpace || referenceSpace );\n\t\t\txrFrame = frame;\n\n\t\t\tif ( pose !== null ) {\n\n\t\t\t\tconst views = pose.views;\n\n\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\trenderer.setRenderTargetFramebuffer( newRenderTarget, glBaseLayer.framebuffer );\n\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t}\n\n\t\t\t\tlet cameraXRNeedsUpdate = false;\n\n\t\t\t\t// check if it's necessary to rebuild cameraXR's camera list\n\n\t\t\t\tif ( views.length !== cameraXR.cameras.length ) {\n\n\t\t\t\t\tcameraXR.cameras.length = 0;\n\t\t\t\t\tcameraXRNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < views.length; i ++ ) {\n\n\t\t\t\t\tconst view = views[ i ];\n\n\t\t\t\t\tlet viewport = null;\n\n\t\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\t\tviewport = glBaseLayer.getViewport( view );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst glSubImage = glBinding.getViewSubImage( glProjLayer, view );\n\t\t\t\t\t\tviewport = glSubImage.viewport;\n\n\t\t\t\t\t\t// For side-by-side projection, we only produce a single texture for both eyes.\n\t\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\t\trenderer.setRenderTargetTextures(\n\t\t\t\t\t\t\t\tnewRenderTarget,\n\t\t\t\t\t\t\t\tglSubImage.colorTexture,\n\t\t\t\t\t\t\t\tglProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture );\n\n\t\t\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlet camera = cameras[ i ];\n\n\t\t\t\t\tif ( camera === undefined ) {\n\n\t\t\t\t\t\tcamera = new PerspectiveCamera();\n\t\t\t\t\t\tcamera.layers.enable( i );\n\t\t\t\t\t\tcamera.viewport = new Vector4();\n\t\t\t\t\t\tcameras[ i ] = camera;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcamera.matrix.fromArray( view.transform.matrix );\n\t\t\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\t\t\tcamera.projectionMatrix.fromArray( view.projectionMatrix );\n\t\t\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\t\t\t\t\tcamera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );\n\n\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\tcameraXR.matrix.copy( camera.matrix );\n\t\t\t\t\t\tcameraXR.matrix.decompose( cameraXR.position, cameraXR.quaternion, cameraXR.scale );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( cameraXRNeedsUpdate === true ) {\n\n\t\t\t\t\t\tcameraXR.cameras.push( camera );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t//\n\n\t\t\t\tconst enabledFeatures = session.enabledFeatures;\n\n\t\t\t\tif ( enabledFeatures && enabledFeatures.includes( 'depth-sensing' ) ) {\n\n\t\t\t\t\tconst depthData = glBinding.getDepthInformation( views[ 0 ] );\n\n\t\t\t\t\tif ( depthData && depthData.isValid && depthData.texture ) {\n\n\t\t\t\t\t\tdepthSensing.init( renderer, depthData, session.renderState );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\t\t\t\tconst controller = controllers[ i ];\n\n\t\t\t\tif ( inputSource !== null && controller !== undefined ) {\n\n\t\t\t\t\tcontroller.update( inputSource, frame, customReferenceSpace || referenceSpace );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tdepthSensing.render( renderer, cameraXR );\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );\n\n\t\t\tif ( frame.detectedPlanes ) {\n\n\t\t\t\tscope.dispatchEvent( { type: 'planesdetected', data: frame } );\n\n\t\t\t}\n\n\t\t\txrFrame = null;\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\n\t\t};\n\n\t\tthis.dispose = function () {};\n\n\t}\n\n}\n\nconst _e1 = /*@__PURE__*/ new Euler();\nconst _m1 = /*@__PURE__*/ new Matrix4();\n\nfunction WebGLMaterials( renderer, properties ) {\n\n\tfunction refreshTransformUniform( map, uniform ) {\n\n\t\tif ( map.matrixAutoUpdate === true ) {\n\n\t\t\tmap.updateMatrix();\n\n\t\t}\n\n\t\tuniform.value.copy( map.matrix );\n\n\t}\n\n\tfunction refreshFogUniforms( uniforms, fog ) {\n\n\t\tfog.color.getRGB( uniforms.fogColor.value, getUnlitUniformColorSpace( renderer ) );\n\n\t\tif ( fog.isFog ) {\n\n\t\t\tuniforms.fogNear.value = fog.near;\n\t\t\tuniforms.fogFar.value = fog.far;\n\n\t\t} else if ( fog.isFogExp2 ) {\n\n\t\t\tuniforms.fogDensity.value = fog.density;\n\n\t\t}\n\n\t}\n\n\tfunction refreshMaterialUniforms( uniforms, material, pixelRatio, height, transmissionRenderTarget ) {\n\n\t\tif ( material.isMeshBasicMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshLambertMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshToonMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsToon( uniforms, material );\n\n\t\t} else if ( material.isMeshPhongMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsPhong( uniforms, material );\n\n\t\t} else if ( material.isMeshStandardMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsStandard( uniforms, material );\n\n\t\t\tif ( material.isMeshPhysicalMaterial ) {\n\n\t\t\t\trefreshUniformsPhysical( uniforms, material, transmissionRenderTarget );\n\n\t\t\t}\n\n\t\t} else if ( material.isMeshMatcapMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsMatcap( uniforms, material );\n\n\t\t} else if ( material.isMeshDepthMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshDistanceMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsDistance( uniforms, material );\n\n\t\t} else if ( material.isMeshNormalMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isLineBasicMaterial ) {\n\n\t\t\trefreshUniformsLine( uniforms, material );\n\n\t\t\tif ( material.isLineDashedMaterial ) {\n\n\t\t\t\trefreshUniformsDash( uniforms, material );\n\n\t\t\t}\n\n\t\t} else if ( material.isPointsMaterial ) {\n\n\t\t\trefreshUniformsPoints( uniforms, material, pixelRatio, height );\n\n\t\t} else if ( material.isSpriteMaterial ) {\n\n\t\t\trefreshUniformsSprites( uniforms, material );\n\n\t\t} else if ( material.isShadowMaterial ) {\n\n\t\t\tuniforms.color.value.copy( material.color );\n\t\t\tuniforms.opacity.value = material.opacity;\n\n\t\t} else if ( material.isShaderMaterial ) {\n\n\t\t\tmaterial.uniformsNeedUpdate = false; // #15581\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsCommon( uniforms, material ) {\n\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.color ) {\n\n\t\t\tuniforms.diffuse.value.copy( material.color );\n\n\t\t}\n\n\t\tif ( material.emissive ) {\n\n\t\t\tuniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity );\n\n\t\t}\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\n\t\t\trefreshTransformUniform( material.bumpMap, uniforms.bumpMapTransform );\n\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.bumpScale.value *= - 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\n\t\t\trefreshTransformUniform( material.normalMap, uniforms.normalMapTransform );\n\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.normalScale.value.negate();\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\n\t\t\trefreshTransformUniform( material.displacementMap, uniforms.displacementMapTransform );\n\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t\trefreshTransformUniform( material.emissiveMap, uniforms.emissiveMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularMap ) {\n\n\t\t\tuniforms.specularMap.value = material.specularMap;\n\n\t\t\trefreshTransformUniform( material.specularMap, uniforms.specularMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tconst envMap = materialProperties.envMap;\n\t\tconst envMapRotation = materialProperties.envMapRotation;\n\n\t\tif ( envMap ) {\n\n\t\t\tuniforms.envMap.value = envMap;\n\n\t\t\t_e1.copy( envMapRotation );\n\n\t\t\t// accommodate left-handed frame\n\t\t\t_e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;\n\n\t\t\tif ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {\n\n\t\t\t\t// environment maps which are not cube render targets or PMREMs follow a different convention\n\t\t\t\t_e1.y *= - 1;\n\t\t\t\t_e1.z *= - 1;\n\n\t\t\t}\n\n\t\t\tuniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );\n\n\t\t\tuniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\tuniforms.reflectivity.value = material.reflectivity;\n\t\t\tuniforms.ior.value = material.ior;\n\t\t\tuniforms.refractionRatio.value = material.refractionRatio;\n\n\t\t}\n\n\t\tif ( material.lightMap ) {\n\n\t\t\tuniforms.lightMap.value = material.lightMap;\n\n\t\t\t// artist-friendly light intensity scaling factor\n\t\t\tconst scaleFactor = ( renderer._useLegacyLights === true ) ? Math.PI : 1;\n\n\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor;\n\n\t\t\trefreshTransformUniform( material.lightMap, uniforms.lightMapTransform );\n\n\t\t}\n\n\t\tif ( material.aoMap ) {\n\n\t\t\tuniforms.aoMap.value = material.aoMap;\n\t\t\tuniforms.aoMapIntensity.value = material.aoMapIntensity;\n\n\t\t\trefreshTransformUniform( material.aoMap, uniforms.aoMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsLine( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDash( uniforms, material ) {\n\n\t\tuniforms.dashSize.value = material.dashSize;\n\t\tuniforms.totalSize.value = material.dashSize + material.gapSize;\n\t\tuniforms.scale.value = material.scale;\n\n\t}\n\n\tfunction refreshUniformsPoints( uniforms, material, pixelRatio, height ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.size.value = material.size * pixelRatio;\n\t\tuniforms.scale.value = height * 0.5;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.uvTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsSprites( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.rotation.value = material.rotation;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhong( uniforms, material ) {\n\n\t\tuniforms.specular.value.copy( material.specular );\n\t\tuniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )\n\n\t}\n\n\tfunction refreshUniformsToon( uniforms, material ) {\n\n\t\tif ( material.gradientMap ) {\n\n\t\t\tuniforms.gradientMap.value = material.gradientMap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsStandard( uniforms, material ) {\n\n\t\tuniforms.metalness.value = material.metalness;\n\n\t\tif ( material.metalnessMap ) {\n\n\t\t\tuniforms.metalnessMap.value = material.metalnessMap;\n\n\t\t\trefreshTransformUniform( material.metalnessMap, uniforms.metalnessMapTransform );\n\n\t\t}\n\n\t\tuniforms.roughness.value = material.roughness;\n\n\t\tif ( material.roughnessMap ) {\n\n\t\t\tuniforms.roughnessMap.value = material.roughnessMap;\n\n\t\t\trefreshTransformUniform( material.roughnessMap, uniforms.roughnessMapTransform );\n\n\t\t}\n\n\t\tif ( material.envMap ) {\n\n\t\t\t//uniforms.envMap.value = material.envMap; // part of uniforms common\n\n\t\t\tuniforms.envMapIntensity.value = material.envMapIntensity;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhysical( uniforms, material, transmissionRenderTarget ) {\n\n\t\tuniforms.ior.value = material.ior; // also part of uniforms common\n\n\t\tif ( material.sheen > 0 ) {\n\n\t\t\tuniforms.sheenColor.value.copy( material.sheenColor ).multiplyScalar( material.sheen );\n\n\t\t\tuniforms.sheenRoughness.value = material.sheenRoughness;\n\n\t\t\tif ( material.sheenColorMap ) {\n\n\t\t\t\tuniforms.sheenColorMap.value = material.sheenColorMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenColorMap, uniforms.sheenColorMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.sheenRoughnessMap ) {\n\n\t\t\t\tuniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.clearcoat > 0 ) {\n\n\t\t\tuniforms.clearcoat.value = material.clearcoat;\n\t\t\tuniforms.clearcoatRoughness.value = material.clearcoatRoughness;\n\n\t\t\tif ( material.clearcoatMap ) {\n\n\t\t\t\tuniforms.clearcoatMap.value = material.clearcoatMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatMap, uniforms.clearcoatMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatRoughnessMap ) {\n\n\t\t\t\tuniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatNormalMap ) {\n\n\t\t\t\tuniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform );\n\n\t\t\t\tuniforms.clearcoatNormalScale.value.copy( material.clearcoatNormalScale );\n\n\t\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\t\tuniforms.clearcoatNormalScale.value.negate();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.iridescence > 0 ) {\n\n\t\t\tuniforms.iridescence.value = material.iridescence;\n\t\t\tuniforms.iridescenceIOR.value = material.iridescenceIOR;\n\t\t\tuniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[ 0 ];\n\t\t\tuniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[ 1 ];\n\n\t\t\tif ( material.iridescenceMap ) {\n\n\t\t\t\tuniforms.iridescenceMap.value = material.iridescenceMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceMap, uniforms.iridescenceMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.iridescenceThicknessMap ) {\n\n\t\t\t\tuniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.transmission > 0 ) {\n\n\t\t\tuniforms.transmission.value = material.transmission;\n\t\t\tuniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;\n\t\t\tuniforms.transmissionSamplerSize.value.set( transmissionRenderTarget.width, transmissionRenderTarget.height );\n\n\t\t\tif ( material.transmissionMap ) {\n\n\t\t\t\tuniforms.transmissionMap.value = material.transmissionMap;\n\n\t\t\t\trefreshTransformUniform( material.transmissionMap, uniforms.transmissionMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.thickness.value = material.thickness;\n\n\t\t\tif ( material.thicknessMap ) {\n\n\t\t\t\tuniforms.thicknessMap.value = material.thicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.thicknessMap, uniforms.thicknessMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.attenuationDistance.value = material.attenuationDistance;\n\t\t\tuniforms.attenuationColor.value.copy( material.attenuationColor );\n\n\t\t}\n\n\t\tif ( material.anisotropy > 0 ) {\n\n\t\t\tuniforms.anisotropyVector.value.set( material.anisotropy * Math.cos( material.anisotropyRotation ), material.anisotropy * Math.sin( material.anisotropyRotation ) );\n\n\t\t\tif ( material.anisotropyMap ) {\n\n\t\t\t\tuniforms.anisotropyMap.value = material.anisotropyMap;\n\n\t\t\t\trefreshTransformUniform( material.anisotropyMap, uniforms.anisotropyMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tuniforms.specularIntensity.value = material.specularIntensity;\n\t\tuniforms.specularColor.value.copy( material.specularColor );\n\n\t\tif ( material.specularColorMap ) {\n\n\t\t\tuniforms.specularColorMap.value = material.specularColorMap;\n\n\t\t\trefreshTransformUniform( material.specularColorMap, uniforms.specularColorMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularIntensityMap ) {\n\n\t\t\tuniforms.specularIntensityMap.value = material.specularIntensityMap;\n\n\t\t\trefreshTransformUniform( material.specularIntensityMap, uniforms.specularIntensityMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsMatcap( uniforms, material ) {\n\n\t\tif ( material.matcap ) {\n\n\t\t\tuniforms.matcap.value = material.matcap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDistance( uniforms, material ) {\n\n\t\tconst light = properties.get( material ).light;\n\n\t\tuniforms.referencePosition.value.setFromMatrixPosition( light.matrixWorld );\n\t\tuniforms.nearDistance.value = light.shadow.camera.near;\n\t\tuniforms.farDistance.value = light.shadow.camera.far;\n\n\t}\n\n\treturn {\n\t\trefreshFogUniforms: refreshFogUniforms,\n\t\trefreshMaterialUniforms: refreshMaterialUniforms\n\t};\n\n}\n\nfunction WebGLUniformsGroups( gl, info, capabilities, state ) {\n\n\tlet buffers = {};\n\tlet updateList = {};\n\tlet allocatedBindingPoints = [];\n\n\tconst maxBindingPoints = gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ); // binding points are global whereas block indices are per shader program\n\n\tfunction bind( uniformsGroup, program ) {\n\n\t\tconst webglProgram = program.program;\n\t\tstate.uniformBlockBinding( uniformsGroup, webglProgram );\n\n\t}\n\n\tfunction update( uniformsGroup, program ) {\n\n\t\tlet buffer = buffers[ uniformsGroup.id ];\n\n\t\tif ( buffer === undefined ) {\n\n\t\t\tprepareUniformsGroup( uniformsGroup );\n\n\t\t\tbuffer = createBuffer( uniformsGroup );\n\t\t\tbuffers[ uniformsGroup.id ] = buffer;\n\n\t\t\tuniformsGroup.addEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\t}\n\n\t\t// ensure to update the binding points/block indices mapping for this program\n\n\t\tconst webglProgram = program.program;\n\t\tstate.updateUBOMapping( uniformsGroup, webglProgram );\n\n\t\t// update UBO once per frame\n\n\t\tconst frame = info.render.frame;\n\n\t\tif ( updateList[ uniformsGroup.id ] !== frame ) {\n\n\t\t\tupdateBufferData( uniformsGroup );\n\n\t\t\tupdateList[ uniformsGroup.id ] = frame;\n\n\t\t}\n\n\t}\n\n\tfunction createBuffer( uniformsGroup ) {\n\n\t\t// the setup of an UBO is independent of a particular shader program but global\n\n\t\tconst bindingPointIndex = allocateBindingPointIndex();\n\t\tuniformsGroup.__bindingPointIndex = bindingPointIndex;\n\n\t\tconst buffer = gl.createBuffer();\n\t\tconst size = uniformsGroup.__size;\n\t\tconst usage = uniformsGroup.usage;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\t\tgl.bufferData( gl.UNIFORM_BUFFER, size, usage );\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\t\tgl.bindBufferBase( gl.UNIFORM_BUFFER, bindingPointIndex, buffer );\n\n\t\treturn buffer;\n\n\t}\n\n\tfunction allocateBindingPointIndex() {\n\n\t\tfor ( let i = 0; i < maxBindingPoints; i ++ ) {\n\n\t\t\tif ( allocatedBindingPoints.indexOf( i ) === - 1 ) {\n\n\t\t\t\tallocatedBindingPoints.push( i );\n\t\t\t\treturn i;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconsole.error( 'THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );\n\n\t\treturn 0;\n\n\t}\n\n\tfunction updateBufferData( uniformsGroup ) {\n\n\t\tconst buffer = buffers[ uniformsGroup.id ];\n\t\tconst uniforms = uniformsGroup.uniforms;\n\t\tconst cache = uniformsGroup.__cache;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\n\t\tfor ( let i = 0, il = uniforms.length; i < il; i ++ ) {\n\n\t\t\tconst uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\n\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\n\n\t\t\t\tconst uniform = uniformArray[ j ];\n\n\t\t\t\tif ( hasUniformChanged( uniform, i, j, cache ) === true ) {\n\n\t\t\t\t\tconst offset = uniform.__offset;\n\n\t\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\t\tlet arrayOffset = 0;\n\n\t\t\t\t\tfor ( let k = 0; k < values.length; k ++ ) {\n\n\t\t\t\t\t\tconst value = values[ k ];\n\n\t\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\t\t// TODO add integer and struct support\n\t\t\t\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value;\n\t\t\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );\n\n\t\t\t\t\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t\t\t\t\t// manually converting 3x3 to 3x4\n\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value.elements[ 0 ];\n\t\t\t\t\t\t\tuniform.__data[ 1 ] = value.elements[ 1 ];\n\t\t\t\t\t\t\tuniform.__data[ 2 ] = value.elements[ 2 ];\n\t\t\t\t\t\t\tuniform.__data[ 3 ] = 0;\n\t\t\t\t\t\t\tuniform.__data[ 4 ] = value.elements[ 3 ];\n\t\t\t\t\t\t\tuniform.__data[ 5 ] = value.elements[ 4 ];\n\t\t\t\t\t\t\tuniform.__data[ 6 ] = value.elements[ 5 ];\n\t\t\t\t\t\t\tuniform.__data[ 7 ] = 0;\n\t\t\t\t\t\t\tuniform.__data[ 8 ] = value.elements[ 6 ];\n\t\t\t\t\t\t\tuniform.__data[ 9 ] = value.elements[ 7 ];\n\t\t\t\t\t\t\tuniform.__data[ 10 ] = value.elements[ 8 ];\n\t\t\t\t\t\t\tuniform.__data[ 11 ] = 0;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tvalue.toArray( uniform.__data, arrayOffset );\n\n\t\t\t\t\t\t\tarrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\n\t}\n\n\tfunction hasUniformChanged( uniform, index, indexArray, cache ) {\n\n\t\tconst value = uniform.value;\n\t\tconst indexString = index + '_' + indexArray;\n\n\t\tif ( cache[ indexString ] === undefined ) {\n\n\t\t\t// cache entry does not exist so far\n\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\tcache[ indexString ] = value;\n\n\t\t\t} else {\n\n\t\t\t\tcache[ indexString ] = value.clone();\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\tconst cachedObject = cache[ indexString ];\n\n\t\t\t// compare current value with cached entry\n\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\tif ( cachedObject !== value ) {\n\n\t\t\t\t\tcache[ indexString ] = value;\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( cachedObject.equals( value ) === false ) {\n\n\t\t\t\t\tcachedObject.copy( value );\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction prepareUniformsGroup( uniformsGroup ) {\n\n\t\t// determine total buffer size according to the STD140 layout\n\t\t// Hint: STD140 is the only supported layout in WebGL 2\n\n\t\tconst uniforms = uniformsGroup.uniforms;\n\n\t\tlet offset = 0; // global buffer offset in bytes\n\t\tconst chunkSize = 16; // size of a chunk in bytes\n\n\t\tfor ( let i = 0, l = uniforms.length; i < l; i ++ ) {\n\n\t\t\tconst uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\n\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\n\n\t\t\t\tconst uniform = uniformArray[ j ];\n\n\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\tfor ( let k = 0, kl = values.length; k < kl; k ++ ) {\n\n\t\t\t\t\tconst value = values[ k ];\n\n\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\t// Calculate the chunk offset\n\t\t\t\t\tconst chunkOffsetUniform = offset % chunkSize;\n\n\t\t\t\t\t// Check for chunk overflow\n\t\t\t\t\tif ( chunkOffsetUniform !== 0 && ( chunkSize - chunkOffsetUniform ) < info.boundary ) {\n\n\t\t\t\t\t\t// Add padding and adjust offset\n\t\t\t\t\t\toffset += ( chunkSize - chunkOffsetUniform );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following two properties will be used for partial buffer updates\n\n\t\t\t\t\tuniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );\n\t\t\t\t\tuniform.__offset = offset;\n\n\n\t\t\t\t\t// Update the global offset\n\t\t\t\t\toffset += info.storage;\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ensure correct final padding\n\n\t\tconst chunkOffset = offset % chunkSize;\n\n\t\tif ( chunkOffset > 0 ) offset += ( chunkSize - chunkOffset );\n\n\t\t//\n\n\t\tuniformsGroup.__size = offset;\n\t\tuniformsGroup.__cache = {};\n\n\t\treturn this;\n\n\t}\n\n\tfunction getUniformSize( value ) {\n\n\t\tconst info = {\n\t\t\tboundary: 0, // bytes\n\t\t\tstorage: 0 // bytes\n\t\t};\n\n\t\t// determine sizes according to STD140\n\n\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t// float/int/bool\n\n\t\t\tinfo.boundary = 4;\n\t\t\tinfo.storage = 4;\n\n\t\t} else if ( value.isVector2 ) {\n\n\t\t\t// vec2\n\n\t\t\tinfo.boundary = 8;\n\t\t\tinfo.storage = 8;\n\n\t\t} else if ( value.isVector3 || value.isColor ) {\n\n\t\t\t// vec3\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes\n\n\t\t} else if ( value.isVector4 ) {\n\n\t\t\t// vec4\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 16;\n\n\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t// mat3 (in STD140 a 3x3 matrix is represented as 3x4)\n\n\t\t\tinfo.boundary = 48;\n\t\t\tinfo.storage = 48;\n\n\t\t} else if ( value.isMatrix4 ) {\n\n\t\t\t// mat4\n\n\t\t\tinfo.boundary = 64;\n\t\t\tinfo.storage = 64;\n\n\t\t} else if ( value.isTexture ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.' );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unsupported uniform value type.', value );\n\n\t\t}\n\n\t\treturn info;\n\n\t}\n\n\tfunction onUniformsGroupsDispose( event ) {\n\n\t\tconst uniformsGroup = event.target;\n\n\t\tuniformsGroup.removeEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\tconst index = allocatedBindingPoints.indexOf( uniformsGroup.__bindingPointIndex );\n\t\tallocatedBindingPoints.splice( index, 1 );\n\n\t\tgl.deleteBuffer( buffers[ uniformsGroup.id ] );\n\n\t\tdelete buffers[ uniformsGroup.id ];\n\t\tdelete updateList[ uniformsGroup.id ];\n\n\t}\n\n\tfunction dispose() {\n\n\t\tfor ( const id in buffers ) {\n\n\t\t\tgl.deleteBuffer( buffers[ id ] );\n\n\t\t}\n\n\t\tallocatedBindingPoints = [];\n\t\tbuffers = {};\n\t\tupdateList = {};\n\n\t}\n\n\treturn {\n\n\t\tbind: bind,\n\t\tupdate: update,\n\n\t\tdispose: dispose\n\n\t};\n\n}\n\nclass WebGLRenderer {\n\n\tconstructor( parameters = {} ) {\n\n\t\tconst {\n\t\t\tcanvas = createCanvasElement(),\n\t\t\tcontext = null,\n\t\t\tdepth = true,\n\t\t\tstencil = false,\n\t\t\talpha = false,\n\t\t\tantialias = false,\n\t\t\tpremultipliedAlpha = true,\n\t\t\tpreserveDrawingBuffer = false,\n\t\t\tpowerPreference = 'default',\n\t\t\tfailIfMajorPerformanceCaveat = false,\n\t\t} = parameters;\n\n\t\tthis.isWebGLRenderer = true;\n\n\t\tlet _alpha;\n\n\t\tif ( context !== null ) {\n\n\t\t\tif ( typeof WebGLRenderingContext !== 'undefined' && context instanceof WebGLRenderingContext ) {\n\n\t\t\t\tthrow new Error( 'THREE.WebGLRenderer: WebGL 1 is not supported since r163.' );\n\n\t\t\t}\n\n\t\t\t_alpha = context.getContextAttributes().alpha;\n\n\t\t} else {\n\n\t\t\t_alpha = alpha;\n\n\t\t}\n\n\t\tconst uintClearColor = new Uint32Array( 4 );\n\t\tconst intClearColor = new Int32Array( 4 );\n\n\t\tlet currentRenderList = null;\n\t\tlet currentRenderState = null;\n\n\t\t// render() can be called from within a callback triggered by another render.\n\t\t// We track this so that the nested render call gets its list and state isolated from the parent render call.\n\n\t\tconst renderListStack = [];\n\t\tconst renderStateStack = [];\n\n\t\t// public properties\n\n\t\tthis.domElement = canvas;\n\n\t\t// Debug configuration container\n\t\tthis.debug = {\n\n\t\t\t/**\n\t\t\t * Enables error checking and reporting when shader programs are being compiled\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tcheckShaderErrors: true,\n\t\t\t/**\n\t\t\t * Callback for custom error reporting.\n\t\t\t * @type {?Function}\n\t\t\t */\n\t\t\tonShaderError: null\n\t\t};\n\n\t\t// clearing\n\n\t\tthis.autoClear = true;\n\t\tthis.autoClearColor = true;\n\t\tthis.autoClearDepth = true;\n\t\tthis.autoClearStencil = true;\n\n\t\t// scene graph\n\n\t\tthis.sortObjects = true;\n\n\t\t// user-defined clipping\n\n\t\tthis.clippingPlanes = [];\n\t\tthis.localClippingEnabled = false;\n\n\t\t// physically based shading\n\n\t\tthis._outputColorSpace = SRGBColorSpace;\n\n\t\t// physical lights\n\n\t\tthis._useLegacyLights = false;\n\n\t\t// tone mapping\n\n\t\tthis.toneMapping = NoToneMapping;\n\t\tthis.toneMappingExposure = 1.0;\n\n\t\t// internal properties\n\n\t\tconst _this = this;\n\n\t\tlet _isContextLost = false;\n\n\t\t// internal state cache\n\n\t\tlet _currentActiveCubeFace = 0;\n\t\tlet _currentActiveMipmapLevel = 0;\n\t\tlet _currentRenderTarget = null;\n\t\tlet _currentMaterialId = - 1;\n\n\t\tlet _currentCamera = null;\n\n\t\tconst _currentViewport = new Vector4();\n\t\tconst _currentScissor = new Vector4();\n\t\tlet _currentScissorTest = null;\n\n\t\tconst _currentClearColor = new Color( 0x000000 );\n\t\tlet _currentClearAlpha = 0;\n\n\t\t//\n\n\t\tlet _width = canvas.width;\n\t\tlet _height = canvas.height;\n\n\t\tlet _pixelRatio = 1;\n\t\tlet _opaqueSort = null;\n\t\tlet _transparentSort = null;\n\n\t\tconst _viewport = new Vector4( 0, 0, _width, _height );\n\t\tconst _scissor = new Vector4( 0, 0, _width, _height );\n\t\tlet _scissorTest = false;\n\n\t\t// frustum\n\n\t\tconst _frustum = new Frustum();\n\n\t\t// clipping\n\n\t\tlet _clippingEnabled = false;\n\t\tlet _localClippingEnabled = false;\n\n\t\t// camera matrices cache\n\n\t\tconst _projScreenMatrix = new Matrix4();\n\n\t\tconst _vector2 = new Vector2();\n\t\tconst _vector3 = new Vector3();\n\n\t\tconst _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };\n\n\t\tfunction getTargetPixelRatio() {\n\n\t\t\treturn _currentRenderTarget === null ? _pixelRatio : 1;\n\n\t\t}\n\n\t\t// initialize\n\n\t\tlet _gl = context;\n\n\t\tfunction getContext( contextName, contextAttributes ) {\n\n\t\t\tconst context = canvas.getContext( contextName, contextAttributes );\n\t\t\tif ( context !== null ) return context;\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\ttry {\n\n\t\t\tconst contextAttributes = {\n\t\t\t\talpha: true,\n\t\t\t\tdepth,\n\t\t\t\tstencil,\n\t\t\t\tantialias,\n\t\t\t\tpremultipliedAlpha,\n\t\t\t\tpreserveDrawingBuffer,\n\t\t\t\tpowerPreference,\n\t\t\t\tfailIfMajorPerformanceCaveat,\n\t\t\t};\n\n\t\t\t// OffscreenCanvas does not have setAttribute, see #22811\n\t\t\tif ( 'setAttribute' in canvas ) canvas.setAttribute( 'data-engine', `three.js r${REVISION}` );\n\n\t\t\t// event listeners must be registered before WebGL context is created, see #12753\n\t\t\tcanvas.addEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.addEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.addEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\tif ( _gl === null ) {\n\n\t\t\t\tconst contextName = 'webgl2';\n\n\t\t\t\t_gl = getContext( contextName, contextAttributes );\n\n\t\t\t\tif ( _gl === null ) {\n\n\t\t\t\t\tif ( getContext( contextName ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context with your selected attributes.' );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer: ' + error.message );\n\t\t\tthrow error;\n\n\t\t}\n\n\t\tlet extensions, capabilities, state, info;\n\t\tlet properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;\n\t\tlet programCache, materials, renderLists, renderStates, clipping, shadowMap;\n\n\t\tlet background, morphtargets, bufferRenderer, indexedBufferRenderer;\n\n\t\tlet utils, bindingStates, uniformsGroups;\n\n\t\tfunction initGLContext() {\n\n\t\t\textensions = new WebGLExtensions( _gl );\n\t\t\textensions.init();\n\n\t\t\tcapabilities = new WebGLCapabilities( _gl, extensions, parameters );\n\n\t\t\tutils = new WebGLUtils( _gl, extensions );\n\n\t\t\tstate = new WebGLState( _gl );\n\n\t\t\tinfo = new WebGLInfo( _gl );\n\t\t\tproperties = new WebGLProperties();\n\t\t\ttextures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );\n\t\t\tcubemaps = new WebGLCubeMaps( _this );\n\t\t\tcubeuvmaps = new WebGLCubeUVMaps( _this );\n\t\t\tattributes = new WebGLAttributes( _gl );\n\t\t\tbindingStates = new WebGLBindingStates( _gl, attributes );\n\t\t\tgeometries = new WebGLGeometries( _gl, attributes, info, bindingStates );\n\t\t\tobjects = new WebGLObjects( _gl, geometries, attributes, info );\n\t\t\tmorphtargets = new WebGLMorphtargets( _gl, capabilities, textures );\n\t\t\tclipping = new WebGLClipping( properties );\n\t\t\tprogramCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );\n\t\t\tmaterials = new WebGLMaterials( _this, properties );\n\t\t\trenderLists = new WebGLRenderLists();\n\t\t\trenderStates = new WebGLRenderStates( extensions );\n\t\t\tbackground = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );\n\t\t\tshadowMap = new WebGLShadowMap( _this, objects, capabilities );\n\t\t\tuniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );\n\n\t\t\tbufferRenderer = new WebGLBufferRenderer( _gl, extensions, info );\n\t\t\tindexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info );\n\n\t\t\tinfo.programs = programCache.programs;\n\n\t\t\t_this.capabilities = capabilities;\n\t\t\t_this.extensions = extensions;\n\t\t\t_this.properties = properties;\n\t\t\t_this.renderLists = renderLists;\n\t\t\t_this.shadowMap = shadowMap;\n\t\t\t_this.state = state;\n\t\t\t_this.info = info;\n\n\t\t}\n\n\t\tinitGLContext();\n\n\t\t// xr\n\n\t\tconst xr = new WebXRManager( _this, _gl );\n\n\t\tthis.xr = xr;\n\n\t\t// API\n\n\t\tthis.getContext = function () {\n\n\t\t\treturn _gl;\n\n\t\t};\n\n\t\tthis.getContextAttributes = function () {\n\n\t\t\treturn _gl.getContextAttributes();\n\n\t\t};\n\n\t\tthis.forceContextLoss = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.loseContext();\n\n\t\t};\n\n\t\tthis.forceContextRestore = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.restoreContext();\n\n\t\t};\n\n\t\tthis.getPixelRatio = function () {\n\n\t\t\treturn _pixelRatio;\n\n\t\t};\n\n\t\tthis.setPixelRatio = function ( value ) {\n\n\t\t\tif ( value === undefined ) return;\n\n\t\t\t_pixelRatio = value;\n\n\t\t\tthis.setSize( _width, _height, false );\n\n\t\t};\n\n\t\tthis.getSize = function ( target ) {\n\n\t\t\treturn target.set( _width, _height );\n\n\t\t};\n\n\t\tthis.setSize = function ( width, height, updateStyle = true ) {\n\n\t\t\tif ( xr.isPresenting ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Can\\'t change size while VR device is presenting.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\tcanvas.width = Math.floor( width * _pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * _pixelRatio );\n\n\t\t\tif ( updateStyle === true ) {\n\n\t\t\t\tcanvas.style.width = width + 'px';\n\t\t\t\tcanvas.style.height = height + 'px';\n\n\t\t\t}\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\tthis.getDrawingBufferSize = function ( target ) {\n\n\t\t\treturn target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();\n\n\t\t};\n\n\t\tthis.setDrawingBufferSize = function ( width, height, pixelRatio ) {\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\t_pixelRatio = pixelRatio;\n\n\t\t\tcanvas.width = Math.floor( width * pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * pixelRatio );\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\tthis.getCurrentViewport = function ( target ) {\n\n\t\t\treturn target.copy( _currentViewport );\n\n\t\t};\n\n\t\tthis.getViewport = function ( target ) {\n\n\t\t\treturn target.copy( _viewport );\n\n\t\t};\n\n\t\tthis.setViewport = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_viewport.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_viewport.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).round() );\n\n\t\t};\n\n\t\tthis.getScissor = function ( target ) {\n\n\t\t\treturn target.copy( _scissor );\n\n\t\t};\n\n\t\tthis.setScissor = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_scissor.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_scissor.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).round() );\n\n\t\t};\n\n\t\tthis.getScissorTest = function () {\n\n\t\t\treturn _scissorTest;\n\n\t\t};\n\n\t\tthis.setScissorTest = function ( boolean ) {\n\n\t\t\tstate.setScissorTest( _scissorTest = boolean );\n\n\t\t};\n\n\t\tthis.setOpaqueSort = function ( method ) {\n\n\t\t\t_opaqueSort = method;\n\n\t\t};\n\n\t\tthis.setTransparentSort = function ( method ) {\n\n\t\t\t_transparentSort = method;\n\n\t\t};\n\n\t\t// Clearing\n\n\t\tthis.getClearColor = function ( target ) {\n\n\t\t\treturn target.copy( background.getClearColor() );\n\n\t\t};\n\n\t\tthis.setClearColor = function () {\n\n\t\t\tbackground.setClearColor.apply( background, arguments );\n\n\t\t};\n\n\t\tthis.getClearAlpha = function () {\n\n\t\t\treturn background.getClearAlpha();\n\n\t\t};\n\n\t\tthis.setClearAlpha = function () {\n\n\t\t\tbackground.setClearAlpha.apply( background, arguments );\n\n\t\t};\n\n\t\tthis.clear = function ( color = true, depth = true, stencil = true ) {\n\n\t\t\tlet bits = 0;\n\n\t\t\tif ( color ) {\n\n\t\t\t\t// check if we're trying to clear an integer target\n\t\t\t\tlet isIntegerFormat = false;\n\t\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t\tconst targetFormat = _currentRenderTarget.texture.format;\n\t\t\t\t\tisIntegerFormat = targetFormat === RGBAIntegerFormat ||\n\t\t\t\t\t\ttargetFormat === RGIntegerFormat ||\n\t\t\t\t\t\ttargetFormat === RedIntegerFormat;\n\n\t\t\t\t}\n\n\t\t\t\t// use the appropriate clear functions to clear the target if it's a signed\n\t\t\t\t// or unsigned integer target\n\t\t\t\tif ( isIntegerFormat ) {\n\n\t\t\t\t\tconst targetType = _currentRenderTarget.texture.type;\n\t\t\t\t\tconst isUnsignedType = targetType === UnsignedByteType ||\n\t\t\t\t\t\ttargetType === UnsignedIntType ||\n\t\t\t\t\t\ttargetType === UnsignedShortType ||\n\t\t\t\t\t\ttargetType === UnsignedInt248Type ||\n\t\t\t\t\t\ttargetType === UnsignedShort4444Type ||\n\t\t\t\t\t\ttargetType === UnsignedShort5551Type;\n\n\t\t\t\t\tconst clearColor = background.getClearColor();\n\t\t\t\t\tconst a = background.getClearAlpha();\n\t\t\t\t\tconst r = clearColor.r;\n\t\t\t\t\tconst g = clearColor.g;\n\t\t\t\t\tconst b = clearColor.b;\n\n\t\t\t\t\tif ( isUnsignedType ) {\n\n\t\t\t\t\t\tuintClearColor[ 0 ] = r;\n\t\t\t\t\t\tuintClearColor[ 1 ] = g;\n\t\t\t\t\t\tuintClearColor[ 2 ] = b;\n\t\t\t\t\t\tuintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferuiv( _gl.COLOR, 0, uintClearColor );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tintClearColor[ 0 ] = r;\n\t\t\t\t\t\tintClearColor[ 1 ] = g;\n\t\t\t\t\t\tintClearColor[ 2 ] = b;\n\t\t\t\t\t\tintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferiv( _gl.COLOR, 0, intClearColor );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbits |= _gl.COLOR_BUFFER_BIT;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( depth ) bits |= _gl.DEPTH_BUFFER_BIT;\n\t\t\tif ( stencil ) {\n\n\t\t\t\tbits |= _gl.STENCIL_BUFFER_BIT;\n\t\t\t\tthis.state.buffers.stencil.setMask( 0xffffffff );\n\n\t\t\t}\n\n\t\t\t_gl.clear( bits );\n\n\t\t};\n\n\t\tthis.clearColor = function () {\n\n\t\t\tthis.clear( true, false, false );\n\n\t\t};\n\n\t\tthis.clearDepth = function () {\n\n\t\t\tthis.clear( false, true, false );\n\n\t\t};\n\n\t\tthis.clearStencil = function () {\n\n\t\t\tthis.clear( false, false, true );\n\n\t\t};\n\n\t\t//\n\n\t\tthis.dispose = function () {\n\n\t\t\tcanvas.removeEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\trenderLists.dispose();\n\t\t\trenderStates.dispose();\n\t\t\tproperties.dispose();\n\t\t\tcubemaps.dispose();\n\t\t\tcubeuvmaps.dispose();\n\t\t\tobjects.dispose();\n\t\t\tbindingStates.dispose();\n\t\t\tuniformsGroups.dispose();\n\t\t\tprogramCache.dispose();\n\n\t\t\txr.dispose();\n\n\t\t\txr.removeEventListener( 'sessionstart', onXRSessionStart );\n\t\t\txr.removeEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t\tanimation.stop();\n\n\t\t};\n\n\t\t// Events\n\n\t\tfunction onContextLost( event ) {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Lost.' );\n\n\t\t\t_isContextLost = true;\n\n\t\t}\n\n\t\tfunction onContextRestore( /* event */ ) {\n\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Restored.' );\n\n\t\t\t_isContextLost = false;\n\n\t\t\tconst infoAutoReset = info.autoReset;\n\t\t\tconst shadowMapEnabled = shadowMap.enabled;\n\t\t\tconst shadowMapAutoUpdate = shadowMap.autoUpdate;\n\t\t\tconst shadowMapNeedsUpdate = shadowMap.needsUpdate;\n\t\t\tconst shadowMapType = shadowMap.type;\n\n\t\t\tinitGLContext();\n\n\t\t\tinfo.autoReset = infoAutoReset;\n\t\t\tshadowMap.enabled = shadowMapEnabled;\n\t\t\tshadowMap.autoUpdate = shadowMapAutoUpdate;\n\t\t\tshadowMap.needsUpdate = shadowMapNeedsUpdate;\n\t\t\tshadowMap.type = shadowMapType;\n\n\t\t}\n\n\t\tfunction onContextCreationError( event ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage );\n\n\t\t}\n\n\t\tfunction onMaterialDispose( event ) {\n\n\t\t\tconst material = event.target;\n\n\t\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t\tdeallocateMaterial( material );\n\n\t\t}\n\n\t\t// Buffer deallocation\n\n\t\tfunction deallocateMaterial( material ) {\n\n\t\t\treleaseMaterialProgramReferences( material );\n\n\t\t\tproperties.remove( material );\n\n\t\t}\n\n\n\t\tfunction releaseMaterialProgramReferences( material ) {\n\n\t\t\tconst programs = properties.get( material ).programs;\n\n\t\t\tif ( programs !== undefined ) {\n\n\t\t\t\tprograms.forEach( function ( program ) {\n\n\t\t\t\t\tprogramCache.releaseProgram( program );\n\n\t\t\t\t} );\n\n\t\t\t\tif ( material.isShaderMaterial ) {\n\n\t\t\t\t\tprogramCache.releaseShaderCache( material );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Buffer rendering\n\n\t\tthis.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) {\n\n\t\t\tif ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)\n\n\t\t\tconst frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );\n\n\t\t\tconst program = setProgram( camera, scene, geometry, material, object );\n\n\t\t\tstate.setMaterial( material, frontFaceCW );\n\n\t\t\t//\n\n\t\t\tlet index = geometry.index;\n\t\t\tlet rangeFactor = 1;\n\n\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\tindex = geometries.getWireframeAttribute( geometry );\n\n\t\t\t\tif ( index === undefined ) return;\n\n\t\t\t\trangeFactor = 2;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tconst drawRange = geometry.drawRange;\n\t\t\tconst position = geometry.attributes.position;\n\n\t\t\tlet drawStart = drawRange.start * rangeFactor;\n\t\t\tlet drawEnd = ( drawRange.start + drawRange.count ) * rangeFactor;\n\n\t\t\tif ( group !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, group.start * rangeFactor );\n\t\t\t\tdrawEnd = Math.min( drawEnd, ( group.start + group.count ) * rangeFactor );\n\n\t\t\t}\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, index.count );\n\n\t\t\t} else if ( position !== undefined && position !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, position.count );\n\n\t\t\t}\n\n\t\t\tconst drawCount = drawEnd - drawStart;\n\n\t\t\tif ( drawCount < 0 || drawCount === Infinity ) return;\n\n\t\t\t//\n\n\t\t\tbindingStates.setup( object, material, program, geometry, index );\n\n\t\t\tlet attribute;\n\t\t\tlet renderer = bufferRenderer;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tattribute = attributes.get( index );\n\n\t\t\t\trenderer = indexedBufferRenderer;\n\t\t\t\trenderer.setIndex( attribute );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( object.isMesh ) {\n\n\t\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\t\tstate.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isLine ) {\n\n\t\t\t\tlet lineWidth = material.linewidth;\n\n\t\t\t\tif ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material\n\n\t\t\t\tstate.setLineWidth( lineWidth * getTargetPixelRatio() );\n\n\t\t\t\tif ( object.isLineSegments ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else if ( object.isLineLoop ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_LOOP );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_STRIP );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isPoints ) {\n\n\t\t\t\trenderer.setMode( _gl.POINTS );\n\n\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t}\n\n\t\t\tif ( object.isBatchedMesh ) {\n\n\t\t\t\trenderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );\n\n\t\t\t} else if ( object.isInstancedMesh ) {\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, object.count );\n\n\t\t\t} else if ( geometry.isInstancedBufferGeometry ) {\n\n\t\t\t\tconst maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;\n\t\t\t\tconst instanceCount = Math.min( geometry.instanceCount, maxInstanceCount );\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, instanceCount );\n\n\t\t\t} else {\n\n\t\t\t\trenderer.render( drawStart, drawCount );\n\n\t\t\t}\n\n\t\t};\n\n\t\t// Compile\n\n\t\tfunction prepareMaterial( material, scene, object ) {\n\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\tmaterial.side = BackSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.compile = function ( scene, camera, targetScene = null ) {\n\n\t\t\tif ( targetScene === null ) targetScene = scene;\n\n\t\t\tcurrentRenderState = renderStates.get( targetScene );\n\t\t\tcurrentRenderState.init();\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t// gather lights from both the target scene and the new object that will be added to the scene.\n\n\t\t\ttargetScene.traverseVisible( function ( object ) {\n\n\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\tif ( scene !== targetScene ) {\n\n\t\t\t\tscene.traverseVisible( function ( object ) {\n\n\t\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\tcurrentRenderState.setupLights( _this._useLegacyLights );\n\n\t\t\t// Only initialize materials in the new scene, not the targetScene.\n\n\t\t\tconst materials = new Set();\n\n\t\t\tscene.traverse( function ( object ) {\n\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( material ) {\n\n\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\tfor ( let i = 0; i < material.length; i ++ ) {\n\n\t\t\t\t\t\t\tconst material2 = material[ i ];\n\n\t\t\t\t\t\t\tprepareMaterial( material2, targetScene, object );\n\t\t\t\t\t\t\tmaterials.add( material2 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tprepareMaterial( material, targetScene, object );\n\t\t\t\t\t\tmaterials.add( material );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\trenderStateStack.pop();\n\t\t\tcurrentRenderState = null;\n\n\t\t\treturn materials;\n\n\t\t};\n\n\t\t// compileAsync\n\n\t\tthis.compileAsync = function ( scene, camera, targetScene = null ) {\n\n\t\t\tconst materials = this.compile( scene, camera, targetScene );\n\n\t\t\t// Wait for all the materials in the new object to indicate that they're\n\t\t\t// ready to be used before resolving the promise.\n\n\t\t\treturn new Promise( ( resolve ) => {\n\n\t\t\t\tfunction checkMaterialsReady() {\n\n\t\t\t\t\tmaterials.forEach( function ( material ) {\n\n\t\t\t\t\t\tconst materialProperties = properties.get( material );\n\t\t\t\t\t\tconst program = materialProperties.currentProgram;\n\n\t\t\t\t\t\tif ( program.isReady() ) {\n\n\t\t\t\t\t\t\t// remove any programs that report they're ready to use from the list\n\t\t\t\t\t\t\tmaterials.delete( material );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\t// once the list of compiling materials is empty, call the callback\n\n\t\t\t\t\tif ( materials.size === 0 ) {\n\n\t\t\t\t\t\tresolve( scene );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if some materials are still not ready, wait a bit and check again\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( extensions.get( 'KHR_parallel_shader_compile' ) !== null ) {\n\n\t\t\t\t\t// If we can check the compilation status of the materials without\n\t\t\t\t\t// blocking then do so right away.\n\n\t\t\t\t\tcheckMaterialsReady();\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Otherwise start by waiting a bit to give the materials we just\n\t\t\t\t\t// initialized a chance to finish.\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time ) {\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time );\n\n\t\t}\n\n\t\tfunction onXRSessionStart() {\n\n\t\t\tanimation.stop();\n\n\t\t}\n\n\t\tfunction onXRSessionEnd() {\n\n\t\t\tanimation.start();\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tif ( typeof self !== 'undefined' ) animation.setContext( self );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\t\t\txr.setAnimationLoop( callback );\n\n\t\t\t( callback === null ) ? animation.stop() : animation.start();\n\n\t\t};\n\n\t\txr.addEventListener( 'sessionstart', onXRSessionStart );\n\t\txr.addEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t// Rendering\n\n\t\tthis.render = function ( scene, camera ) {\n\n\t\t\tif ( camera !== undefined && camera.isCamera !== true ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( _isContextLost === true ) return;\n\n\t\t\t// update scene graph\n\n\t\t\tif ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();\n\n\t\t\t// update camera matrices and frustum\n\n\t\t\tif ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();\n\n\t\t\tif ( xr.enabled === true && xr.isPresenting === true ) {\n\n\t\t\t\tif ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );\n\n\t\t\t\tcamera = xr.getCamera(); // use XR camera for rendering\n\n\t\t\t}\n\n\t\t\t//\n\t\t\tif ( scene.isScene === true ) scene.onBeforeRender( _this, scene, camera, _currentRenderTarget );\n\n\t\t\tcurrentRenderState = renderStates.get( scene, renderStateStack.length );\n\t\t\tcurrentRenderState.init();\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\t\t_frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t\t\t_localClippingEnabled = this.localClippingEnabled;\n\t\t\t_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled );\n\n\t\t\tcurrentRenderList = renderLists.get( scene, renderListStack.length );\n\t\t\tcurrentRenderList.init();\n\n\t\t\trenderListStack.push( currentRenderList );\n\n\t\t\tprojectObject( scene, camera, 0, _this.sortObjects );\n\n\t\t\tcurrentRenderList.finish();\n\n\t\t\tif ( _this.sortObjects === true ) {\n\n\t\t\t\tcurrentRenderList.sort( _opaqueSort, _transparentSort );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tthis.info.render.frame ++;\n\n\t\t\tif ( _clippingEnabled === true ) clipping.beginShadows();\n\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tshadowMap.render( shadowsArray, scene, camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.endShadows();\n\n\t\t\t//\n\n\t\t\tif ( this.info.autoReset === true ) this.info.reset();\n\n\n\t\t\t//\n\n\t\t\tif ( xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false ) {\n\n\t\t\t\tbackground.render( currentRenderList, scene );\n\n\t\t\t}\n\n\t\t\t// render scene\n\n\t\t\tcurrentRenderState.setupLights( _this._useLegacyLights );\n\n\t\t\tif ( camera.isArrayCamera ) {\n\n\t\t\t\tconst cameras = camera.cameras;\n\n\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst camera2 = cameras[ i ];\n\n\t\t\t\t\trenderScene( currentRenderList, scene, camera2, camera2.viewport );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\trenderScene( currentRenderList, scene, camera );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t// resolve multisample renderbuffers to a single-sample texture if necessary\n\n\t\t\t\ttextures.updateMultisampleRenderTarget( _currentRenderTarget );\n\n\t\t\t\t// Generate mipmap if we're using any kind of mipmap filtering\n\n\t\t\t\ttextures.updateRenderTargetMipmap( _currentRenderTarget );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );\n\n\t\t\t// _gl.finish();\n\n\t\t\tbindingStates.resetDefaultState();\n\t\t\t_currentMaterialId = - 1;\n\t\t\t_currentCamera = null;\n\n\t\t\trenderStateStack.pop();\n\n\t\t\tif ( renderStateStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderState = renderStateStack[ renderStateStack.length - 1 ];\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderState = null;\n\n\t\t\t}\n\n\t\t\trenderListStack.pop();\n\n\t\t\tif ( renderListStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderList = renderListStack[ renderListStack.length - 1 ];\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderList = null;\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction projectObject( object, camera, groupOrder, sortObjects ) {\n\n\t\t\tif ( object.visible === false ) return;\n\n\t\t\tconst visible = object.layers.test( camera.layers );\n\n\t\t\tif ( visible ) {\n\n\t\t\t\tif ( object.isGroup ) {\n\n\t\t\t\t\tgroupOrder = object.renderOrder;\n\n\t\t\t\t} else if ( object.isLOD ) {\n\n\t\t\t\t\tif ( object.autoUpdate === true ) object.update( camera );\n\n\t\t\t\t} else if ( object.isLight ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\t_vector3.setFromMatrixPosition( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isMesh || object.isLine || object.isPoints ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\t\t\t\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector3.copy( object.boundingSphere.center );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector3.copy( geometry.boundingSphere.center );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t_vector3\n\t\t\t\t\t\t\t\t.applyMatrix4( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector3.z, group );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst children = object.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tprojectObject( children[ i ], camera, groupOrder, sortObjects );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderScene( currentRenderList, scene, camera, viewport ) {\n\n\t\t\tconst opaqueObjects = currentRenderList.opaque;\n\t\t\tconst transmissiveObjects = currentRenderList.transmissive;\n\t\t\tconst transparentObjects = currentRenderList.transparent;\n\n\t\t\tcurrentRenderState.setupLightsView( camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\n\n\t\t\tif ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );\n\n\t\t\tif ( viewport ) state.viewport( _currentViewport.copy( viewport ) );\n\n\t\t\tif ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera );\n\t\t\tif ( transmissiveObjects.length > 0 ) renderObjects( transmissiveObjects, scene, camera );\n\t\t\tif ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera );\n\n\t\t\t// Ensure depth buffer writing is enabled so it can be cleared on next render\n\n\t\t\tstate.buffers.depth.setTest( true );\n\t\t\tstate.buffers.depth.setMask( true );\n\t\t\tstate.buffers.color.setMask( true );\n\n\t\t\tstate.setPolygonOffset( false );\n\n\t\t}\n\n\t\tfunction renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {\n\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tif ( overrideMaterial !== null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( currentRenderState.state.transmissionRenderTarget === null ) {\n\n\t\t\t\tcurrentRenderState.state.transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {\n\t\t\t\t\tgenerateMipmaps: true,\n\t\t\t\t\ttype: ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) ) ? HalfFloatType : UnsignedByteType,\n\t\t\t\t\tminFilter: LinearMipmapLinearFilter,\n\t\t\t\t\tsamples: 4,\n\t\t\t\t\tstencilBuffer: stencil\n\t\t\t\t} );\n\n\t\t\t\tconst renderTargetProperties = properties.get( currentRenderState.state.transmissionRenderTarget );\n\t\t\t\trenderTargetProperties.__isTransmissionRenderTarget = true;\n\n\t\t\t\t// debug\n\n\t\t\t\t/*\n\t\t\t\tconst geometry = new PlaneGeometry();\n\t\t\t\tconst material = new MeshBasicMaterial( { map: _transmissionRenderTarget.texture } );\n\n\t\t\t\tconst mesh = new Mesh( geometry, material );\n\t\t\t\tscene.add( mesh );\n\t\t\t\t*/\n\n\t\t\t}\n\n\t\t\tconst transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget;\n\n\t\t\t_this.getDrawingBufferSize( _vector2 );\n\t\t\ttransmissionRenderTarget.setSize( _vector2.x, _vector2.y );\n\n\t\t\t//\n\n\t\t\tconst currentRenderTarget = _this.getRenderTarget();\n\t\t\t_this.setRenderTarget( transmissionRenderTarget );\n\n\t\t\t_this.getClearColor( _currentClearColor );\n\t\t\t_currentClearAlpha = _this.getClearAlpha();\n\t\t\tif ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );\n\n\t\t\t_this.clear();\n\n\t\t\t// Turn off the features which can affect the frag color for opaque objects pass.\n\t\t\t// Otherwise they are applied twice in opaque objects pass and transmission objects pass.\n\t\t\tconst currentToneMapping = _this.toneMapping;\n\t\t\t_this.toneMapping = NoToneMapping;\n\n\t\t\trenderObjects( opaqueObjects, scene, camera );\n\n\t\t\ttextures.updateMultisampleRenderTarget( transmissionRenderTarget );\n\t\t\ttextures.updateRenderTargetMipmap( transmissionRenderTarget );\n\n\t\t\tlet renderTargetNeedsUpdate = false;\n\n\t\t\tfor ( let i = 0, l = transmissiveObjects.length; i < l; i ++ ) {\n\n\t\t\t\tconst renderItem = transmissiveObjects[ i ];\n\n\t\t\t\tconst object = renderItem.object;\n\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\tconst material = renderItem.material;\n\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\tif ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\tconst currentSide = material.side;\n\n\t\t\t\t\tmaterial.side = BackSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t\tmaterial.side = currentSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\trenderTargetNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( renderTargetNeedsUpdate === true ) {\n\n\t\t\t\ttextures.updateMultisampleRenderTarget( transmissionRenderTarget );\n\t\t\t\ttextures.updateRenderTargetMipmap( transmissionRenderTarget );\n\n\t\t\t}\n\n\t\t\t_this.setRenderTarget( currentRenderTarget );\n\n\t\t\t_this.setClearColor( _currentClearColor, _currentClearAlpha );\n\n\t\t\t_this.toneMapping = currentToneMapping;\n\n\t\t}\n\n\t\tfunction renderObjects( renderList, scene, camera ) {\n\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tfor ( let i = 0, l = renderList.length; i < l; i ++ ) {\n\n\t\t\t\tconst renderItem = renderList[ i ];\n\n\t\t\t\tconst object = renderItem.object;\n\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\tconst material = overrideMaterial === null ? renderItem.material : overrideMaterial;\n\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\tif ( object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderObject( object, scene, camera, geometry, material, group ) {\n\n\t\t\tobject.onBeforeRender( _this, scene, camera, geometry, material, group );\n\n\t\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\n\t\t\tobject.normalMatrix.getNormalMatrix( object.modelViewMatrix );\n\n\t\t\tmaterial.onBeforeRender( _this, scene, camera, geometry, object, group );\n\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\tmaterial.side = BackSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t}\n\n\t\t\tobject.onAfterRender( _this, scene, camera, geometry, material, group );\n\n\t\t}\n\n\t\tfunction getProgram( material, scene, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tconst lights = currentRenderState.state.lights;\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tconst lightsStateVersion = lights.state.version;\n\n\t\t\tconst parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object );\n\t\t\tconst programCacheKey = programCache.getProgramCacheKey( parameters );\n\n\t\t\tlet programs = materialProperties.programs;\n\n\t\t\t// always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change\n\n\t\t\tmaterialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tmaterialProperties.fog = scene.fog;\n\t\t\tmaterialProperties.envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || materialProperties.environment );\n\t\t\tmaterialProperties.envMapRotation = ( materialProperties.environment !== null && material.envMap === null ) ? scene.environmentRotation : material.envMapRotation;\n\n\t\t\tif ( programs === undefined ) {\n\n\t\t\t\t// new material\n\n\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t\t\tprograms = new Map();\n\t\t\t\tmaterialProperties.programs = programs;\n\n\t\t\t}\n\n\t\t\tlet program = programs.get( programCacheKey );\n\n\t\t\tif ( program !== undefined ) {\n\n\t\t\t\t// early out if program and light state is identical\n\n\t\t\t\tif ( materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion ) {\n\n\t\t\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t\t\treturn program;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tparameters.uniforms = programCache.getUniforms( material );\n\n\t\t\t\tmaterial.onBuild( object, parameters, _this );\n\n\t\t\t\tmaterial.onBeforeCompile( parameters, _this );\n\n\t\t\t\tprogram = programCache.acquireProgram( parameters, programCacheKey );\n\t\t\t\tprograms.set( programCacheKey, program );\n\n\t\t\t\tmaterialProperties.uniforms = parameters.uniforms;\n\n\t\t\t}\n\n\t\t\tconst uniforms = materialProperties.uniforms;\n\n\t\t\tif ( ( ! material.isShaderMaterial && ! material.isRawShaderMaterial ) || material.clipping === true ) {\n\n\t\t\t\tuniforms.clippingPlanes = clipping.uniform;\n\n\t\t\t}\n\n\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t// store the light setup it was created for\n\n\t\t\tmaterialProperties.needsLights = materialNeedsLights( material );\n\t\t\tmaterialProperties.lightsStateVersion = lightsStateVersion;\n\n\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t// wire up the material to this renderer's lighting state\n\n\t\t\t\tuniforms.ambientLightColor.value = lights.state.ambient;\n\t\t\t\tuniforms.lightProbe.value = lights.state.probe;\n\t\t\t\tuniforms.directionalLights.value = lights.state.directional;\n\t\t\t\tuniforms.directionalLightShadows.value = lights.state.directionalShadow;\n\t\t\t\tuniforms.spotLights.value = lights.state.spot;\n\t\t\t\tuniforms.spotLightShadows.value = lights.state.spotShadow;\n\t\t\t\tuniforms.rectAreaLights.value = lights.state.rectArea;\n\t\t\t\tuniforms.ltc_1.value = lights.state.rectAreaLTC1;\n\t\t\t\tuniforms.ltc_2.value = lights.state.rectAreaLTC2;\n\t\t\t\tuniforms.pointLights.value = lights.state.point;\n\t\t\t\tuniforms.pointLightShadows.value = lights.state.pointShadow;\n\t\t\t\tuniforms.hemisphereLights.value = lights.state.hemi;\n\n\t\t\t\tuniforms.directionalShadowMap.value = lights.state.directionalShadowMap;\n\t\t\t\tuniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\n\t\t\t\tuniforms.spotShadowMap.value = lights.state.spotShadowMap;\n\t\t\t\tuniforms.spotLightMatrix.value = lights.state.spotLightMatrix;\n\t\t\t\tuniforms.spotLightMap.value = lights.state.spotLightMap;\n\t\t\t\tuniforms.pointShadowMap.value = lights.state.pointShadowMap;\n\t\t\t\tuniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\n\t\t\t\t// TODO (abelnation): add area lights shadow info to uniforms\n\n\t\t\t}\n\n\t\t\tmaterialProperties.currentProgram = program;\n\t\t\tmaterialProperties.uniformsList = null;\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\tfunction getUniformList( materialProperties ) {\n\n\t\t\tif ( materialProperties.uniformsList === null ) {\n\n\t\t\t\tconst progUniforms = materialProperties.currentProgram.getUniforms();\n\t\t\t\tmaterialProperties.uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, materialProperties.uniforms );\n\n\t\t\t}\n\n\t\t\treturn materialProperties.uniformsList;\n\n\t\t}\n\n\t\tfunction updateCommonMaterialProperties( material, parameters ) {\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tmaterialProperties.outputColorSpace = parameters.outputColorSpace;\n\t\t\tmaterialProperties.batching = parameters.batching;\n\t\t\tmaterialProperties.instancing = parameters.instancing;\n\t\t\tmaterialProperties.instancingColor = parameters.instancingColor;\n\t\t\tmaterialProperties.instancingMorph = parameters.instancingMorph;\n\t\t\tmaterialProperties.skinning = parameters.skinning;\n\t\t\tmaterialProperties.morphTargets = parameters.morphTargets;\n\t\t\tmaterialProperties.morphNormals = parameters.morphNormals;\n\t\t\tmaterialProperties.morphColors = parameters.morphColors;\n\t\t\tmaterialProperties.morphTargetsCount = parameters.morphTargetsCount;\n\t\t\tmaterialProperties.numClippingPlanes = parameters.numClippingPlanes;\n\t\t\tmaterialProperties.numIntersection = parameters.numClipIntersection;\n\t\t\tmaterialProperties.vertexAlphas = parameters.vertexAlphas;\n\t\t\tmaterialProperties.vertexTangents = parameters.vertexTangents;\n\t\t\tmaterialProperties.toneMapping = parameters.toneMapping;\n\n\t\t}\n\n\t\tfunction setProgram( camera, scene, geometry, material, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\ttextures.resetTextureUnits();\n\n\t\t\tconst fog = scene.fog;\n\t\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tconst colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace );\n\t\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\t\tconst vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;\n\t\t\tconst vertexTangents = !! geometry.attributes.tangent && ( !! material.normalMap || material.anisotropy > 0 );\n\t\t\tconst morphTargets = !! geometry.morphAttributes.position;\n\t\t\tconst morphNormals = !! geometry.morphAttributes.normal;\n\t\t\tconst morphColors = !! geometry.morphAttributes.color;\n\n\t\t\tlet toneMapping = NoToneMapping;\n\n\t\t\tif ( material.toneMapped ) {\n\n\t\t\t\tif ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\t\ttoneMapping = _this.toneMapping;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\t\tconst materialProperties = properties.get( material );\n\t\t\tconst lights = currentRenderState.state.lights;\n\n\t\t\tif ( _clippingEnabled === true ) {\n\n\t\t\t\tif ( _localClippingEnabled === true || camera !== _currentCamera ) {\n\n\t\t\t\t\tconst useCache =\n\t\t\t\t\t\tcamera === _currentCamera &&\n\t\t\t\t\t\tmaterial.id === _currentMaterialId;\n\n\t\t\t\t\t// we might want to call this function with some ClippingGroup\n\t\t\t\t\t// object instead of the material, once it becomes feasible\n\t\t\t\t\t// (#8465, #8379)\n\t\t\t\t\tclipping.setState( material, camera, useCache );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet needsProgramChange = false;\n\n\t\t\tif ( material.version === materialProperties.__version ) {\n\n\t\t\t\tif ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.outputColorSpace !== colorSpace ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batching === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isBatchedMesh && materialProperties.batching === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancing === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isInstancedMesh && materialProperties.instancing === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isSkinnedMesh && materialProperties.skinning === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isSkinnedMesh && materialProperties.skinning === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingMorph === true && object.morphTexture === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingMorph === false && object.morphTexture !== null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.envMap !== envMap ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( material.fog === true && materialProperties.fog !== fog ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.numClippingPlanes !== undefined &&\n\t\t\t\t\t( materialProperties.numClippingPlanes !== clipping.numPlanes ||\n\t\t\t\t\tmaterialProperties.numIntersection !== clipping.numIntersection ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexAlphas !== vertexAlphas ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexTangents !== vertexTangents ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphTargets !== morphTargets ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphNormals !== morphNormals ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphColors !== morphColors ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.toneMapping !== toneMapping ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphTargetsCount !== morphTargetsCount ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tneedsProgramChange = true;\n\t\t\t\tmaterialProperties.__version = material.version;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet program = materialProperties.currentProgram;\n\n\t\t\tif ( needsProgramChange === true ) {\n\n\t\t\t\tprogram = getProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t\tlet refreshProgram = false;\n\t\t\tlet refreshMaterial = false;\n\t\t\tlet refreshLights = false;\n\n\t\t\tconst p_uniforms = program.getUniforms(),\n\t\t\t\tm_uniforms = materialProperties.uniforms;\n\n\t\t\tif ( state.useProgram( program.program ) ) {\n\n\t\t\t\trefreshProgram = true;\n\t\t\t\trefreshMaterial = true;\n\t\t\t\trefreshLights = true;\n\n\t\t\t}\n\n\t\t\tif ( material.id !== _currentMaterialId ) {\n\n\t\t\t\t_currentMaterialId = material.id;\n\n\t\t\t\trefreshMaterial = true;\n\n\t\t\t}\n\n\t\t\tif ( refreshProgram || _currentCamera !== camera ) {\n\n\t\t\t\t// common camera uniforms\n\n\t\t\t\tp_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );\n\t\t\t\tp_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );\n\n\t\t\t\tconst uCamPos = p_uniforms.map.cameraPosition;\n\n\t\t\t\tif ( uCamPos !== undefined ) {\n\n\t\t\t\t\tuCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );\n\n\t\t\t\t}\n\n\t\t\t\tif ( capabilities.logarithmicDepthBuffer ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'logDepthBufFC',\n\t\t\t\t\t\t2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );\n\n\t\t\t\t}\n\n\t\t\t\t// consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067\n\n\t\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\t\tmaterial.isShaderMaterial ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'isOrthographic', camera.isOrthographicCamera === true );\n\n\t\t\t\t}\n\n\t\t\t\tif ( _currentCamera !== camera ) {\n\n\t\t\t\t\t_currentCamera = camera;\n\n\t\t\t\t\t// lighting uniforms depend on the camera so enforce an update\n\t\t\t\t\t// now, in case this material supports lights - or later, when\n\t\t\t\t\t// the next material that does gets activated:\n\n\t\t\t\t\trefreshMaterial = true;\t\t// set to true on material change\n\t\t\t\t\trefreshLights = true;\t\t// remains set until update done\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// skinning and morph target uniforms must be set even if material didn't change\n\t\t\t// auto-setting of texture unit for bone and morph texture must go before other textures\n\t\t\t// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures\n\n\t\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrix' );\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrixInverse' );\n\n\t\t\t\tconst skeleton = object.skeleton;\n\n\t\t\t\tif ( skeleton ) {\n\n\t\t\t\t\tif ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( object.isBatchedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingTexture' );\n\t\t\t\tp_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );\n\n\t\t\t}\n\n\t\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\t\tif ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined ) ) {\n\n\t\t\t\tmorphtargets.update( object, geometry, program );\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {\n\n\t\t\t\tmaterialProperties.receiveShadow = object.receiveShadow;\n\t\t\t\tp_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow );\n\n\t\t\t}\n\n\t\t\t// https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512\n\n\t\t\tif ( material.isMeshGouraudMaterial && material.envMap !== null ) {\n\n\t\t\t\tm_uniforms.envMap.value = envMap;\n\n\t\t\t\tm_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\t}\n\n\t\t\tif ( material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null ) {\n\n\t\t\t\tm_uniforms.envMapIntensity.value = scene.environmentIntensity;\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );\n\n\t\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t\t// the current material requires lighting info\n\n\t\t\t\t\t// note: all lighting uniforms are always set correctly\n\t\t\t\t\t// they simply reference the renderer's state for their\n\t\t\t\t\t// values\n\t\t\t\t\t//\n\t\t\t\t\t// use the current material's .needsUpdate flags to set\n\t\t\t\t\t// the GL state when required\n\n\t\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, refreshLights );\n\n\t\t\t\t}\n\n\t\t\t\t// refresh uniforms common to several materials\n\n\t\t\t\tif ( fog && material.fog === true ) {\n\n\t\t\t\t\tmaterials.refreshFogUniforms( m_uniforms, fog );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget );\n\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );\n\n\t\t\t}\n\n\t\t\tif ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {\n\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );\n\t\t\t\tmaterial.uniformsNeedUpdate = false;\n\n\t\t\t}\n\n\t\t\tif ( material.isSpriteMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'center', object.center );\n\n\t\t\t}\n\n\t\t\t// common matrices\n\n\t\t\tp_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );\n\n\t\t\t// UBOs\n\n\t\t\tif ( material.isShaderMaterial || material.isRawShaderMaterial ) {\n\n\t\t\t\tconst groups = material.uniformsGroups;\n\n\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\t\tuniformsGroups.update( group, program );\n\t\t\t\t\tuniformsGroups.bind( group, program );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\t// If uniforms are marked as clean, they don't need to be loaded to the GPU.\n\n\t\tfunction markUniformsLightsNeedsUpdate( uniforms, value ) {\n\n\t\t\tuniforms.ambientLightColor.needsUpdate = value;\n\t\t\tuniforms.lightProbe.needsUpdate = value;\n\n\t\t\tuniforms.directionalLights.needsUpdate = value;\n\t\t\tuniforms.directionalLightShadows.needsUpdate = value;\n\t\t\tuniforms.pointLights.needsUpdate = value;\n\t\t\tuniforms.pointLightShadows.needsUpdate = value;\n\t\t\tuniforms.spotLights.needsUpdate = value;\n\t\t\tuniforms.spotLightShadows.needsUpdate = value;\n\t\t\tuniforms.rectAreaLights.needsUpdate = value;\n\t\t\tuniforms.hemisphereLights.needsUpdate = value;\n\n\t\t}\n\n\t\tfunction materialNeedsLights( material ) {\n\n\t\t\treturn material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial || material.isShadowMaterial ||\n\t\t\t\t( material.isShaderMaterial && material.lights === true );\n\n\t\t}\n\n\t\tthis.getActiveCubeFace = function () {\n\n\t\t\treturn _currentActiveCubeFace;\n\n\t\t};\n\n\t\tthis.getActiveMipmapLevel = function () {\n\n\t\t\treturn _currentActiveMipmapLevel;\n\n\t\t};\n\n\t\tthis.getRenderTarget = function () {\n\n\t\t\treturn _currentRenderTarget;\n\n\t\t};\n\n\t\tthis.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {\n\n\t\t\tproperties.get( renderTarget.texture ).__webglTexture = colorTexture;\n\t\t\tproperties.get( renderTarget.depthTexture ).__webglTexture = depthTexture;\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__hasExternalTextures = true;\n\n\t\t\trenderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;\n\n\t\t\tif ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\t\t// The multisample_render_to_texture extension doesn't work properly if there\n\t\t\t\t// are midframe flushes and an external depth buffer. Disable use of the extension.\n\t\t\t\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );\n\t\t\t\t\trenderTargetProperties.__useRenderToTexture = false;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setRenderTargetFramebuffer = function ( renderTarget, defaultFramebuffer ) {\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__webglFramebuffer = defaultFramebuffer;\n\t\t\trenderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;\n\n\t\t};\n\n\t\tthis.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {\n\n\t\t\t_currentRenderTarget = renderTarget;\n\t\t\t_currentActiveCubeFace = activeCubeFace;\n\t\t\t_currentActiveMipmapLevel = activeMipmapLevel;\n\n\t\t\tlet useDefaultFramebuffer = true;\n\t\t\tlet framebuffer = null;\n\t\t\tlet isCube = false;\n\t\t\tlet isRenderTarget3D = false;\n\n\t\t\tif ( renderTarget ) {\n\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\t\t\tif ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {\n\n\t\t\t\t\t// We need to make sure to rebind the framebuffer.\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\t\t\t\t\tuseDefaultFramebuffer = false;\n\n\t\t\t\t} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {\n\n\t\t\t\t\ttextures.setupRenderTarget( renderTarget );\n\n\t\t\t\t} else if ( renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\t\t\t// Color and depth texture must be rebound in order for the swapchain to update.\n\t\t\t\t\ttextures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );\n\n\t\t\t\t}\n\n\t\t\t\tconst texture = renderTarget.texture;\n\n\t\t\t\tif ( texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tisRenderTarget3D = true;\n\n\t\t\t\t}\n\n\t\t\t\tconst __webglFramebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer[ activeCubeFace ] ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ][ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ];\n\n\t\t\t\t\t}\n\n\t\t\t\t\tisCube = true;\n\n\t\t\t\t} else if ( ( renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\tframebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t_currentViewport.copy( renderTarget.viewport );\n\t\t\t\t_currentScissor.copy( renderTarget.scissor );\n\t\t\t\t_currentScissorTest = renderTarget.scissorTest;\n\n\t\t\t} else {\n\n\t\t\t\t_currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissorTest = _scissorTest;\n\n\t\t\t}\n\n\t\t\tconst framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\tif ( framebufferBound && useDefaultFramebuffer ) {\n\n\t\t\t\tstate.drawBuffers( renderTarget, framebuffer );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport );\n\t\t\tstate.scissor( _currentScissor );\n\t\t\tstate.setScissorTest( _currentScissorTest );\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel );\n\n\t\t\t} else if ( isRenderTarget3D ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\tconst layer = activeCubeFace || 0;\n\t\t\t\t_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer );\n\n\t\t\t}\n\n\t\t\t_currentMaterialId = - 1; // reset current material to ensure correct uniform bindings\n\n\t\t};\n\n\t\tthis.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\n\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\n\n\t\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\n\n\t\t\t}\n\n\t\t\tif ( framebuffer ) {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\ttry {\n\n\t\t\t\t\tconst texture = renderTarget.texture;\n\t\t\t\t\tconst textureFormat = texture.format;\n\t\t\t\t\tconst textureType = texture.type;\n\n\t\t\t\t\tif ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );\n\n\t\t\t\t\tif ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)\n\t\t\t\t\t\ttextureType !== FloatType && ! halfFloatSupportedByExt ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n\n\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );\n\n\t\t\t\t\t}\n\n\t\t\t\t} finally {\n\n\t\t\t\t\t// restore framebuffer of current render target if necessary\n\n\t\t\t\t\tconst framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.copyFramebufferToTexture = function ( position, texture, level = 0 ) {\n\n\t\t\tconst levelScale = Math.pow( 2, - level );\n\t\t\tconst width = Math.floor( texture.image.width * levelScale );\n\t\t\tconst height = Math.floor( texture.image.height * levelScale );\n\n\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture = function ( position, srcTexture, dstTexture, level = 0 ) {\n\n\t\t\tconst width = srcTexture.image.width;\n\t\t\tconst height = srcTexture.image.height;\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\n\t\t\ttextures.setTexture2D( dstTexture, 0 );\n\n\t\t\t// As another texture upload may have changed pixelStorei\n\t\t\t// parameters, make sure they are correct for the dstTexture\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\tif ( srcTexture.isDataTexture ) {\n\n\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( srcTexture.isCompressedTexture ) {\n\n\t\t\t\t\t_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, srcTexture.mipmaps[ 0 ].width, srcTexture.mipmaps[ 0 ].height, glFormat, srcTexture.mipmaps[ 0 ].data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( _gl.TEXTURE_2D );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture3D = function ( sourceBox, position, srcTexture, dstTexture, level = 0 ) {\n\n\t\t\tconst width = Math.round( sourceBox.max.x - sourceBox.min.x );\n\t\t\tconst height = Math.round( sourceBox.max.y - sourceBox.min.y );\n\t\t\tconst depth = sourceBox.max.z - sourceBox.min.z + 1;\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\t\t\tlet glTarget;\n\n\t\t\tif ( dstTexture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_3D;\n\n\t\t\t} else if ( dstTexture.isDataArrayTexture || dstTexture.isCompressedArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\tconst unpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst unpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\n\t\t\tconst unpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst unpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\n\t\t\tconst unpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\n\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, sourceBox.min.x );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, sourceBox.min.y );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, sourceBox.min.z );\n\n\t\t\tif ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {\n\n\t\t\t\t_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( dstTexture.isCompressedArrayTexture ) {\n\n\t\t\t\t\t_gl.compressedTexSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, unpackRowLen );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, unpackSkipPixels );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, unpackSkipRows );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, unpackSkipImages );\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( glTarget );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.initTexture = function ( texture ) {\n\n\t\t\tif ( texture.isCubeTexture ) {\n\n\t\t\t\ttextures.setTextureCube( texture, 0 );\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( texture, 0 );\n\n\t\t\t} else if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( texture, 0 );\n\n\t\t\t} else {\n\n\t\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.resetState = function () {\n\n\t\t\t_currentActiveCubeFace = 0;\n\t\t\t_currentActiveMipmapLevel = 0;\n\t\t\t_currentRenderTarget = null;\n\n\t\t\tstate.reset();\n\t\t\tbindingStates.reset();\n\n\t\t};\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tget coordinateSystem() {\n\n\t\treturn WebGLCoordinateSystem;\n\n\t}\n\n\tget outputColorSpace() {\n\n\t\treturn this._outputColorSpace;\n\n\t}\n\n\tset outputColorSpace( colorSpace ) {\n\n\t\tthis._outputColorSpace = colorSpace;\n\n\t\tconst gl = this.getContext();\n\t\tgl.drawingBufferColorSpace = colorSpace === DisplayP3ColorSpace ? 'display-p3' : 'srgb';\n\t\tgl.unpackColorSpace = ColorManagement.workingColorSpace === LinearDisplayP3ColorSpace ? 'display-p3' : 'srgb';\n\n\t}\n\n\tget useLegacyLights() { // @deprecated, r155\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );\n\t\treturn this._useLegacyLights;\n\n\t}\n\n\tset useLegacyLights( value ) { // @deprecated, r155\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );\n\t\tthis._useLegacyLights = value;\n\n\t}\n\n}\n\nclass FogExp2 {\n\n\tconstructor( color, density = 0.00025 ) {\n\n\t\tthis.isFogExp2 = true;\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\t\tthis.density = density;\n\n\t}\n\n\tclone() {\n\n\t\treturn new FogExp2( this.color, this.density );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'FogExp2',\n\t\t\tname: this.name,\n\t\t\tcolor: this.color.getHex(),\n\t\t\tdensity: this.density\n\t\t};\n\n\t}\n\n}\n\nclass Fog {\n\n\tconstructor( color, near = 1, far = 1000 ) {\n\n\t\tthis.isFog = true;\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Fog( this.color, this.near, this.far );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'Fog',\n\t\t\tname: this.name,\n\t\t\tcolor: this.color.getHex(),\n\t\t\tnear: this.near,\n\t\t\tfar: this.far\n\t\t};\n\n\t}\n\n}\n\nclass Scene extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isScene = true;\n\n\t\tthis.type = 'Scene';\n\n\t\tthis.background = null;\n\t\tthis.environment = null;\n\t\tthis.fog = null;\n\n\t\tthis.backgroundBlurriness = 0;\n\t\tthis.backgroundIntensity = 1;\n\t\tthis.backgroundRotation = new Euler();\n\n\t\tthis.environmentIntensity = 1;\n\t\tthis.environmentRotation = new Euler();\n\n\t\tthis.overrideMaterial = null;\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.background !== null ) this.background = source.background.clone();\n\t\tif ( source.environment !== null ) this.environment = source.environment.clone();\n\t\tif ( source.fog !== null ) this.fog = source.fog.clone();\n\n\t\tthis.backgroundBlurriness = source.backgroundBlurriness;\n\t\tthis.backgroundIntensity = source.backgroundIntensity;\n\t\tthis.backgroundRotation.copy( source.backgroundRotation );\n\n\t\tthis.environmentIntensity = source.environmentIntensity;\n\t\tthis.environmentRotation.copy( source.environmentRotation );\n\n\t\tif ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.fog !== null ) data.object.fog = this.fog.toJSON();\n\n\t\tif ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;\n\t\tif ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;\n\t\tdata.object.backgroundRotation = this.backgroundRotation.toArray();\n\n\t\tif ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;\n\t\tdata.object.environmentRotation = this.environmentRotation.toArray();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InterleavedBuffer {\n\n\tconstructor( array, stride ) {\n\n\t\tthis.isInterleavedBuffer = true;\n\n\t\tthis.array = array;\n\t\tthis.stride = stride;\n\t\tthis.count = array !== undefined ? array.length / stride : 0;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis._updateRange = { offset: 0, count: - 1 };\n\t\tthis.updateRanges = [];\n\n\t\tthis.version = 0;\n\n\t\tthis.uuid = generateUUID();\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tget updateRange() {\n\n\t\twarnOnce( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\n\t\treturn this._updateRange;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.count = source.count;\n\t\tthis.stride = source.stride;\n\t\tthis.usage = source.usage;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.stride;\n\t\tindex2 *= attribute.stride;\n\n\t\tfor ( let i = 0, l = this.stride; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = this.array.slice( 0 ).buffer;\n\n\t\t}\n\n\t\tconst array = new this.array.constructor( data.arrayBuffers[ this.array.buffer._uuid ] );\n\n\t\tconst ib = new this.constructor( array, this.stride );\n\t\tib.setUsage( this.usage );\n\n\t\treturn ib;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\t// generate UUID for array buffer if necessary\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = Array.from( new Uint32Array( this.array.buffer ) );\n\n\t\t}\n\n\t\t//\n\n\t\treturn {\n\t\t\tuuid: this.uuid,\n\t\t\tbuffer: this.array.buffer._uuid,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tstride: this.stride\n\t\t};\n\n\t}\n\n}\n\nconst _vector$6 = /*@__PURE__*/ new Vector3();\n\nclass InterleavedBufferAttribute {\n\n\tconstructor( interleavedBuffer, itemSize, offset, normalized = false ) {\n\n\t\tthis.isInterleavedBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.data = interleavedBuffer;\n\t\tthis.itemSize = itemSize;\n\t\tthis.offset = offset;\n\n\t\tthis.normalized = normalized;\n\n\t}\n\n\tget count() {\n\n\t\treturn this.data.count;\n\n\t}\n\n\tget array() {\n\n\t\treturn this.data.array;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tthis.data.needsUpdate = value;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.data.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.data.stride + this.offset + component ];\n\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\n\n\t\treturn value;\n\n\t}\n\n\tsetComponent( index, component, value ) {\n\n\t\tif ( this.normalized ) value = normalize( value, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + component ] = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.data.array[ index * this.data.stride + this.offset ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.data.array[ index * this.data.stride + this.offset + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.data.array[ index * this.data.stride + this.offset + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.data.array[ index * this.data.stride + this.offset + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\t\tthis.data.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( new this.array.constructor( array ), this.itemSize, this.normalized );\n\n\t\t} else {\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.clone( data );\n\n\t\t\t}\n\n\t\t\treturn new InterleavedBufferAttribute( data.interleavedBuffers[ this.data.uuid ], this.itemSize, this.offset, this.normalized );\n\n\t\t}\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// de-interleave data and save it as an ordinary buffer attribute for now\n\n\t\t\treturn {\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\ttype: this.array.constructor.name,\n\t\t\t\tarray: array,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t} else {\n\n\t\t\t// save as true interleaved attribute\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.toJSON( data );\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisInterleavedBufferAttribute: true,\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\tdata: this.data.uuid,\n\t\t\t\toffset: this.offset,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t}\n\n\t}\n\n}\n\nclass SpriteMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isSpriteMaterial = true;\n\n\t\tthis.type = 'SpriteMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.rotation = 0;\n\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.transparent = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nlet _geometry;\n\nconst _intersectPoint = /*@__PURE__*/ new Vector3();\nconst _worldScale = /*@__PURE__*/ new Vector3();\nconst _mvPosition = /*@__PURE__*/ new Vector3();\n\nconst _alignedPosition = /*@__PURE__*/ new Vector2();\nconst _rotatedPosition = /*@__PURE__*/ new Vector2();\nconst _viewWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _vA = /*@__PURE__*/ new Vector3();\nconst _vB = /*@__PURE__*/ new Vector3();\nconst _vC = /*@__PURE__*/ new Vector3();\n\nconst _uvA = /*@__PURE__*/ new Vector2();\nconst _uvB = /*@__PURE__*/ new Vector2();\nconst _uvC = /*@__PURE__*/ new Vector2();\n\nclass Sprite extends Object3D {\n\n\tconstructor( material = new SpriteMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isSprite = true;\n\n\t\tthis.type = 'Sprite';\n\n\t\tif ( _geometry === undefined ) {\n\n\t\t\t_geometry = new BufferGeometry();\n\n\t\t\tconst float32Array = new Float32Array( [\n\t\t\t\t- 0.5, - 0.5, 0, 0, 0,\n\t\t\t\t0.5, - 0.5, 0, 1, 0,\n\t\t\t\t0.5, 0.5, 0, 1, 1,\n\t\t\t\t- 0.5, 0.5, 0, 0, 1\n\t\t\t] );\n\n\t\t\tconst interleavedBuffer = new InterleavedBuffer( float32Array, 5 );\n\n\t\t\t_geometry.setIndex( [ 0, 1, 2,\t0, 2, 3 ] );\n\t\t\t_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );\n\t\t\t_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );\n\n\t\t}\n\n\t\tthis.geometry = _geometry;\n\t\tthis.material = material;\n\n\t\tthis.center = new Vector2( 0.5, 0.5 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tif ( raycaster.camera === null ) {\n\n\t\t\tconsole.error( 'THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.' );\n\n\t\t}\n\n\t\t_worldScale.setFromMatrixScale( this.matrixWorld );\n\n\t\t_viewWorldMatrix.copy( raycaster.camera.matrixWorld );\n\t\tthis.modelViewMatrix.multiplyMatrices( raycaster.camera.matrixWorldInverse, this.matrixWorld );\n\n\t\t_mvPosition.setFromMatrixPosition( this.modelViewMatrix );\n\n\t\tif ( raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false ) {\n\n\t\t\t_worldScale.multiplyScalar( - _mvPosition.z );\n\n\t\t}\n\n\t\tconst rotation = this.material.rotation;\n\t\tlet sin, cos;\n\n\t\tif ( rotation !== 0 ) {\n\n\t\t\tcos = Math.cos( rotation );\n\t\t\tsin = Math.sin( rotation );\n\n\t\t}\n\n\t\tconst center = this.center;\n\n\t\ttransformVertex( _vA.set( - 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vB.set( 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vC.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\n\t\t_uvA.set( 0, 0 );\n\t\t_uvB.set( 1, 0 );\n\t\t_uvC.set( 1, 1 );\n\n\t\t// check first triangle\n\t\tlet intersect = raycaster.ray.intersectTriangle( _vA, _vB, _vC, false, _intersectPoint );\n\n\t\tif ( intersect === null ) {\n\n\t\t\t// check second triangle\n\t\t\ttransformVertex( _vB.set( - 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\t\t_uvB.set( 0, 1 );\n\n\t\t\tintersect = raycaster.ray.intersectTriangle( _vA, _vC, _vB, false, _intersectPoint );\n\t\t\tif ( intersect === null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( _intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tpoint: _intersectPoint.clone(),\n\t\t\tuv: Triangle.getInterpolation( _intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ),\n\t\t\tface: null,\n\t\t\tobject: this\n\n\t\t} );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.center !== undefined ) this.center.copy( source.center );\n\n\t\tthis.material = source.material;\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {\n\n\t// compute position in camera space\n\t_alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );\n\n\t// to check if rotation is not zero\n\tif ( sin !== undefined ) {\n\n\t\t_rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y );\n\t\t_rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y );\n\n\t} else {\n\n\t\t_rotatedPosition.copy( _alignedPosition );\n\n\t}\n\n\n\tvertexPosition.copy( mvPosition );\n\tvertexPosition.x += _rotatedPosition.x;\n\tvertexPosition.y += _rotatedPosition.y;\n\n\t// transform to world space\n\tvertexPosition.applyMatrix4( _viewWorldMatrix );\n\n}\n\nconst _v1$2 = /*@__PURE__*/ new Vector3();\nconst _v2$1 = /*@__PURE__*/ new Vector3();\n\nclass LOD extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis._currentLevel = 0;\n\n\t\tthis.type = 'LOD';\n\n\t\tObject.defineProperties( this, {\n\t\t\tlevels: {\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: []\n\t\t\t},\n\t\t\tisLOD: {\n\t\t\t\tvalue: true,\n\t\t\t}\n\t\t} );\n\n\t\tthis.autoUpdate = true;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tconst levels = source.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tthis.addLevel( level.object.clone(), level.distance, level.hysteresis );\n\n\t\t}\n\n\t\tthis.autoUpdate = source.autoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\taddLevel( object, distance = 0, hysteresis = 0 ) {\n\n\t\tdistance = Math.abs( distance );\n\n\t\tconst levels = this.levels;\n\n\t\tlet l;\n\n\t\tfor ( l = 0; l < levels.length; l ++ ) {\n\n\t\t\tif ( distance < levels[ l ].distance ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlevels.splice( l, 0, { distance: distance, hysteresis: hysteresis, object: object } );\n\n\t\tthis.add( object );\n\n\t\treturn this;\n\n\t}\n\n\tgetCurrentLevel() {\n\n\t\treturn this._currentLevel;\n\n\t}\n\n\n\n\tgetObjectForDistance( distance ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance < levelDistance ) {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn levels[ i - 1 ].object;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = raycaster.ray.origin.distanceTo( _v1$2 );\n\n\t\t\tthis.getObjectForDistance( distance ).raycast( raycaster, intersects );\n\n\t\t}\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 1 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( camera.matrixWorld );\n\t\t\t_v2$1.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = _v1$2.distanceTo( _v2$1 ) / camera.zoom;\n\n\t\t\tlevels[ 0 ].object.visible = true;\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance >= levelDistance ) {\n\n\t\t\t\t\tlevels[ i - 1 ].object.visible = false;\n\t\t\t\t\tlevels[ i ].object.visible = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._currentLevel = i - 1;\n\n\t\t\tfor ( ; i < l; i ++ ) {\n\n\t\t\t\tlevels[ i ].object.visible = false;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.autoUpdate === false ) data.object.autoUpdate = false;\n\n\t\tdata.object.levels = [];\n\n\t\tconst levels = this.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tdata.object.levels.push( {\n\t\t\t\tobject: level.object.uuid,\n\t\t\t\tdistance: level.distance,\n\t\t\t\thysteresis: level.hysteresis\n\t\t\t} );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _basePosition = /*@__PURE__*/ new Vector3();\n\nconst _skinIndex = /*@__PURE__*/ new Vector4();\nconst _skinWeight = /*@__PURE__*/ new Vector4();\n\nconst _vector3 = /*@__PURE__*/ new Vector3();\nconst _matrix4 = /*@__PURE__*/ new Matrix4();\nconst _vertex = /*@__PURE__*/ new Vector3();\n\nconst _sphere$4 = /*@__PURE__*/ new Sphere();\nconst _inverseMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _ray$2 = /*@__PURE__*/ new Ray();\n\nclass SkinnedMesh extends Mesh {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isSkinnedMesh = true;\n\n\t\tthis.type = 'SkinnedMesh';\n\n\t\tthis.bindMode = AttachedBindMode;\n\t\tthis.bindMatrix = new Matrix4();\n\t\tthis.bindMatrixInverse = new Matrix4();\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\tthis.getVertexPosition( i, _vertex );\n\t\t\tthis.boundingBox.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\tthis.getVertexPosition( i, _vertex );\n\t\t\tthis.boundingSphere.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.bindMode = source.bindMode;\n\t\tthis.bindMatrix.copy( source.bindMatrix );\n\t\tthis.bindMatrixInverse.copy( source.bindMatrixInverse );\n\n\t\tthis.skeleton = source.skeleton;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$4.copy( this.boundingSphere );\n\t\t_sphere$4.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$4 ) === false ) return;\n\n\t\t// convert ray to local space of skinned mesh\n\n\t\t_inverseMatrix$2.copy( matrixWorld ).invert();\n\t\t_ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tif ( _ray$2.intersectsBox( this.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$2 );\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tsuper.getVertexPosition( index, target );\n\n\t\tthis.applyBoneTransform( index, target );\n\n\t\treturn target;\n\n\t}\n\n\tbind( skeleton, bindMatrix ) {\n\n\t\tthis.skeleton = skeleton;\n\n\t\tif ( bindMatrix === undefined ) {\n\n\t\t\tthis.updateMatrixWorld( true );\n\n\t\t\tthis.skeleton.calculateInverses();\n\n\t\t\tbindMatrix = this.matrixWorld;\n\n\t\t}\n\n\t\tthis.bindMatrix.copy( bindMatrix );\n\t\tthis.bindMatrixInverse.copy( bindMatrix ).invert();\n\n\t}\n\n\tpose() {\n\n\t\tthis.skeleton.pose();\n\n\t}\n\n\tnormalizeSkinWeights() {\n\n\t\tconst vector = new Vector4();\n\n\t\tconst skinWeight = this.geometry.attributes.skinWeight;\n\n\t\tfor ( let i = 0, l = skinWeight.count; i < l; i ++ ) {\n\n\t\t\tvector.fromBufferAttribute( skinWeight, i );\n\n\t\t\tconst scale = 1.0 / vector.manhattanLength();\n\n\t\t\tif ( scale !== Infinity ) {\n\n\t\t\t\tvector.multiplyScalar( scale );\n\n\t\t\t} else {\n\n\t\t\t\tvector.set( 1, 0, 0, 0 ); // do something reasonable\n\n\t\t\t}\n\n\t\t\tskinWeight.setXYZW( i, vector.x, vector.y, vector.z, vector.w );\n\n\t\t}\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.bindMode === AttachedBindMode ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.matrixWorld ).invert();\n\n\t\t} else if ( this.bindMode === DetachedBindMode ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.bindMatrix ).invert();\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode );\n\n\t\t}\n\n\t}\n\n\tapplyBoneTransform( index, vector ) {\n\n\t\tconst skeleton = this.skeleton;\n\t\tconst geometry = this.geometry;\n\n\t\t_skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index );\n\t\t_skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index );\n\n\t\t_basePosition.copy( vector ).applyMatrix4( this.bindMatrix );\n\n\t\tvector.set( 0, 0, 0 );\n\n\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\tconst weight = _skinWeight.getComponent( i );\n\n\t\t\tif ( weight !== 0 ) {\n\n\t\t\t\tconst boneIndex = _skinIndex.getComponent( i );\n\n\t\t\t\t_matrix4.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] );\n\n\t\t\t\tvector.addScaledVector( _vector3.copy( _basePosition ).applyMatrix4( _matrix4 ), weight );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn vector.applyMatrix4( this.bindMatrixInverse );\n\n\t}\n\n}\n\nclass Bone extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBone = true;\n\n\t\tthis.type = 'Bone';\n\n\t}\n\n}\n\nclass DataTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isDataTexture = true;\n\n\t\tthis.image = { data: data, width: width, height: height };\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nconst _offsetMatrix = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix$1 = /*@__PURE__*/ new Matrix4();\n\nclass Skeleton {\n\n\tconstructor( bones = [], boneInverses = [] ) {\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.bones = bones.slice( 0 );\n\t\tthis.boneInverses = boneInverses;\n\t\tthis.boneMatrices = null;\n\n\t\tthis.boneTexture = null;\n\n\t\tthis.init();\n\n\t}\n\n\tinit() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tthis.boneMatrices = new Float32Array( bones.length * 16 );\n\n\t\t// calculate inverse bone matrices if necessary\n\n\t\tif ( boneInverses.length === 0 ) {\n\n\t\t\tthis.calculateInverses();\n\n\t\t} else {\n\n\t\t\t// handle special case\n\n\t\t\tif ( bones.length !== boneInverses.length ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.' );\n\n\t\t\t\tthis.boneInverses = [];\n\n\t\t\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\t\t\tthis.boneInverses.push( new Matrix4() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcalculateInverses() {\n\n\t\tthis.boneInverses.length = 0;\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst inverse = new Matrix4();\n\n\t\t\tif ( this.bones[ i ] ) {\n\n\t\t\t\tinverse.copy( this.bones[ i ].matrixWorld ).invert();\n\n\t\t\t}\n\n\t\t\tthis.boneInverses.push( inverse );\n\n\t\t}\n\n\t}\n\n\tpose() {\n\n\t\t// recover the bind-time world matrices\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tbone.matrixWorld.copy( this.boneInverses[ i ] ).invert();\n\n\t\t\t}\n\n\t\t}\n\n\t\t// compute the local matrices, positions, rotations and scales\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t\tbone.matrix.copy( bone.parent.matrixWorld ).invert();\n\t\t\t\t\tbone.matrix.multiply( bone.matrixWorld );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbone.matrix.copy( bone.matrixWorld );\n\n\t\t\t\t}\n\n\t\t\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdate() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\t\tconst boneMatrices = this.boneMatrices;\n\t\tconst boneTexture = this.boneTexture;\n\n\t\t// flatten bone matrices to array\n\n\t\tfor ( let i = 0, il = bones.length; i < il; i ++ ) {\n\n\t\t\t// compute the offset between the current and the original transform\n\n\t\t\tconst matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix$1;\n\n\t\t\t_offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] );\n\t\t\t_offsetMatrix.toArray( boneMatrices, i * 16 );\n\n\t\t}\n\n\t\tif ( boneTexture !== null ) {\n\n\t\t\tboneTexture.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new Skeleton( this.bones, this.boneInverses );\n\n\t}\n\n\tcomputeBoneTexture() {\n\n\t\t// layout (1 matrix = 4 pixels)\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t// with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = Math.ceil( size / 4 ) * 4;\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tboneMatrices.set( this.boneMatrices ); // copy current values\n\n\t\tconst boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );\n\t\tboneTexture.needsUpdate = true;\n\n\t\tthis.boneMatrices = boneMatrices;\n\t\tthis.boneTexture = boneTexture;\n\n\t\treturn this;\n\n\t}\n\n\tgetBoneByName( name ) {\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone.name === name ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tdispose( ) {\n\n\t\tif ( this.boneTexture !== null ) {\n\n\t\t\tthis.boneTexture.dispose();\n\n\t\t\tthis.boneTexture = null;\n\n\t\t}\n\n\t}\n\n\tfromJSON( json, bones ) {\n\n\t\tthis.uuid = json.uuid;\n\n\t\tfor ( let i = 0, l = json.bones.length; i < l; i ++ ) {\n\n\t\t\tconst uuid = json.bones[ i ];\n\t\t\tlet bone = bones[ uuid ];\n\n\t\t\tif ( bone === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: No bone found with UUID:', uuid );\n\t\t\t\tbone = new Bone();\n\n\t\t\t}\n\n\t\t\tthis.bones.push( bone );\n\t\t\tthis.boneInverses.push( new Matrix4().fromArray( json.boneInverses[ i ] ) );\n\n\t\t}\n\n\t\tthis.init();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Skeleton',\n\t\t\t\tgenerator: 'Skeleton.toJSON'\n\t\t\t},\n\t\t\tbones: [],\n\t\t\tboneInverses: []\n\t\t};\n\n\t\tdata.uuid = this.uuid;\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tfor ( let i = 0, l = bones.length; i < l; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\t\t\tdata.bones.push( bone.uuid );\n\n\t\t\tconst boneInverse = boneInverses[ i ];\n\t\t\tdata.boneInverses.push( boneInverse.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InstancedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, itemSize, normalized );\n\n\t\tthis.isInstancedBufferAttribute = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.meshPerAttribute = this.meshPerAttribute;\n\n\t\tdata.isInstancedBufferAttribute = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _instanceLocalMatrix = /*@__PURE__*/ new Matrix4();\nconst _instanceWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _instanceIntersects = [];\n\nconst _box3 = /*@__PURE__*/ new Box3();\nconst _identity = /*@__PURE__*/ new Matrix4();\nconst _mesh$1 = /*@__PURE__*/ new Mesh();\nconst _sphere$3 = /*@__PURE__*/ new Sphere();\n\nclass InstancedMesh extends Mesh {\n\n\tconstructor( geometry, material, count ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isInstancedMesh = true;\n\n\t\tthis.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );\n\t\tthis.instanceColor = null;\n\t\tthis.morphTexture = null;\n\n\t\tthis.count = count;\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.setMatrixAt( i, _identity );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\tgeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_box3.copy( geometry.boundingBox ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingBox.union( _box3 );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere === null ) {\n\n\t\t\tgeometry.computeBoundingSphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_sphere$3.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingSphere.union( _sphere$3 );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.instanceMatrix.copy( source.instanceMatrix );\n\n\t\tif ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();\n\t\tif ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();\n\n\t\tthis.count = source.count;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\tgetColorAt( index, color ) {\n\n\t\tcolor.fromArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tgetMatrixAt( index, matrix ) {\n\n\t\tmatrix.fromArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\tgetMorphAt( index, object ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tconst array = this.morphTexture.source.data.data;\n\n\t\tconst len = objectInfluences.length + 1; // All influences + the baseInfluenceSum\n\n\t\tconst dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning\n\n\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\tobjectInfluences[ i ] = array[ dataIndex + i ];\n\n\t\t}\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst raycastTimes = this.count;\n\n\t\t_mesh$1.geometry = this.geometry;\n\t\t_mesh$1.material = this.material;\n\n\t\tif ( _mesh$1.material === undefined ) return;\n\n\t\t// test with bounding sphere first\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$3.copy( this.boundingSphere );\n\t\t_sphere$3.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return;\n\n\t\t// now test each instance\n\n\t\tfor ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {\n\n\t\t\t// calculate the world matrix for each instance\n\n\t\t\tthis.getMatrixAt( instanceId, _instanceLocalMatrix );\n\n\t\t\t_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );\n\n\t\t\t// the mesh represents this single instance\n\n\t\t\t_mesh$1.matrixWorld = _instanceWorldMatrix;\n\n\t\t\t_mesh$1.raycast( raycaster, _instanceIntersects );\n\n\t\t\t// process the result of raycast\n\n\t\t\tfor ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {\n\n\t\t\t\tconst intersect = _instanceIntersects[ i ];\n\t\t\t\tintersect.instanceId = instanceId;\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_instanceIntersects.length = 0;\n\n\t\t}\n\n\t}\n\n\tsetColorAt( index, color ) {\n\n\t\tif ( this.instanceColor === null ) {\n\n\t\t\tthis.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ), 3 );\n\n\t\t}\n\n\t\tcolor.toArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tsetMatrixAt( index, matrix ) {\n\n\t\tmatrix.toArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\tsetMorphAt( index, object ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tconst len = objectInfluences.length + 1; // morphBaseInfluence + all influences\n\n\t\tif ( this.morphTexture === null ) {\n\n\t\t\tthis.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );\n\n\t\t}\n\n\t\tconst array = this.morphTexture.source.data.data;\n\n\t\tlet morphInfluencesSum = 0;\n\n\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t}\n\n\t\tconst morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\tconst dataIndex = len * index;\n\n\t\tarray[ dataIndex ] = morphBaseInfluence;\n\n\t\tarray.set( objectInfluences, dataIndex + 1 );\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t\tif ( this.morphTexture !== null ) {\n\n\t\t\tthis.morphTexture.dispose();\n\t\t\tthis.morphTexture = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction sortOpaque( a, b ) {\n\n\treturn a.z - b.z;\n\n}\n\nfunction sortTransparent( a, b ) {\n\n\treturn b.z - a.z;\n\n}\n\nclass MultiDrawRenderList {\n\n\tconstructor() {\n\n\t\tthis.index = 0;\n\t\tthis.pool = [];\n\t\tthis.list = [];\n\n\t}\n\n\tpush( drawRange, z ) {\n\n\t\tconst pool = this.pool;\n\t\tconst list = this.list;\n\t\tif ( this.index >= pool.length ) {\n\n\t\t\tpool.push( {\n\n\t\t\t\tstart: - 1,\n\t\t\t\tcount: - 1,\n\t\t\t\tz: - 1,\n\n\t\t\t} );\n\n\t\t}\n\n\t\tconst item = pool[ this.index ];\n\t\tlist.push( item );\n\t\tthis.index ++;\n\n\t\titem.start = drawRange.start;\n\t\titem.count = drawRange.count;\n\t\titem.z = z;\n\n\t}\n\n\treset() {\n\n\t\tthis.list.length = 0;\n\t\tthis.index = 0;\n\n\t}\n\n}\n\nconst ID_ATTR_NAME = 'batchId';\nconst _matrix$1 = /*@__PURE__*/ new Matrix4();\nconst _invMatrixWorld = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix = /*@__PURE__*/ new Matrix4();\nconst _projScreenMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _frustum = /*@__PURE__*/ new Frustum();\nconst _box$1 = /*@__PURE__*/ new Box3();\nconst _sphere$2 = /*@__PURE__*/ new Sphere();\nconst _vector$5 = /*@__PURE__*/ new Vector3();\nconst _renderList = /*@__PURE__*/ new MultiDrawRenderList();\nconst _mesh = /*@__PURE__*/ new Mesh();\nconst _batchIntersects = [];\n\n// @TODO: SkinnedMesh support?\n// @TODO: geometry.groups support?\n// @TODO: geometry.drawRange support?\n// @TODO: geometry.morphAttributes support?\n// @TODO: Support uniform parameter per geometry\n// @TODO: Add an \"optimize\" function to pack geometry and remove data gaps\n\n// copies data from attribute \"src\" into \"target\" starting at \"targetOffset\"\nfunction copyAttributeData( src, target, targetOffset = 0 ) {\n\n\tconst itemSize = target.itemSize;\n\tif ( src.isInterleavedBufferAttribute || src.array.constructor !== target.array.constructor ) {\n\n\t\t// use the component getters and setters if the array data cannot\n\t\t// be copied directly\n\t\tconst vertexCount = src.count;\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\n\n\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\ttarget.setComponent( i + targetOffset, c, src.getComponent( i, c ) );\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\t// faster copy approach using typed array set function\n\t\ttarget.array.set( src.array, targetOffset * itemSize );\n\n\t}\n\n\ttarget.needsUpdate = true;\n\n}\n\nclass BatchedMesh extends Mesh {\n\n\tget maxGeometryCount() {\n\n\t\treturn this._maxGeometryCount;\n\n\t}\n\n\tconstructor( maxGeometryCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material ) {\n\n\t\tsuper( new BufferGeometry(), material );\n\n\t\tthis.isBatchedMesh = true;\n\t\tthis.perObjectFrustumCulled = true;\n\t\tthis.sortObjects = true;\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\t\tthis.customSort = null;\n\n\t\tthis._drawRanges = [];\n\t\tthis._reservedRanges = [];\n\n\t\tthis._visibility = [];\n\t\tthis._active = [];\n\t\tthis._bounds = [];\n\n\t\tthis._maxGeometryCount = maxGeometryCount;\n\t\tthis._maxVertexCount = maxVertexCount;\n\t\tthis._maxIndexCount = maxIndexCount;\n\n\t\tthis._geometryInitialized = false;\n\t\tthis._geometryCount = 0;\n\t\tthis._multiDrawCounts = new Int32Array( maxGeometryCount );\n\t\tthis._multiDrawStarts = new Int32Array( maxGeometryCount );\n\t\tthis._multiDrawCount = 0;\n\t\tthis._visibilityChanged = true;\n\n\t\t// Local matrix per geometry by using data texture\n\t\tthis._matricesTexture = null;\n\n\t\tthis._initMatricesTexture();\n\n\t}\n\n\t_initMatricesTexture() {\n\n\t\t// layout (1 matrix = 4 pixels)\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t// with 8x8 pixel texture max 16 matrices * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 matrices * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this._maxGeometryCount * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = Math.ceil( size / 4 ) * 4;\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst matricesArray = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tconst matricesTexture = new DataTexture( matricesArray, size, size, RGBAFormat, FloatType );\n\n\t\tthis._matricesTexture = matricesTexture;\n\n\t}\n\n\t_initializeGeometry( reference ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst maxVertexCount = this._maxVertexCount;\n\t\tconst maxGeometryCount = this._maxGeometryCount;\n\t\tconst maxIndexCount = this._maxIndexCount;\n\t\tif ( this._geometryInitialized === false ) {\n\n\t\t\tfor ( const attributeName in reference.attributes ) {\n\n\t\t\t\tconst srcAttribute = reference.getAttribute( attributeName );\n\t\t\t\tconst { array, itemSize, normalized } = srcAttribute;\n\n\t\t\t\tconst dstArray = new array.constructor( maxVertexCount * itemSize );\n\t\t\t\tconst dstAttribute = new BufferAttribute( dstArray, itemSize, normalized );\n\n\t\t\t\tgeometry.setAttribute( attributeName, dstAttribute );\n\n\t\t\t}\n\n\t\t\tif ( reference.getIndex() !== null ) {\n\n\t\t\t\tconst indexArray = maxVertexCount > 65536\n\t\t\t\t\t? new Uint32Array( maxIndexCount )\n\t\t\t\t\t: new Uint16Array( maxIndexCount );\n\n\t\t\t\tgeometry.setIndex( new BufferAttribute( indexArray, 1 ) );\n\n\t\t\t}\n\n\t\t\tconst idArray = maxGeometryCount > 65536\n\t\t\t\t? new Uint32Array( maxVertexCount )\n\t\t\t\t: new Uint16Array( maxVertexCount );\n\t\t\tgeometry.setAttribute( ID_ATTR_NAME, new BufferAttribute( idArray, 1 ) );\n\n\t\t\tthis._geometryInitialized = true;\n\n\t\t}\n\n\t}\n\n\t// Make sure the geometry is compatible with the existing combined geometry attributes\n\t_validateGeometry( geometry ) {\n\n\t\t// check that the geometry doesn't have a version of our reserved id attribute\n\t\tif ( geometry.getAttribute( ID_ATTR_NAME ) ) {\n\n\t\t\tthrow new Error( `BatchedMesh: Geometry cannot use attribute \"${ ID_ATTR_NAME }\"` );\n\n\t\t}\n\n\t\t// check to ensure the geometries are using consistent attributes and indices\n\t\tconst batchGeometry = this.geometry;\n\t\tif ( Boolean( geometry.getIndex() ) !== Boolean( batchGeometry.getIndex() ) ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: All geometries must consistently have \"index\".' );\n\n\t\t}\n\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\n\n\t\t\tif ( attributeName === ID_ATTR_NAME ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( ! geometry.hasAttribute( attributeName ) ) {\n\n\t\t\t\tthrow new Error( `BatchedMesh: Added geometry missing \"${ attributeName }\". All geometries must have consistent attributes.` );\n\n\t\t\t}\n\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\n\t\t\tif ( srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized ) {\n\n\t\t\t\tthrow new Error( 'BatchedMesh: All attributes must have a consistent itemSize and normalized value.' );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tsetCustomSort( func ) {\n\n\t\tthis.customSort = func;\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst geometryCount = this._geometryCount;\n\t\tconst boundingBox = this.boundingBox;\n\t\tconst active = this._active;\n\n\t\tboundingBox.makeEmpty();\n\t\tfor ( let i = 0; i < geometryCount; i ++ ) {\n\n\t\t\tif ( active[ i ] === false ) continue;\n\n\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\tthis.getBoundingBoxAt( i, _box$1 ).applyMatrix4( _matrix$1 );\n\t\t\tboundingBox.union( _box$1 );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst geometryCount = this._geometryCount;\n\t\tconst boundingSphere = this.boundingSphere;\n\t\tconst active = this._active;\n\n\t\tboundingSphere.makeEmpty();\n\t\tfor ( let i = 0; i < geometryCount; i ++ ) {\n\n\t\t\tif ( active[ i ] === false ) continue;\n\n\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\tthis.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix$1 );\n\t\t\tboundingSphere.union( _sphere$2 );\n\n\t\t}\n\n\t}\n\n\taddGeometry( geometry, vertexCount = - 1, indexCount = - 1 ) {\n\n\t\tthis._initializeGeometry( geometry );\n\n\t\tthis._validateGeometry( geometry );\n\n\t\t// ensure we're not over geometry\n\t\tif ( this._geometryCount >= this._maxGeometryCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum geometry count reached.' );\n\n\t\t}\n\n\t\t// get the necessary range fo the geometry\n\t\tconst reservedRange = {\n\t\t\tvertexStart: - 1,\n\t\t\tvertexCount: - 1,\n\t\t\tindexStart: - 1,\n\t\t\tindexCount: - 1,\n\t\t};\n\n\t\tlet lastRange = null;\n\t\tconst reservedRanges = this._reservedRanges;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst bounds = this._bounds;\n\t\tif ( this._geometryCount !== 0 ) {\n\n\t\t\tlastRange = reservedRanges[ reservedRanges.length - 1 ];\n\n\t\t}\n\n\t\tif ( vertexCount === - 1 ) {\n\n\t\t\treservedRange.vertexCount = geometry.getAttribute( 'position' ).count;\n\n\t\t} else {\n\n\t\t\treservedRange.vertexCount = vertexCount;\n\n\t\t}\n\n\t\tif ( lastRange === null ) {\n\n\t\t\treservedRange.vertexStart = 0;\n\n\t\t} else {\n\n\t\t\treservedRange.vertexStart = lastRange.vertexStart + lastRange.vertexCount;\n\n\t\t}\n\n\t\tconst index = geometry.getIndex();\n\t\tconst hasIndex = index !== null;\n\t\tif ( hasIndex ) {\n\n\t\t\tif ( indexCount\t=== - 1 ) {\n\n\t\t\t\treservedRange.indexCount = index.count;\n\n\t\t\t} else {\n\n\t\t\t\treservedRange.indexCount = indexCount;\n\n\t\t\t}\n\n\t\t\tif ( lastRange === null ) {\n\n\t\t\t\treservedRange.indexStart = 0;\n\n\t\t\t} else {\n\n\t\t\t\treservedRange.indexStart = lastRange.indexStart + lastRange.indexCount;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif (\n\t\t\treservedRange.indexStart !== - 1 &&\n\t\t\treservedRange.indexStart + reservedRange.indexCount > this._maxIndexCount ||\n\t\t\treservedRange.vertexStart + reservedRange.vertexCount > this._maxVertexCount\n\t\t) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Reserved space request exceeds the maximum buffer size.' );\n\n\t\t}\n\n\t\tconst visibility = this._visibility;\n\t\tconst active = this._active;\n\t\tconst matricesTexture = this._matricesTexture;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\n\t\t// push new visibility states\n\t\tvisibility.push( true );\n\t\tactive.push( true );\n\n\t\t// update id\n\t\tconst geometryId = this._geometryCount;\n\t\tthis._geometryCount ++;\n\n\t\t// initialize matrix information\n\t\t_identityMatrix.toArray( matricesArray, geometryId * 16 );\n\t\tmatricesTexture.needsUpdate = true;\n\n\t\t// add the reserved range and draw range objects\n\t\treservedRanges.push( reservedRange );\n\t\tdrawRanges.push( {\n\t\t\tstart: hasIndex ? reservedRange.indexStart : reservedRange.vertexStart,\n\t\t\tcount: - 1\n\t\t} );\n\t\tbounds.push( {\n\t\t\tboxInitialized: false,\n\t\t\tbox: new Box3(),\n\n\t\t\tsphereInitialized: false,\n\t\t\tsphere: new Sphere()\n\t\t} );\n\n\t\t// set the id for the geometry\n\t\tconst idAttribute = this.geometry.getAttribute( ID_ATTR_NAME );\n\t\tfor ( let i = 0; i < reservedRange.vertexCount; i ++ ) {\n\n\t\t\tidAttribute.setX( reservedRange.vertexStart + i, geometryId );\n\n\t\t}\n\n\t\tidAttribute.needsUpdate = true;\n\n\t\t// update the geometry\n\t\tthis.setGeometryAt( geometryId, geometry );\n\n\t\treturn geometryId;\n\n\t}\n\n\tsetGeometryAt( id, geometry ) {\n\n\t\tif ( id >= this._geometryCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum geometry count reached.' );\n\n\t\t}\n\n\t\tthis._validateGeometry( geometry );\n\n\t\tconst batchGeometry = this.geometry;\n\t\tconst hasIndex = batchGeometry.getIndex() !== null;\n\t\tconst dstIndex = batchGeometry.getIndex();\n\t\tconst srcIndex = geometry.getIndex();\n\t\tconst reservedRange = this._reservedRanges[ id ];\n\t\tif (\n\t\t\thasIndex &&\n\t\t\tsrcIndex.count > reservedRange.indexCount ||\n\t\t\tgeometry.attributes.position.count > reservedRange.vertexCount\n\t\t) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Reserved space not large enough for provided geometry.' );\n\n\t\t}\n\n\t\t// copy geometry over\n\t\tconst vertexStart = reservedRange.vertexStart;\n\t\tconst vertexCount = reservedRange.vertexCount;\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\n\n\t\t\tif ( attributeName === ID_ATTR_NAME ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t// copy attribute data\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\n\t\t\tcopyAttributeData( srcAttribute, dstAttribute, vertexStart );\n\n\t\t\t// fill the rest in with zeroes\n\t\t\tconst itemSize = srcAttribute.itemSize;\n\t\t\tfor ( let i = srcAttribute.count, l = vertexCount; i < l; i ++ ) {\n\n\t\t\t\tconst index = vertexStart + i;\n\t\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\t\tdstAttribute.setComponent( index, c, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tdstAttribute.needsUpdate = true;\n\t\t\tdstAttribute.addUpdateRange( vertexStart * itemSize, vertexCount * itemSize );\n\n\t\t}\n\n\t\t// copy index\n\t\tif ( hasIndex ) {\n\n\t\t\tconst indexStart = reservedRange.indexStart;\n\n\t\t\t// copy index data over\n\t\t\tfor ( let i = 0; i < srcIndex.count; i ++ ) {\n\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart + srcIndex.getX( i ) );\n\n\t\t\t}\n\n\t\t\t// fill the rest in with zeroes\n\t\t\tfor ( let i = srcIndex.count, l = reservedRange.indexCount; i < l; i ++ ) {\n\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart );\n\n\t\t\t}\n\n\t\t\tdstIndex.needsUpdate = true;\n\t\t\tdstIndex.addUpdateRange( indexStart, reservedRange.indexCount );\n\n\t\t}\n\n\t\t// store the bounding boxes\n\t\tconst bound = this._bounds[ id ];\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tbound.box.copy( geometry.boundingBox );\n\t\t\tbound.boxInitialized = true;\n\n\t\t} else {\n\n\t\t\tbound.boxInitialized = false;\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere !== null ) {\n\n\t\t\tbound.sphere.copy( geometry.boundingSphere );\n\t\t\tbound.sphereInitialized = true;\n\n\t\t} else {\n\n\t\t\tbound.sphereInitialized = false;\n\n\t\t}\n\n\t\t// set drawRange count\n\t\tconst drawRange = this._drawRanges[ id ];\n\t\tconst posAttr = geometry.getAttribute( 'position' );\n\t\tdrawRange.count = hasIndex ? srcIndex.count : posAttr.count;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn id;\n\n\t}\n\n\tdeleteGeometry( geometryId ) {\n\n\t\t// Note: User needs to call optimize() afterward to pack the data.\n\n\t\tconst active = this._active;\n\t\tif ( geometryId >= active.length || active[ geometryId ] === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tactive[ geometryId ] = false;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\n\t// get bounding box and compute it if it doesn't exist\n\tgetBoundingBoxAt( id, target ) {\n\n\t\tconst active = this._active;\n\t\tif ( active[ id ] === false ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// compute bounding box\n\t\tconst bound = this._bounds[ id ];\n\t\tconst box = bound.box;\n\t\tconst geometry = this.geometry;\n\t\tif ( bound.boxInitialized === false ) {\n\n\t\t\tbox.makeEmpty();\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\t\t\tconst drawRange = this._drawRanges[ id ];\n\t\t\tfor ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {\n\n\t\t\t\tlet iv = i;\n\t\t\t\tif ( index ) {\n\n\t\t\t\t\tiv = index.getX( iv );\n\n\t\t\t\t}\n\n\t\t\t\tbox.expandByPoint( _vector$5.fromBufferAttribute( position, iv ) );\n\n\t\t\t}\n\n\t\t\tbound.boxInitialized = true;\n\n\t\t}\n\n\t\ttarget.copy( box );\n\t\treturn target;\n\n\t}\n\n\t// get bounding sphere and compute it if it doesn't exist\n\tgetBoundingSphereAt( id, target ) {\n\n\t\tconst active = this._active;\n\t\tif ( active[ id ] === false ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// compute bounding sphere\n\t\tconst bound = this._bounds[ id ];\n\t\tconst sphere = bound.sphere;\n\t\tconst geometry = this.geometry;\n\t\tif ( bound.sphereInitialized === false ) {\n\n\t\t\tsphere.makeEmpty();\n\n\t\t\tthis.getBoundingBoxAt( id, _box$1 );\n\t\t\t_box$1.getCenter( sphere.center );\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\t\t\tconst drawRange = this._drawRanges[ id ];\n\n\t\t\tlet maxRadiusSq = 0;\n\t\t\tfor ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {\n\n\t\t\t\tlet iv = i;\n\t\t\t\tif ( index ) {\n\n\t\t\t\t\tiv = index.getX( iv );\n\n\t\t\t\t}\n\n\t\t\t\t_vector$5.fromBufferAttribute( position, iv );\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, sphere.center.distanceToSquared( _vector$5 ) );\n\n\t\t\t}\n\n\t\t\tsphere.radius = Math.sqrt( maxRadiusSq );\n\t\t\tbound.sphereInitialized = true;\n\n\t\t}\n\n\t\ttarget.copy( sphere );\n\t\treturn target;\n\n\t}\n\n\tsetMatrixAt( geometryId, matrix ) {\n\n\t\t// @TODO: Map geometryId to index of the arrays because\n\t\t// optimize() can make geometryId mismatch the index\n\n\t\tconst active = this._active;\n\t\tconst matricesTexture = this._matricesTexture;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\t\tconst geometryCount = this._geometryCount;\n\t\tif ( geometryId >= geometryCount || active[ geometryId ] === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tmatrix.toArray( matricesArray, geometryId * 16 );\n\t\tmatricesTexture.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetMatrixAt( geometryId, matrix ) {\n\n\t\tconst active = this._active;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\t\tconst geometryCount = this._geometryCount;\n\t\tif ( geometryId >= geometryCount || active[ geometryId ] === false ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn matrix.fromArray( matricesArray, geometryId * 16 );\n\n\t}\n\n\tsetVisibleAt( geometryId, value ) {\n\n\t\tconst visibility = this._visibility;\n\t\tconst active = this._active;\n\t\tconst geometryCount = this._geometryCount;\n\n\t\t// if the geometry is out of range, not active, or visibility state\n\t\t// does not change then return early\n\t\tif (\n\t\t\tgeometryId >= geometryCount ||\n\t\t\tactive[ geometryId ] === false ||\n\t\t\tvisibility[ geometryId ] === value\n\t\t) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tvisibility[ geometryId ] = value;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetVisibleAt( geometryId ) {\n\n\t\tconst visibility = this._visibility;\n\t\tconst active = this._active;\n\t\tconst geometryCount = this._geometryCount;\n\n\t\t// return early if the geometry is out of range or not active\n\t\tif ( geometryId >= geometryCount || active[ geometryId ] === false ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn visibility[ geometryId ];\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst visibility = this._visibility;\n\t\tconst active = this._active;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst geometryCount = this._geometryCount;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst batchGeometry = this.geometry;\n\n\t\t// iterate over each geometry\n\t\t_mesh.material = this.material;\n\t\t_mesh.geometry.index = batchGeometry.index;\n\t\t_mesh.geometry.attributes = batchGeometry.attributes;\n\t\tif ( _mesh.geometry.boundingBox === null ) {\n\n\t\t\t_mesh.geometry.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( _mesh.geometry.boundingSphere === null ) {\n\n\t\t\t_mesh.geometry.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tfor ( let i = 0; i < geometryCount; i ++ ) {\n\n\t\t\tif ( ! visibility[ i ] || ! active[ i ] ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst drawRange = drawRanges[ i ];\n\t\t\t_mesh.geometry.setDrawRange( drawRange.start, drawRange.count );\n\n\t\t\t// ge the intersects\n\t\t\tthis.getMatrixAt( i, _mesh.matrixWorld ).premultiply( matrixWorld );\n\t\t\tthis.getBoundingBoxAt( i, _mesh.geometry.boundingBox );\n\t\t\tthis.getBoundingSphereAt( i, _mesh.geometry.boundingSphere );\n\t\t\t_mesh.raycast( raycaster, _batchIntersects );\n\n\t\t\t// add batch id to the intersects\n\t\t\tfor ( let j = 0, l = _batchIntersects.length; j < l; j ++ ) {\n\n\t\t\t\tconst intersect = _batchIntersects[ j ];\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersect.batchId = i;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_batchIntersects.length = 0;\n\n\t\t}\n\n\t\t_mesh.material = null;\n\t\t_mesh.geometry.index = null;\n\t\t_mesh.geometry.attributes = {};\n\t\t_mesh.geometry.setDrawRange( 0, Infinity );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.geometry = source.geometry.clone();\n\t\tthis.perObjectFrustumCulled = source.perObjectFrustumCulled;\n\t\tthis.sortObjects = source.sortObjects;\n\t\tthis.boundingBox = source.boundingBox !== null ? source.boundingBox.clone() : null;\n\t\tthis.boundingSphere = source.boundingSphere !== null ? source.boundingSphere.clone() : null;\n\n\t\tthis._drawRanges = source._drawRanges.map( range => ( { ...range } ) );\n\t\tthis._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );\n\n\t\tthis._visibility = source._visibility.slice();\n\t\tthis._active = source._active.slice();\n\t\tthis._bounds = source._bounds.map( bound => ( {\n\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\tbox: bound.box.clone(),\n\n\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\tsphere: bound.sphere.clone()\n\t\t} ) );\n\n\t\tthis._maxGeometryCount = source._maxGeometryCount;\n\t\tthis._maxVertexCount = source._maxVertexCount;\n\t\tthis._maxIndexCount = source._maxIndexCount;\n\n\t\tthis._geometryInitialized = source._geometryInitialized;\n\t\tthis._geometryCount = source._geometryCount;\n\t\tthis._multiDrawCounts = source._multiDrawCounts.slice();\n\t\tthis._multiDrawStarts = source._multiDrawStarts.slice();\n\n\t\tthis._matricesTexture = source._matricesTexture.clone();\n\t\tthis._matricesTexture.image.data = this._matricesTexture.image.slice();\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\t// Assuming the geometry is not shared with other meshes\n\t\tthis.geometry.dispose();\n\n\t\tthis._matricesTexture.dispose();\n\t\tthis._matricesTexture = null;\n\t\treturn this;\n\n\t}\n\n\tonBeforeRender( renderer, scene, camera, geometry, material/*, _group*/ ) {\n\n\t\t// if visibility has not changed and frustum culling and object sorting is not required\n\t\t// then skip iterating over all items\n\t\tif ( ! this._visibilityChanged && ! this.perObjectFrustumCulled && ! this.sortObjects ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// the indexed version of the multi draw function requires specifying the start\n\t\t// offset in bytes.\n\t\tconst index = geometry.getIndex();\n\t\tconst bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;\n\n\t\tconst active = this._active;\n\t\tconst visibility = this._visibility;\n\t\tconst multiDrawStarts = this._multiDrawStarts;\n\t\tconst multiDrawCounts = this._multiDrawCounts;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst perObjectFrustumCulled = this.perObjectFrustumCulled;\n\n\t\t// prepare the frustum in the local frame\n\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t_projScreenMatrix$2\n\t\t\t\t.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )\n\t\t\t\t.multiply( this.matrixWorld );\n\t\t\t_frustum.setFromProjectionMatrix(\n\t\t\t\t_projScreenMatrix$2,\n\t\t\t\trenderer.coordinateSystem\n\t\t\t);\n\n\t\t}\n\n\t\tlet count = 0;\n\t\tif ( this.sortObjects ) {\n\n\t\t\t// get the camera position in the local frame\n\t\t\t_invMatrixWorld.copy( this.matrixWorld ).invert();\n\t\t\t_vector$5.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _invMatrixWorld );\n\n\t\t\tfor ( let i = 0, l = visibility.length; i < l; i ++ ) {\n\n\t\t\t\tif ( visibility[ i ] && active[ i ] ) {\n\n\t\t\t\t\t// get the bounds in world space\n\t\t\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\t\t\tthis.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix$1 );\n\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\n\t\t\t\t\tlet culled = false;\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t\t\t\tculled = ! _frustum.intersectsSphere( _sphere$2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! culled ) {\n\n\t\t\t\t\t\t// get the distance from camera used for sorting\n\t\t\t\t\t\tconst z = _vector$5.distanceTo( _sphere$2.center );\n\t\t\t\t\t\t_renderList.push( drawRanges[ i ], z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Sort the draw ranges and prep for rendering\n\t\t\tconst list = _renderList.list;\n\t\t\tconst customSort = this.customSort;\n\t\t\tif ( customSort === null ) {\n\n\t\t\t\tlist.sort( material.transparent ? sortTransparent : sortOpaque );\n\n\t\t\t} else {\n\n\t\t\t\tcustomSort.call( this, list, camera );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = list.length; i < l; i ++ ) {\n\n\t\t\t\tconst item = list[ i ];\n\t\t\t\tmultiDrawStarts[ count ] = item.start * bytesPerElement;\n\t\t\t\tmultiDrawCounts[ count ] = item.count;\n\t\t\t\tcount ++;\n\n\t\t\t}\n\n\t\t\t_renderList.reset();\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0, l = visibility.length; i < l; i ++ ) {\n\n\t\t\t\tif ( visibility[ i ] && active[ i ] ) {\n\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\n\t\t\t\t\tlet culled = false;\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t\t\t\t// get the bounds in world space\n\t\t\t\t\t\tthis.getMatrixAt( i, _matrix$1 );\n\t\t\t\t\t\tthis.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix$1 );\n\t\t\t\t\t\tculled = ! _frustum.intersectsSphere( _sphere$2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! culled ) {\n\n\t\t\t\t\t\tconst range = drawRanges[ i ];\n\t\t\t\t\t\tmultiDrawStarts[ count ] = range.start * bytesPerElement;\n\t\t\t\t\t\tmultiDrawCounts[ count ] = range.count;\n\t\t\t\t\t\tcount ++;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._multiDrawCount = count;\n\t\tthis._visibilityChanged = false;\n\n\t}\n\n\tonBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial/* , group */ ) {\n\n\t\tthis.onBeforeRender( renderer, null, shadowCamera, geometry, depthMaterial );\n\n\t}\n\n}\n\nclass LineBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineBasicMaterial = true;\n\n\t\tthis.type = 'LineBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.linewidth = 1;\n\t\tthis.linecap = 'round';\n\t\tthis.linejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.linewidth = source.linewidth;\n\t\tthis.linecap = source.linecap;\n\t\tthis.linejoin = source.linejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _start$1 = /*@__PURE__*/ new Vector3();\nconst _end$1 = /*@__PURE__*/ new Vector3();\nconst _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _ray$1 = /*@__PURE__*/ new Ray();\nconst _sphere$1 = /*@__PURE__*/ new Sphere();\n\nclass Line extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isLine = true;\n\n\t\tthis.type = 'Line';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [ 0 ];\n\n\t\t\tfor ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t_start$1.fromBufferAttribute( positionAttribute, i - 1 );\n\t\t\t\t_end$1.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i ] += _start$1.distanceTo( _end$1 );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Line.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$1.copy( geometry.boundingSphere );\n\t\t_sphere$1.applyMatrix4( matrixWorld );\n\t\t_sphere$1.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$1 ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix$1.copy( matrixWorld ).invert();\n\t\t_ray$1.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$1 );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst vStart = new Vector3();\n\t\tconst vEnd = new Vector3();\n\t\tconst interSegment = new Vector3();\n\t\tconst interRay = new Vector3();\n\t\tconst step = this.isLineSegments ? 2 : 1;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tconst a = index.getX( i );\n\t\t\t\tconst b = index.getX( i + 1 );\n\n\t\t\t\tvStart.fromBufferAttribute( positionAttribute, a );\n\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, b );\n\n\t\t\t\tconst distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tvStart.fromBufferAttribute( positionAttribute, i );\n\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tconst distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nconst _start = /*@__PURE__*/ new Vector3();\nconst _end = /*@__PURE__*/ new Vector3();\n\nclass LineSegments extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineSegments = true;\n\n\t\tthis.type = 'LineSegments';\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [];\n\n\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) {\n\n\t\t\t\t_start.fromBufferAttribute( positionAttribute, i );\n\t\t\t\t_end.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tlineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i + 1 ] = lineDistances[ i ] + _start.distanceTo( _end );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineLoop extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineLoop = true;\n\n\t\tthis.type = 'LineLoop';\n\n\t}\n\n}\n\nclass PointsMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isPointsMaterial = true;\n\n\t\tthis.type = 'PointsMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.size = 1;\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.size = source.size;\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _inverseMatrix = /*@__PURE__*/ new Matrix4();\nconst _ray = /*@__PURE__*/ new Ray();\nconst _sphere = /*@__PURE__*/ new Sphere();\nconst _position$2 = /*@__PURE__*/ new Vector3();\n\nclass Points extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new PointsMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isPoints = true;\n\n\t\tthis.type = 'Points';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Points.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere.copy( geometry.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\t\t_sphere.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix.copy( matrixWorld ).invert();\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, il = end; i < il; i ++ ) {\n\n\t\t\t\tconst a = index.getX( i );\n\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, a );\n\n\t\t\t\ttestPoint( _position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end; i < l; i ++ ) {\n\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\ttestPoint( _position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) {\n\n\tconst rayPointDistanceSq = _ray.distanceSqToPoint( point );\n\n\tif ( rayPointDistanceSq < localThresholdSq ) {\n\n\t\tconst intersectPoint = new Vector3();\n\n\t\t_ray.closestPointToPoint( point, intersectPoint );\n\t\tintersectPoint.applyMatrix4( matrixWorld );\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tdistanceToRay: Math.sqrt( rayPointDistanceSq ),\n\t\t\tpoint: intersectPoint,\n\t\t\tindex: index,\n\t\t\tface: null,\n\t\t\tobject: object\n\n\t\t} );\n\n\t}\n\n}\n\nclass VideoTexture extends Texture {\n\n\tconstructor( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isVideoTexture = true;\n\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : LinearFilter;\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : LinearFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tconst scope = this;\n\n\t\tfunction updateVideo() {\n\n\t\t\tscope.needsUpdate = true;\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t\tif ( 'requestVideoFrameCallback' in video ) {\n\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.image ).copy( this );\n\n\t}\n\n\tupdate() {\n\n\t\tconst video = this.image;\n\t\tconst hasVideoFrameCallback = 'requestVideoFrameCallback' in video;\n\n\t\tif ( hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n}\n\nclass FramebufferTexture extends Texture {\n\n\tconstructor( width, height ) {\n\n\t\tsuper( { width, height } );\n\n\t\tthis.isFramebufferTexture = true;\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nclass CompressedTexture extends Texture {\n\n\tconstructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isCompressedTexture = true;\n\n\t\tthis.image = { width: width, height: height };\n\t\tthis.mipmaps = mipmaps;\n\n\t\t// no flipping for cube textures\n\t\t// (also flipping doesn't work for compressed textures )\n\n\t\tthis.flipY = false;\n\n\t\t// can't generate mipmaps for compressed textures\n\t\t// mips must be embedded in DDS files\n\n\t\tthis.generateMipmaps = false;\n\n\t}\n\n}\n\nclass CompressedArrayTexture extends CompressedTexture {\n\n\tconstructor( mipmaps, width, height, depth, format, type ) {\n\n\t\tsuper( mipmaps, width, height, format, type );\n\n\t\tthis.isCompressedArrayTexture = true;\n\t\tthis.image.depth = depth;\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t}\n\n}\n\nclass CompressedCubeTexture extends CompressedTexture {\n\n\tconstructor( images, format, type ) {\n\n\t\tsuper( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping );\n\n\t\tthis.isCompressedCubeTexture = true;\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.image = images;\n\n\t}\n\n}\n\nclass CanvasTexture extends Texture {\n\n\tconstructor( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isCanvasTexture = true;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\n/**\n * Extensible curve object.\n *\n * Some common of curve methods:\n * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )\n * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )\n * .getPoints(), .getSpacedPoints()\n * .getLength()\n * .updateArcLengths()\n *\n * This following curves inherit from THREE.Curve:\n *\n * -- 2D curves --\n * THREE.ArcCurve\n * THREE.CubicBezierCurve\n * THREE.EllipseCurve\n * THREE.LineCurve\n * THREE.QuadraticBezierCurve\n * THREE.SplineCurve\n *\n * -- 3D curves --\n * THREE.CatmullRomCurve3\n * THREE.CubicBezierCurve3\n * THREE.LineCurve3\n * THREE.QuadraticBezierCurve3\n *\n * A series of curves can be represented as a THREE.CurvePath.\n *\n **/\n\nclass Curve {\n\n\tconstructor() {\n\n\t\tthis.type = 'Curve';\n\n\t\tthis.arcLengthDivisions = 200;\n\n\t}\n\n\t// Virtual base class method to overwrite and implement in subclasses\n\t//\t- t [0 .. 1]\n\n\tgetPoint( /* t, optionalTarget */ ) {\n\n\t\tconsole.warn( 'THREE.Curve: .getPoint() not implemented.' );\n\t\treturn null;\n\n\t}\n\n\t// Get point at relative position in curve according to arc length\n\t// - u [0 .. 1]\n\n\tgetPointAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getPoint( t, optionalTarget );\n\n\t}\n\n\t// Get sequence of points using getPoint( t )\n\n\tgetPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPoint( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get sequence of points using getPointAt( u )\n\n\tgetSpacedPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPointAt( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get total curve arc length\n\n\tgetLength() {\n\n\t\tconst lengths = this.getLengths();\n\t\treturn lengths[ lengths.length - 1 ];\n\n\t}\n\n\t// Get list of cumulative segment lengths\n\n\tgetLengths( divisions = this.arcLengthDivisions ) {\n\n\t\tif ( this.cacheArcLengths &&\n\t\t\t( this.cacheArcLengths.length === divisions + 1 ) &&\n\t\t\t! this.needsUpdate ) {\n\n\t\t\treturn this.cacheArcLengths;\n\n\t\t}\n\n\t\tthis.needsUpdate = false;\n\n\t\tconst cache = [];\n\t\tlet current, last = this.getPoint( 0 );\n\t\tlet sum = 0;\n\n\t\tcache.push( 0 );\n\n\t\tfor ( let p = 1; p <= divisions; p ++ ) {\n\n\t\t\tcurrent = this.getPoint( p / divisions );\n\t\t\tsum += current.distanceTo( last );\n\t\t\tcache.push( sum );\n\t\t\tlast = current;\n\n\t\t}\n\n\t\tthis.cacheArcLengths = cache;\n\n\t\treturn cache; // { sums: cache, sum: sum }; Sum is in the last element.\n\n\t}\n\n\tupdateArcLengths() {\n\n\t\tthis.needsUpdate = true;\n\t\tthis.getLengths();\n\n\t}\n\n\t// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\n\n\tgetUtoTmapping( u, distance ) {\n\n\t\tconst arcLengths = this.getLengths();\n\n\t\tlet i = 0;\n\t\tconst il = arcLengths.length;\n\n\t\tlet targetArcLength; // The targeted u distance value to get\n\n\t\tif ( distance ) {\n\n\t\t\ttargetArcLength = distance;\n\n\t\t} else {\n\n\t\t\ttargetArcLength = u * arcLengths[ il - 1 ];\n\n\t\t}\n\n\t\t// binary search for the index with largest value smaller than target u distance\n\n\t\tlet low = 0, high = il - 1, comparison;\n\n\t\twhile ( low <= high ) {\n\n\t\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n\n\t\t\tcomparison = arcLengths[ i ] - targetArcLength;\n\n\t\t\tif ( comparison < 0 ) {\n\n\t\t\t\tlow = i + 1;\n\n\t\t\t} else if ( comparison > 0 ) {\n\n\t\t\t\thigh = i - 1;\n\n\t\t\t} else {\n\n\t\t\t\thigh = i;\n\t\t\t\tbreak;\n\n\t\t\t\t// DONE\n\n\t\t\t}\n\n\t\t}\n\n\t\ti = high;\n\n\t\tif ( arcLengths[ i ] === targetArcLength ) {\n\n\t\t\treturn i / ( il - 1 );\n\n\t\t}\n\n\t\t// we could get finer grain at lengths, or use simple interpolation between two points\n\n\t\tconst lengthBefore = arcLengths[ i ];\n\t\tconst lengthAfter = arcLengths[ i + 1 ];\n\n\t\tconst segmentLength = lengthAfter - lengthBefore;\n\n\t\t// determine where we are between the 'before' and 'after' points\n\n\t\tconst segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\n\n\t\t// add that fractional amount to t\n\n\t\tconst t = ( i + segmentFraction ) / ( il - 1 );\n\n\t\treturn t;\n\n\t}\n\n\t// Returns a unit vector tangent at t\n\t// In case any sub curve does not implement its tangent derivation,\n\t// 2 points a small delta apart will be used to find its gradient\n\t// which seems to give a reasonable approximation\n\n\tgetTangent( t, optionalTarget ) {\n\n\t\tconst delta = 0.0001;\n\t\tlet t1 = t - delta;\n\t\tlet t2 = t + delta;\n\n\t\t// Capping in case of danger\n\n\t\tif ( t1 < 0 ) t1 = 0;\n\t\tif ( t2 > 1 ) t2 = 1;\n\n\t\tconst pt1 = this.getPoint( t1 );\n\t\tconst pt2 = this.getPoint( t2 );\n\n\t\tconst tangent = optionalTarget || ( ( pt1.isVector2 ) ? new Vector2() : new Vector3() );\n\n\t\ttangent.copy( pt2 ).sub( pt1 ).normalize();\n\n\t\treturn tangent;\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getTangent( t, optionalTarget );\n\n\t}\n\n\tcomputeFrenetFrames( segments, closed ) {\n\n\t\t// see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n\n\t\tconst normal = new Vector3();\n\n\t\tconst tangents = [];\n\t\tconst normals = [];\n\t\tconst binormals = [];\n\n\t\tconst vec = new Vector3();\n\t\tconst mat = new Matrix4();\n\n\t\t// compute the tangent vectors for each segment on the curve\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst u = i / segments;\n\n\t\t\ttangents[ i ] = this.getTangentAt( u, new Vector3() );\n\n\t\t}\n\n\t\t// select an initial normal vector perpendicular to the first tangent vector,\n\t\t// and in the direction of the minimum tangent xyz component\n\n\t\tnormals[ 0 ] = new Vector3();\n\t\tbinormals[ 0 ] = new Vector3();\n\t\tlet min = Number.MAX_VALUE;\n\t\tconst tx = Math.abs( tangents[ 0 ].x );\n\t\tconst ty = Math.abs( tangents[ 0 ].y );\n\t\tconst tz = Math.abs( tangents[ 0 ].z );\n\n\t\tif ( tx <= min ) {\n\n\t\t\tmin = tx;\n\t\t\tnormal.set( 1, 0, 0 );\n\n\t\t}\n\n\t\tif ( ty <= min ) {\n\n\t\t\tmin = ty;\n\t\t\tnormal.set( 0, 1, 0 );\n\n\t\t}\n\n\t\tif ( tz <= min ) {\n\n\t\t\tnormal.set( 0, 0, 1 );\n\n\t\t}\n\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\n\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\n\n\n\t\t// compute the slowly-varying normal and binormal vectors for each segment on the curve\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tnormals[ i ] = normals[ i - 1 ].clone();\n\n\t\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\n\n\t\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\n\n\t\t\tif ( vec.length() > Number.EPSILON ) {\n\n\t\t\t\tvec.normalize();\n\n\t\t\t\tconst theta = Math.acos( clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors\n\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\n\n\t\t\t}\n\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t}\n\n\t\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n\n\t\tif ( closed === true ) {\n\n\t\t\tlet theta = Math.acos( clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );\n\t\t\ttheta /= segments;\n\n\t\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {\n\n\t\t\t\ttheta = - theta;\n\n\t\t\t}\n\n\t\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\t\t// twist a little...\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\n\t\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn {\n\t\t\ttangents: tangents,\n\t\t\tnormals: normals,\n\t\t\tbinormals: binormals\n\t\t};\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.arcLengthDivisions = source.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Curve',\n\t\t\t\tgenerator: 'Curve.toJSON'\n\t\t\t}\n\t\t};\n\n\t\tdata.arcLengthDivisions = this.arcLengthDivisions;\n\t\tdata.type = this.type;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.arcLengthDivisions = json.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass EllipseCurve extends Curve {\n\n\tconstructor( aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.isEllipseCurve = true;\n\n\t\tthis.type = 'EllipseCurve';\n\n\t\tthis.aX = aX;\n\t\tthis.aY = aY;\n\n\t\tthis.xRadius = xRadius;\n\t\tthis.yRadius = yRadius;\n\n\t\tthis.aStartAngle = aStartAngle;\n\t\tthis.aEndAngle = aEndAngle;\n\n\t\tthis.aClockwise = aClockwise;\n\n\t\tthis.aRotation = aRotation;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst twoPi = Math.PI * 2;\n\t\tlet deltaAngle = this.aEndAngle - this.aStartAngle;\n\t\tconst samePoints = Math.abs( deltaAngle ) < Number.EPSILON;\n\n\t\t// ensures that deltaAngle is 0 .. 2 PI\n\t\twhile ( deltaAngle < 0 ) deltaAngle += twoPi;\n\t\twhile ( deltaAngle > twoPi ) deltaAngle -= twoPi;\n\n\t\tif ( deltaAngle < Number.EPSILON ) {\n\n\t\t\tif ( samePoints ) {\n\n\t\t\t\tdeltaAngle = 0;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.aClockwise === true && ! samePoints ) {\n\n\t\t\tif ( deltaAngle === twoPi ) {\n\n\t\t\t\tdeltaAngle = - twoPi;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = deltaAngle - twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst angle = this.aStartAngle + t * deltaAngle;\n\t\tlet x = this.aX + this.xRadius * Math.cos( angle );\n\t\tlet y = this.aY + this.yRadius * Math.sin( angle );\n\n\t\tif ( this.aRotation !== 0 ) {\n\n\t\t\tconst cos = Math.cos( this.aRotation );\n\t\t\tconst sin = Math.sin( this.aRotation );\n\n\t\t\tconst tx = x - this.aX;\n\t\t\tconst ty = y - this.aY;\n\n\t\t\t// Rotate the point about the center of the ellipse.\n\t\t\tx = tx * cos - ty * sin + this.aX;\n\t\t\ty = tx * sin + ty * cos + this.aY;\n\n\t\t}\n\n\t\treturn point.set( x, y );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.aX = source.aX;\n\t\tthis.aY = source.aY;\n\n\t\tthis.xRadius = source.xRadius;\n\t\tthis.yRadius = source.yRadius;\n\n\t\tthis.aStartAngle = source.aStartAngle;\n\t\tthis.aEndAngle = source.aEndAngle;\n\n\t\tthis.aClockwise = source.aClockwise;\n\n\t\tthis.aRotation = source.aRotation;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.aX = this.aX;\n\t\tdata.aY = this.aY;\n\n\t\tdata.xRadius = this.xRadius;\n\t\tdata.yRadius = this.yRadius;\n\n\t\tdata.aStartAngle = this.aStartAngle;\n\t\tdata.aEndAngle = this.aEndAngle;\n\n\t\tdata.aClockwise = this.aClockwise;\n\n\t\tdata.aRotation = this.aRotation;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.aX = json.aX;\n\t\tthis.aY = json.aY;\n\n\t\tthis.xRadius = json.xRadius;\n\t\tthis.yRadius = json.yRadius;\n\n\t\tthis.aStartAngle = json.aStartAngle;\n\t\tthis.aEndAngle = json.aEndAngle;\n\n\t\tthis.aClockwise = json.aClockwise;\n\n\t\tthis.aRotation = json.aRotation;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass ArcCurve extends EllipseCurve {\n\n\tconstructor( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tsuper( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\tthis.isArcCurve = true;\n\n\t\tthis.type = 'ArcCurve';\n\n\t}\n\n}\n\n/**\n * Centripetal CatmullRom Curve - which is useful for avoiding\n * cusps and self-intersections in non-uniform catmull rom curves.\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n *\n * curve.type accepts centripetal(default), chordal and catmullrom\n * curve.tension is used for catmullrom which defaults to 0.5\n */\n\n\n/*\nBased on an optimized c++ solution in\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n - http://ideone.com/NoEbVM\n\nThis CubicPoly class could be used for reusing some variables and calculations,\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\nwhich can be placed in CurveUtils.\n*/\n\nfunction CubicPoly() {\n\n\tlet c0 = 0, c1 = 0, c2 = 0, c3 = 0;\n\n\t/*\n\t * Compute coefficients for a cubic polynomial\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n\t * such that\n\t * p(0) = x0, p(1) = x1\n\t * and\n\t * p'(0) = t0, p'(1) = t1.\n\t */\n\tfunction init( x0, x1, t0, t1 ) {\n\n\t\tc0 = x0;\n\t\tc1 = t0;\n\t\tc2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1;\n\t\tc3 = 2 * x0 - 2 * x1 + t0 + t1;\n\n\t}\n\n\treturn {\n\n\t\tinitCatmullRom: function ( x0, x1, x2, x3, tension ) {\n\n\t\t\tinit( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) );\n\n\t\t},\n\n\t\tinitNonuniformCatmullRom: function ( x0, x1, x2, x3, dt0, dt1, dt2 ) {\n\n\t\t\t// compute tangents when parameterized in [t1,t2]\n\t\t\tlet t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1;\n\t\t\tlet t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2;\n\n\t\t\t// rescale tangents for parametrization in [0,1]\n\t\t\tt1 *= dt1;\n\t\t\tt2 *= dt1;\n\n\t\t\tinit( x1, x2, t1, t2 );\n\n\t\t},\n\n\t\tcalc: function ( t ) {\n\n\t\t\tconst t2 = t * t;\n\t\t\tconst t3 = t2 * t;\n\t\t\treturn c0 + c1 * t + c2 * t2 + c3 * t3;\n\n\t\t}\n\n\t};\n\n}\n\n//\n\nconst tmp = /*@__PURE__*/ new Vector3();\nconst px = /*@__PURE__*/ new CubicPoly();\nconst py = /*@__PURE__*/ new CubicPoly();\nconst pz = /*@__PURE__*/ new CubicPoly();\n\nclass CatmullRomCurve3 extends Curve {\n\n\tconstructor( points = [], closed = false, curveType = 'centripetal', tension = 0.5 ) {\n\n\t\tsuper();\n\n\t\tthis.isCatmullRomCurve3 = true;\n\n\t\tthis.type = 'CatmullRomCurve3';\n\n\t\tthis.points = points;\n\t\tthis.closed = closed;\n\t\tthis.curveType = curveType;\n\t\tthis.tension = tension;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst l = points.length;\n\n\t\tconst p = ( l - ( this.closed ? 0 : 1 ) ) * t;\n\t\tlet intPoint = Math.floor( p );\n\t\tlet weight = p - intPoint;\n\n\t\tif ( this.closed ) {\n\n\t\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l;\n\n\t\t} else if ( weight === 0 && intPoint === l - 1 ) {\n\n\t\t\tintPoint = l - 2;\n\t\t\tweight = 1;\n\n\t\t}\n\n\t\tlet p0, p3; // 4 points (p1 & p2 defined below)\n\n\t\tif ( this.closed || intPoint > 0 ) {\n\n\t\t\tp0 = points[ ( intPoint - 1 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate first point\n\t\t\ttmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );\n\t\t\tp0 = tmp;\n\n\t\t}\n\n\t\tconst p1 = points[ intPoint % l ];\n\t\tconst p2 = points[ ( intPoint + 1 ) % l ];\n\n\t\tif ( this.closed || intPoint + 2 < l ) {\n\n\t\t\tp3 = points[ ( intPoint + 2 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate last point\n\t\t\ttmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] );\n\t\t\tp3 = tmp;\n\n\t\t}\n\n\t\tif ( this.curveType === 'centripetal' || this.curveType === 'chordal' ) {\n\n\t\t\t// init Centripetal / Chordal Catmull-Rom\n\t\t\tconst pow = this.curveType === 'chordal' ? 0.5 : 0.25;\n\t\t\tlet dt0 = Math.pow( p0.distanceToSquared( p1 ), pow );\n\t\t\tlet dt1 = Math.pow( p1.distanceToSquared( p2 ), pow );\n\t\t\tlet dt2 = Math.pow( p2.distanceToSquared( p3 ), pow );\n\n\t\t\t// safety check for repeated points\n\t\t\tif ( dt1 < 1e-4 ) dt1 = 1.0;\n\t\t\tif ( dt0 < 1e-4 ) dt0 = dt1;\n\t\t\tif ( dt2 < 1e-4 ) dt2 = dt1;\n\n\t\t\tpx.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 );\n\t\t\tpy.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 );\n\t\t\tpz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 );\n\n\t\t} else if ( this.curveType === 'catmullrom' ) {\n\n\t\t\tpx.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );\n\t\t\tpy.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );\n\t\t\tpz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );\n\n\t\t}\n\n\t\tpoint.set(\n\t\t\tpx.calc( weight ),\n\t\t\tpy.calc( weight ),\n\t\t\tpz.calc( weight )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\tthis.closed = source.closed;\n\t\tthis.curveType = source.curveType;\n\t\tthis.tension = source.tension;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\tdata.closed = this.closed;\n\t\tdata.curveType = this.curveType;\n\t\tdata.tension = this.tension;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector3().fromArray( point ) );\n\n\t\t}\n\n\t\tthis.closed = json.closed;\n\t\tthis.curveType = json.curveType;\n\t\tthis.tension = json.tension;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Bezier Curves formulas obtained from\n * https://en.wikipedia.org/wiki/B%C3%A9zier_curve\n */\n\nfunction CatmullRom( t, p0, p1, p2, p3 ) {\n\n\tconst v0 = ( p2 - p0 ) * 0.5;\n\tconst v1 = ( p3 - p1 ) * 0.5;\n\tconst t2 = t * t;\n\tconst t3 = t * t2;\n\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n}\n\n//\n\nfunction QuadraticBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * p;\n\n}\n\nfunction QuadraticBezierP1( t, p ) {\n\n\treturn 2 * ( 1 - t ) * t * p;\n\n}\n\nfunction QuadraticBezierP2( t, p ) {\n\n\treturn t * t * p;\n\n}\n\nfunction QuadraticBezier( t, p0, p1, p2 ) {\n\n\treturn QuadraticBezierP0( t, p0 ) + QuadraticBezierP1( t, p1 ) +\n\t\tQuadraticBezierP2( t, p2 );\n\n}\n\n//\n\nfunction CubicBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * k * p;\n\n}\n\nfunction CubicBezierP1( t, p ) {\n\n\tconst k = 1 - t;\n\treturn 3 * k * k * t * p;\n\n}\n\nfunction CubicBezierP2( t, p ) {\n\n\treturn 3 * ( 1 - t ) * t * t * p;\n\n}\n\nfunction CubicBezierP3( t, p ) {\n\n\treturn t * t * t * p;\n\n}\n\nfunction CubicBezier( t, p0, p1, p2, p3 ) {\n\n\treturn CubicBezierP0( t, p0 ) + CubicBezierP1( t, p1 ) + CubicBezierP2( t, p2 ) +\n\t\tCubicBezierP3( t, p3 );\n\n}\n\nclass CubicBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve = true;\n\n\t\tthis.type = 'CubicBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass CubicBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve3 = true;\n\n\t\tthis.type = 'CubicBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y ),\n\t\t\tCubicBezier( t, v0.z, v1.z, v2.z, v3.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineCurve extends Curve {\n\n\tconstructor( v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve = true;\n\n\t\tthis.type = 'LineCurve';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector2() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineCurve3 extends Curve {\n\n\tconstructor( v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve3 = true;\n\n\t\tthis.type = 'LineCurve3';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector3() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve = true;\n\n\t\tthis.type = 'QuadraticBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve3 = true;\n\n\t\tthis.type = 'QuadraticBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y ),\n\t\t\tQuadraticBezier( t, v0.z, v1.z, v2.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass SplineCurve extends Curve {\n\n\tconstructor( points = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isSplineCurve = true;\n\n\t\tthis.type = 'SplineCurve';\n\n\t\tthis.points = points;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst p = ( points.length - 1 ) * t;\n\n\t\tconst intPoint = Math.floor( p );\n\t\tconst weight = p - intPoint;\n\n\t\tconst p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\n\t\tconst p1 = points[ intPoint ];\n\t\tconst p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\n\t\tconst p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\n\n\t\tpoint.set(\n\t\t\tCatmullRom( weight, p0.x, p1.x, p2.x, p3.x ),\n\t\t\tCatmullRom( weight, p0.y, p1.y, p2.y, p3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector2().fromArray( point ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nvar Curves = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tArcCurve: ArcCurve,\n\tCatmullRomCurve3: CatmullRomCurve3,\n\tCubicBezierCurve: CubicBezierCurve,\n\tCubicBezierCurve3: CubicBezierCurve3,\n\tEllipseCurve: EllipseCurve,\n\tLineCurve: LineCurve,\n\tLineCurve3: LineCurve3,\n\tQuadraticBezierCurve: QuadraticBezierCurve,\n\tQuadraticBezierCurve3: QuadraticBezierCurve3,\n\tSplineCurve: SplineCurve\n});\n\n/**************************************************************\n *\tCurved Path - a curve path is simply a array of connected\n * curves, but retains the api of a curve\n **************************************************************/\n\nclass CurvePath extends Curve {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'CurvePath';\n\n\t\tthis.curves = [];\n\t\tthis.autoClose = false; // Automatically closes the path\n\n\t}\n\n\tadd( curve ) {\n\n\t\tthis.curves.push( curve );\n\n\t}\n\n\tclosePath() {\n\n\t\t// Add a line curve if start and end of lines are not connected\n\t\tconst startPoint = this.curves[ 0 ].getPoint( 0 );\n\t\tconst endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 );\n\n\t\tif ( ! startPoint.equals( endPoint ) ) {\n\n\t\t\tconst lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';\n\t\t\tthis.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// To get accurate point with reference to\n\t// entire path distance at time t,\n\t// following has to be done:\n\n\t// 1. Length of each sub path have to be known\n\t// 2. Locate and identify type of curve\n\t// 3. Get t for the curve\n\t// 4. Return curve.getPointAt(t')\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst d = t * this.getLength();\n\t\tconst curveLengths = this.getCurveLengths();\n\t\tlet i = 0;\n\n\t\t// To think about boundaries points.\n\n\t\twhile ( i < curveLengths.length ) {\n\n\t\t\tif ( curveLengths[ i ] >= d ) {\n\n\t\t\t\tconst diff = curveLengths[ i ] - d;\n\t\t\t\tconst curve = this.curves[ i ];\n\n\t\t\t\tconst segmentLength = curve.getLength();\n\t\t\t\tconst u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n\n\t\t\t\treturn curve.getPointAt( u, optionalTarget );\n\n\t\t\t}\n\n\t\t\ti ++;\n\n\t\t}\n\n\t\treturn null;\n\n\t\t// loop where sum != 0, sum > d , sum+1 1 && ! points[ points.length - 1 ].equals( points[ 0 ] ) ) {\n\n\t\t\tpoints.push( points[ 0 ] );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = source.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = source.curves[ i ];\n\n\t\t\tthis.curves.push( curve.clone() );\n\n\t\t}\n\n\t\tthis.autoClose = source.autoClose;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.autoClose = this.autoClose;\n\t\tdata.curves = [];\n\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = this.curves[ i ];\n\t\t\tdata.curves.push( curve.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.autoClose = json.autoClose;\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = json.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = json.curves[ i ];\n\t\t\tthis.curves.push( new Curves[ curve.type ]().fromJSON( curve ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Path extends CurvePath {\n\n\tconstructor( points ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Path';\n\n\t\tthis.currentPoint = new Vector2();\n\n\t\tif ( points ) {\n\n\t\t\tthis.setFromPoints( points );\n\n\t\t}\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\n\n\t\tfor ( let i = 1, l = points.length; i < l; i ++ ) {\n\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tconst curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tconst curve = new QuadraticBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCPx, aCPy ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tconst curve = new CubicBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCP1x, aCP1y ),\n\t\t\tnew Vector2( aCP2x, aCP2y ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts /*Array of Vector*/ ) {\n\n\t\tconst npts = [ this.currentPoint.clone() ].concat( pts );\n\n\t\tconst curve = new SplineCurve( npts );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\n\n\t\treturn this;\n\n\t}\n\n\tarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\n\t\t\taStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tabsarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\treturn this;\n\n\t}\n\n\tabsellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\tif ( this.curves.length > 0 ) {\n\n\t\t\t// if a previous curve is present, attempt to join\n\t\t\tconst firstPoint = curve.getPoint( 0 );\n\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\n\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.curves.push( curve );\n\n\t\tconst lastPoint = curve.getPoint( 1 );\n\t\tthis.currentPoint.copy( lastPoint );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.currentPoint.copy( source.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.currentPoint = this.currentPoint.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.currentPoint.fromArray( json.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LatheGeometry extends BufferGeometry {\n\n\tconstructor( points = [ new Vector2( 0, - 0.5 ), new Vector2( 0.5, 0 ), new Vector2( 0, 0.5 ) ], segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'LatheGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpoints: points,\n\t\t\tsegments: segments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength\n\t\t};\n\n\t\tsegments = Math.floor( segments );\n\n\t\t// clamp phiLength so it's in range of [ 0, 2PI ]\n\n\t\tphiLength = clamp( phiLength, 0, Math.PI * 2 );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst uvs = [];\n\t\tconst initNormals = [];\n\t\tconst normals = [];\n\n\t\t// helper variables\n\n\t\tconst inverseSegments = 1.0 / segments;\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tconst normal = new Vector3();\n\t\tconst curNormal = new Vector3();\n\t\tconst prevNormal = new Vector3();\n\t\tlet dx = 0;\n\t\tlet dy = 0;\n\n\t\t// pre-compute normals for initial \"meridian\"\n\n\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\tswitch ( j ) {\n\n\t\t\t\tcase 0:\t\t\t\t// special handling for 1st vertex on path\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tprevNormal.copy( normal );\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ( points.length - 1 ):\t// special handling for last Vertex on path\n\n\t\t\t\t\tinitNormals.push( prevNormal.x, prevNormal.y, prevNormal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\t\t\t// default handling for all vertices in between\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tcurNormal.copy( normal );\n\n\t\t\t\t\tnormal.x += prevNormal.x;\n\t\t\t\t\tnormal.y += prevNormal.y;\n\t\t\t\t\tnormal.z += prevNormal.z;\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tprevNormal.copy( curNormal );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate vertices, uvs and normals\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst phi = phiStart + i * inverseSegments * phiLength;\n\n\t\t\tconst sin = Math.sin( phi );\n\t\t\tconst cos = Math.cos( phi );\n\n\t\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = points[ j ].x * sin;\n\t\t\t\tvertex.y = points[ j ].y;\n\t\t\t\tvertex.z = points[ j ].x * cos;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = i / segments;\n\t\t\t\tuv.y = j / ( points.length - 1 );\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// normal\n\n\t\t\t\tconst x = initNormals[ 3 * j + 0 ] * sin;\n\t\t\t\tconst y = initNormals[ 3 * j + 1 ];\n\t\t\t\tconst z = initNormals[ 3 * j + 0 ] * cos;\n\n\t\t\t\tnormals.push( x, y, z );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 0; i < segments; i ++ ) {\n\n\t\t\tfor ( let j = 0; j < ( points.length - 1 ); j ++ ) {\n\n\t\t\t\tconst base = j + i * points.length;\n\n\t\t\t\tconst a = base;\n\t\t\t\tconst b = base + points.length;\n\t\t\t\tconst c = base + points.length + 1;\n\t\t\t\tconst d = base + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( c, d, b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new LatheGeometry( data.points, data.segments, data.phiStart, data.phiLength );\n\n\t}\n\n}\n\nclass CapsuleGeometry extends LatheGeometry {\n\n\tconstructor( radius = 1, length = 1, capSegments = 4, radialSegments = 8 ) {\n\n\t\tconst path = new Path();\n\t\tpath.absarc( 0, - length / 2, radius, Math.PI * 1.5, 0 );\n\t\tpath.absarc( 0, length / 2, radius, 0, Math.PI * 0.5 );\n\n\t\tsuper( path.getPoints( capSegments ), radialSegments );\n\n\t\tthis.type = 'CapsuleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tlength: length,\n\t\t\tcapSegments: capSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CapsuleGeometry( data.radius, data.length, data.capSegments, data.radialSegments );\n\n\t}\n\n}\n\nclass CircleGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CircleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tsegments: segments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tsegments = Math.max( 3, segments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// center point\n\n\t\tvertices.push( 0, 0, 0 );\n\t\tnormals.push( 0, 0, 1 );\n\t\tuvs.push( 0.5, 0.5 );\n\n\t\tfor ( let s = 0, i = 3; s <= segments; s ++, i += 3 ) {\n\n\t\t\tconst segment = thetaStart + s / segments * thetaLength;\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal\n\n\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t// uvs\n\n\t\t\tuv.x = ( vertices[ i ] / radius + 1 ) / 2;\n\t\t\tuv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;\n\n\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tindices.push( i, i + 1, 0 );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CircleGeometry( data.radius, data.segments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass CylinderGeometry extends BufferGeometry {\n\n\tconstructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CylinderGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradiusTop: radiusTop,\n\t\t\tradiusBottom: radiusBottom,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tconst scope = this;\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet index = 0;\n\t\tconst indexArray = [];\n\t\tconst halfHeight = height / 2;\n\t\tlet groupStart = 0;\n\n\t\t// generate geometry\n\n\t\tgenerateTorso();\n\n\t\tif ( openEnded === false ) {\n\n\t\t\tif ( radiusTop > 0 ) generateCap( true );\n\t\t\tif ( radiusBottom > 0 ) generateCap( false );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction generateTorso() {\n\n\t\t\tconst normal = new Vector3();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\t// this will be used to calculate the normal\n\t\t\tconst slope = ( radiusBottom - radiusTop ) / height;\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let y = 0; y <= heightSegments; y ++ ) {\n\n\t\t\t\tconst indexRow = [];\n\n\t\t\t\tconst v = y / heightSegments;\n\n\t\t\t\t// calculate the radius of the current row\n\n\t\t\t\tconst radius = v * ( radiusBottom - radiusTop ) + radiusTop;\n\n\t\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\t\tconst u = x / radialSegments;\n\n\t\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\t\tconst sinTheta = Math.sin( theta );\n\t\t\t\t\tconst cosTheta = Math.cos( theta );\n\n\t\t\t\t\t// vertex\n\n\t\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\t\tvertex.y = - v * height + halfHeight;\n\t\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t\t// normal\n\n\t\t\t\t\tnormal.set( sinTheta, slope, cosTheta ).normalize();\n\t\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\t// uv\n\n\t\t\t\t\tuvs.push( u, 1 - v );\n\n\t\t\t\t\t// save index of vertex in respective row\n\n\t\t\t\t\tindexRow.push( index ++ );\n\n\t\t\t\t}\n\n\t\t\t\t// now save vertices of the row in our index array\n\n\t\t\t\tindexArray.push( indexRow );\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tfor ( let y = 0; y < heightSegments; y ++ ) {\n\n\t\t\t\t\t// we use the index array to access the correct indices\n\n\t\t\t\t\tconst a = indexArray[ y ][ x ];\n\t\t\t\t\tconst b = indexArray[ y + 1 ][ x ];\n\t\t\t\t\tconst c = indexArray[ y + 1 ][ x + 1 ];\n\t\t\t\t\tconst d = indexArray[ y ][ x + 1 ];\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// update group counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, 0 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t\tfunction generateCap( top ) {\n\n\t\t\t// save the index of the first center vertex\n\t\t\tconst centerIndexStart = index;\n\n\t\t\tconst uv = new Vector2();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst radius = ( top === true ) ? radiusTop : radiusBottom;\n\t\t\tconst sign = ( top === true ) ? 1 : - 1;\n\n\t\t\t// first we generate the center vertex data of the cap.\n\t\t\t// because the geometry needs one set of uvs per face,\n\t\t\t// we must generate a center vertex per face/segment\n\n\t\t\tfor ( let x = 1; x <= radialSegments; x ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertices.push( 0, halfHeight * sign, 0 );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( 0.5, 0.5 );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// save the index of the last center vertex\n\t\t\tconst centerIndexEnd = index;\n\n\t\t\t// now we generate the surrounding vertices, normals and uvs\n\n\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\tconst u = x / radialSegments;\n\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\tconst cosTheta = Math.cos( theta );\n\t\t\t\tconst sinTheta = Math.sin( theta );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\tvertex.y = halfHeight * sign;\n\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( cosTheta * 0.5 ) + 0.5;\n\t\t\t\tuv.y = ( sinTheta * 0.5 * sign ) + 0.5;\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tconst c = centerIndexStart + x;\n\t\t\t\tconst i = centerIndexEnd + x;\n\n\t\t\t\tif ( top === true ) {\n\n\t\t\t\t\t// face top\n\n\t\t\t\t\tindices.push( i, i + 1, c );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// face bottom\n\n\t\t\t\t\tindices.push( i + 1, i, c );\n\n\t\t\t\t}\n\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CylinderGeometry( data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ConeGeometry extends CylinderGeometry {\n\n\tconstructor( radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper( 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );\n\n\t\tthis.type = 'ConeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new ConeGeometry( data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass PolyhedronGeometry extends BufferGeometry {\n\n\tconstructor( vertices = [], indices = [], radius = 1, detail = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PolyhedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tvertices: vertices,\n\t\t\tindices: indices,\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t\t// default buffer data\n\n\t\tconst vertexBuffer = [];\n\t\tconst uvBuffer = [];\n\n\t\t// the subdivision creates the vertex buffer data\n\n\t\tsubdivide( detail );\n\n\t\t// all vertices should lie on a conceptual sphere with a given radius\n\n\t\tapplyRadius( radius );\n\n\t\t// finally, create the uv data\n\n\t\tgenerateUVs();\n\n\t\t// build non-indexed geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );\n\n\t\tif ( detail === 0 ) {\n\n\t\t\tthis.computeVertexNormals(); // flat normals\n\n\t\t} else {\n\n\t\t\tthis.normalizeNormals(); // smooth normals\n\n\t\t}\n\n\t\t// helper functions\n\n\t\tfunction subdivide( detail ) {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\t// iterate over all faces and apply a subdivision with the given detail value\n\n\t\t\tfor ( let i = 0; i < indices.length; i += 3 ) {\n\n\t\t\t\t// get the vertices of the face\n\n\t\t\t\tgetVertexByIndex( indices[ i + 0 ], a );\n\t\t\t\tgetVertexByIndex( indices[ i + 1 ], b );\n\t\t\t\tgetVertexByIndex( indices[ i + 2 ], c );\n\n\t\t\t\t// perform subdivision\n\n\t\t\t\tsubdivideFace( a, b, c, detail );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction subdivideFace( a, b, c, detail ) {\n\n\t\t\tconst cols = detail + 1;\n\n\t\t\t// we use this multidimensional array as a data structure for creating the subdivision\n\n\t\t\tconst v = [];\n\n\t\t\t// construct all of the vertices for this subdivision\n\n\t\t\tfor ( let i = 0; i <= cols; i ++ ) {\n\n\t\t\t\tv[ i ] = [];\n\n\t\t\t\tconst aj = a.clone().lerp( c, i / cols );\n\t\t\t\tconst bj = b.clone().lerp( c, i / cols );\n\n\t\t\t\tconst rows = cols - i;\n\n\t\t\t\tfor ( let j = 0; j <= rows; j ++ ) {\n\n\t\t\t\t\tif ( j === 0 && i === cols ) {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj.clone().lerp( bj, j / rows );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// construct all of the faces\n\n\t\t\tfor ( let i = 0; i < cols; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {\n\n\t\t\t\t\tconst k = Math.floor( j / 2 );\n\n\t\t\t\t\tif ( j % 2 === 0 ) {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\t\t\t\t\t\tpushVertex( v[ i ][ k ] );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction applyRadius( radius ) {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\t// iterate over the entire buffer and apply the radius to each vertex\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tvertex.normalize().multiplyScalar( radius );\n\n\t\t\t\tvertexBuffer[ i + 0 ] = vertex.x;\n\t\t\t\tvertexBuffer[ i + 1 ] = vertex.y;\n\t\t\t\tvertexBuffer[ i + 2 ] = vertex.z;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tconst u = azimuth( vertex ) / 2 / Math.PI + 0.5;\n\t\t\t\tconst v = inclination( vertex ) / Math.PI + 0.5;\n\t\t\t\tuvBuffer.push( u, 1 - v );\n\n\t\t\t}\n\n\t\t\tcorrectUVs();\n\n\t\t\tcorrectSeam();\n\n\t\t}\n\n\t\tfunction correctSeam() {\n\n\t\t\t// handle case when face straddles the seam, see #3269\n\n\t\t\tfor ( let i = 0; i < uvBuffer.length; i += 6 ) {\n\n\t\t\t\t// uv data of a single face\n\n\t\t\t\tconst x0 = uvBuffer[ i + 0 ];\n\t\t\t\tconst x1 = uvBuffer[ i + 2 ];\n\t\t\t\tconst x2 = uvBuffer[ i + 4 ];\n\n\t\t\t\tconst max = Math.max( x0, x1, x2 );\n\t\t\t\tconst min = Math.min( x0, x1, x2 );\n\n\t\t\t\t// 0.9 is somewhat arbitrary\n\n\t\t\t\tif ( max > 0.9 && min < 0.1 ) {\n\n\t\t\t\t\tif ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1;\n\t\t\t\t\tif ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1;\n\t\t\t\t\tif ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction pushVertex( vertex ) {\n\n\t\t\tvertexBuffer.push( vertex.x, vertex.y, vertex.z );\n\n\t\t}\n\n\t\tfunction getVertexByIndex( index, vertex ) {\n\n\t\t\tconst stride = index * 3;\n\n\t\t\tvertex.x = vertices[ stride + 0 ];\n\t\t\tvertex.y = vertices[ stride + 1 ];\n\t\t\tvertex.z = vertices[ stride + 2 ];\n\n\t\t}\n\n\t\tfunction correctUVs() {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\tconst centroid = new Vector3();\n\n\t\t\tconst uvA = new Vector2();\n\t\t\tconst uvB = new Vector2();\n\t\t\tconst uvC = new Vector2();\n\n\t\t\tfor ( let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) {\n\n\t\t\t\ta.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] );\n\t\t\t\tb.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] );\n\t\t\t\tc.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] );\n\n\t\t\t\tuvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] );\n\t\t\t\tuvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] );\n\t\t\t\tuvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] );\n\n\t\t\t\tcentroid.copy( a ).add( b ).add( c ).divideScalar( 3 );\n\n\t\t\t\tconst azi = azimuth( centroid );\n\n\t\t\t\tcorrectUV( uvA, j + 0, a, azi );\n\t\t\t\tcorrectUV( uvB, j + 2, b, azi );\n\t\t\t\tcorrectUV( uvC, j + 4, c, azi );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction correctUV( uv, stride, vector, azimuth ) {\n\n\t\t\tif ( ( azimuth < 0 ) && ( uv.x === 1 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = uv.x - 1;\n\n\t\t\t}\n\n\t\t\tif ( ( vector.x === 0 ) && ( vector.z === 0 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Angle around the Y axis, counter-clockwise when looking from above.\n\n\t\tfunction azimuth( vector ) {\n\n\t\t\treturn Math.atan2( vector.z, - vector.x );\n\n\t\t}\n\n\n\t\t// Angle above the XZ plane.\n\n\t\tfunction inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.details );\n\n\t}\n\n}\n\nclass DodecahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\t\tconst r = 1 / t;\n\n\t\tconst vertices = [\n\n\t\t\t// (±1, ±1, ±1)\n\t\t\t- 1, - 1, - 1,\t- 1, - 1, 1,\n\t\t\t- 1, 1, - 1, - 1, 1, 1,\n\t\t\t1, - 1, - 1, 1, - 1, 1,\n\t\t\t1, 1, - 1, 1, 1, 1,\n\n\t\t\t// (0, ±1/φ, ±φ)\n\t\t\t0, - r, - t, 0, - r, t,\n\t\t\t0, r, - t, 0, r, t,\n\n\t\t\t// (±1/φ, ±φ, 0)\n\t\t\t- r, - t, 0, - r, t, 0,\n\t\t\tr, - t, 0, r, t, 0,\n\n\t\t\t// (±φ, 0, ±1/φ)\n\t\t\t- t, 0, - r, t, 0, - r,\n\t\t\t- t, 0, r, t, 0, r\n\t\t];\n\n\t\tconst indices = [\n\t\t\t3, 11, 7, \t3, 7, 15, \t3, 15, 13,\n\t\t\t7, 19, 17, \t7, 17, 6, \t7, 6, 15,\n\t\t\t17, 4, 8, \t17, 8, 10, \t17, 10, 6,\n\t\t\t8, 0, 16, \t8, 16, 2, \t8, 2, 10,\n\t\t\t0, 12, 1, \t0, 1, 18, \t0, 18, 16,\n\t\t\t6, 10, 2, \t6, 2, 13, \t6, 13, 15,\n\t\t\t2, 16, 18, \t2, 18, 3, \t2, 3, 13,\n\t\t\t18, 1, 9, \t18, 9, 11, \t18, 11, 3,\n\t\t\t4, 14, 12, \t4, 12, 0, \t4, 0, 8,\n\t\t\t11, 9, 5, \t11, 5, 19, \t11, 19, 7,\n\t\t\t19, 5, 14, \t19, 14, 4, \t19, 4, 17,\n\t\t\t1, 12, 14, \t1, 14, 5, \t1, 5, 9\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'DodecahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new DodecahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nconst _v0 = /*@__PURE__*/ new Vector3();\nconst _v1$1 = /*@__PURE__*/ new Vector3();\nconst _normal = /*@__PURE__*/ new Vector3();\nconst _triangle = /*@__PURE__*/ new Triangle();\n\nclass EdgesGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null, thresholdAngle = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'EdgesGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry,\n\t\t\tthresholdAngle: thresholdAngle\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\tconst precisionPoints = 4;\n\t\t\tconst precision = Math.pow( 10, precisionPoints );\n\t\t\tconst thresholdDot = Math.cos( DEG2RAD * thresholdAngle );\n\n\t\t\tconst indexAttr = geometry.getIndex();\n\t\t\tconst positionAttr = geometry.getAttribute( 'position' );\n\t\t\tconst indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n\n\t\t\tconst indexArr = [ 0, 0, 0 ];\n\t\t\tconst vertKeys = [ 'a', 'b', 'c' ];\n\t\t\tconst hashes = new Array( 3 );\n\n\t\t\tconst edgeData = {};\n\t\t\tconst vertices = [];\n\t\t\tfor ( let i = 0; i < indexCount; i += 3 ) {\n\n\t\t\t\tif ( indexAttr ) {\n\n\t\t\t\t\tindexArr[ 0 ] = indexAttr.getX( i );\n\t\t\t\t\tindexArr[ 1 ] = indexAttr.getX( i + 1 );\n\t\t\t\t\tindexArr[ 2 ] = indexAttr.getX( i + 2 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindexArr[ 0 ] = i;\n\t\t\t\t\tindexArr[ 1 ] = i + 1;\n\t\t\t\t\tindexArr[ 2 ] = i + 2;\n\n\t\t\t\t}\n\n\t\t\t\tconst { a, b, c } = _triangle;\n\t\t\t\ta.fromBufferAttribute( positionAttr, indexArr[ 0 ] );\n\t\t\t\tb.fromBufferAttribute( positionAttr, indexArr[ 1 ] );\n\t\t\t\tc.fromBufferAttribute( positionAttr, indexArr[ 2 ] );\n\t\t\t\t_triangle.getNormal( _normal );\n\n\t\t\t\t// create hashes for the edge from the vertices\n\t\t\t\thashes[ 0 ] = `${ Math.round( a.x * precision ) },${ Math.round( a.y * precision ) },${ Math.round( a.z * precision ) }`;\n\t\t\t\thashes[ 1 ] = `${ Math.round( b.x * precision ) },${ Math.round( b.y * precision ) },${ Math.round( b.z * precision ) }`;\n\t\t\t\thashes[ 2 ] = `${ Math.round( c.x * precision ) },${ Math.round( c.y * precision ) },${ Math.round( c.z * precision ) }`;\n\n\t\t\t\t// skip degenerate triangles\n\t\t\t\tif ( hashes[ 0 ] === hashes[ 1 ] || hashes[ 1 ] === hashes[ 2 ] || hashes[ 2 ] === hashes[ 0 ] ) {\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\t// iterate over every edge\n\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t// get the first and next vertex making up the edge\n\t\t\t\t\tconst jNext = ( j + 1 ) % 3;\n\t\t\t\t\tconst vecHash0 = hashes[ j ];\n\t\t\t\t\tconst vecHash1 = hashes[ jNext ];\n\t\t\t\t\tconst v0 = _triangle[ vertKeys[ j ] ];\n\t\t\t\t\tconst v1 = _triangle[ vertKeys[ jNext ] ];\n\n\t\t\t\t\tconst hash = `${ vecHash0 }_${ vecHash1 }`;\n\t\t\t\t\tconst reverseHash = `${ vecHash1 }_${ vecHash0 }`;\n\n\t\t\t\t\tif ( reverseHash in edgeData && edgeData[ reverseHash ] ) {\n\n\t\t\t\t\t\t// if we found a sibling edge add it into the vertex array if\n\t\t\t\t\t\t// it meets the angle threshold and delete the edge from the map.\n\t\t\t\t\t\tif ( _normal.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) {\n\n\t\t\t\t\t\t\tvertices.push( v0.x, v0.y, v0.z );\n\t\t\t\t\t\t\tvertices.push( v1.x, v1.y, v1.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tedgeData[ reverseHash ] = null;\n\n\t\t\t\t\t} else if ( ! ( hash in edgeData ) ) {\n\n\t\t\t\t\t\t// if we've already got an edge here then skip adding a new one\n\t\t\t\t\t\tedgeData[ hash ] = {\n\n\t\t\t\t\t\t\tindex0: indexArr[ j ],\n\t\t\t\t\t\t\tindex1: indexArr[ jNext ],\n\t\t\t\t\t\t\tnormal: _normal.clone(),\n\n\t\t\t\t\t\t};\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// iterate over all remaining, unmatched edges and add them to the vertex array\n\t\t\tfor ( const key in edgeData ) {\n\n\t\t\t\tif ( edgeData[ key ] ) {\n\n\t\t\t\t\tconst { index0, index1 } = edgeData[ key ];\n\t\t\t\t\t_v0.fromBufferAttribute( positionAttr, index0 );\n\t\t\t\t\t_v1$1.fromBufferAttribute( positionAttr, index1 );\n\n\t\t\t\t\tvertices.push( _v0.x, _v0.y, _v0.z );\n\t\t\t\t\tvertices.push( _v1$1.x, _v1$1.y, _v1$1.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Shape extends Path {\n\n\tconstructor( points ) {\n\n\t\tsuper( points );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.type = 'Shape';\n\n\t\tthis.holes = [];\n\n\t}\n\n\tgetPointsHoles( divisions ) {\n\n\t\tconst holesPts = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tholesPts[ i ] = this.holes[ i ].getPoints( divisions );\n\n\t\t}\n\n\t\treturn holesPts;\n\n\t}\n\n\t// get points of shape and holes (keypoints based on segments parameter)\n\n\textractPoints( divisions ) {\n\n\t\treturn {\n\n\t\t\tshape: this.getPoints( divisions ),\n\t\t\tholes: this.getPointsHoles( divisions )\n\n\t\t};\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = source.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = source.holes[ i ];\n\n\t\t\tthis.holes.push( hole.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.holes = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = this.holes[ i ];\n\t\t\tdata.holes.push( hole.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.uuid = json.uuid;\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = json.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = json.holes[ i ];\n\t\t\tthis.holes.push( new Path().fromJSON( hole ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Port from https://github.com/mapbox/earcut (v2.2.4)\n */\n\nconst Earcut = {\n\n\ttriangulate: function ( data, holeIndices, dim = 2 ) {\n\n\t\tconst hasHoles = holeIndices && holeIndices.length;\n\t\tconst outerLen = hasHoles ? holeIndices[ 0 ] * dim : data.length;\n\t\tlet outerNode = linkedList( data, 0, outerLen, dim, true );\n\t\tconst triangles = [];\n\n\t\tif ( ! outerNode || outerNode.next === outerNode.prev ) return triangles;\n\n\t\tlet minX, minY, maxX, maxY, x, y, invSize;\n\n\t\tif ( hasHoles ) outerNode = eliminateHoles( data, holeIndices, outerNode, dim );\n\n\t\t// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t\tif ( data.length > 80 * dim ) {\n\n\t\t\tminX = maxX = data[ 0 ];\n\t\t\tminY = maxY = data[ 1 ];\n\n\t\t\tfor ( let i = dim; i < outerLen; i += dim ) {\n\n\t\t\t\tx = data[ i ];\n\t\t\t\ty = data[ i + 1 ];\n\t\t\t\tif ( x < minX ) minX = x;\n\t\t\t\tif ( y < minY ) minY = y;\n\t\t\t\tif ( x > maxX ) maxX = x;\n\t\t\t\tif ( y > maxY ) maxY = y;\n\n\t\t\t}\n\n\t\t\t// minX, minY and invSize are later used to transform coords into integers for z-order calculation\n\t\t\tinvSize = Math.max( maxX - minX, maxY - minY );\n\t\t\tinvSize = invSize !== 0 ? 32767 / invSize : 0;\n\n\t\t}\n\n\t\tearcutLinked( outerNode, triangles, dim, minX, minY, invSize, 0 );\n\n\t\treturn triangles;\n\n\t}\n\n};\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList( data, start, end, dim, clockwise ) {\n\n\tlet i, last;\n\n\tif ( clockwise === ( signedArea( data, start, end, dim ) > 0 ) ) {\n\n\t\tfor ( i = start; i < end; i += dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t} else {\n\n\t\tfor ( i = end - dim; i >= start; i -= dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t}\n\n\tif ( last && equals( last, last.next ) ) {\n\n\t\tremoveNode( last );\n\t\tlast = last.next;\n\n\t}\n\n\treturn last;\n\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tlet p = start,\n\t\tagain;\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked( ear, triangles, dim, minX, minY, invSize, pass ) {\n\n\tif ( ! ear ) return;\n\n\t// interlink polygon nodes in z-order\n\tif ( ! pass && invSize ) indexCurve( ear, minX, minY, invSize );\n\n\tlet stop = ear,\n\t\tprev, next;\n\n\t// iterate through ears, slicing them one by one\n\twhile ( ear.prev !== ear.next ) {\n\n\t\tprev = ear.prev;\n\t\tnext = ear.next;\n\n\t\tif ( invSize ? isEarHashed( ear, minX, minY, invSize ) : isEar( ear ) ) {\n\n\t\t\t// cut off the triangle\n\t\t\ttriangles.push( prev.i / dim | 0 );\n\t\t\ttriangles.push( ear.i / dim | 0 );\n\t\t\ttriangles.push( next.i / dim | 0 );\n\n\t\t\tremoveNode( ear );\n\n\t\t\t// skipping the next vertex leads to less sliver triangles\n\t\t\tear = next.next;\n\t\t\tstop = next.next;\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\tear = next;\n\n\t\t// if we looped through the whole remaining polygon and can't find any more ears\n\t\tif ( ear === stop ) {\n\n\t\t\t// try filtering points and slicing again\n\t\t\tif ( ! pass ) {\n\n\t\t\t\tearcutLinked( filterPoints( ear ), triangles, dim, minX, minY, invSize, 1 );\n\n\t\t\t\t// if this didn't work, try curing all small self-intersections locally\n\n\t\t\t} else if ( pass === 1 ) {\n\n\t\t\t\tear = cureLocalIntersections( filterPoints( ear ), triangles, dim );\n\t\t\t\tearcutLinked( ear, triangles, dim, minX, minY, invSize, 2 );\n\n\t\t\t\t// as a last resort, try splitting the remaining polygon into two\n\n\t\t\t} else if ( pass === 2 ) {\n\n\t\t\t\tsplitEarcut( ear, triangles, dim, minX, minY, invSize );\n\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar( ear ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\t// now make sure we don't have other points inside the potential ear\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\tlet p = c.next;\n\twhile ( p !== a ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.next;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction isEarHashed( ear, minX, minY, invSize ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\t// z-order range for the current triangle bbox;\n\tconst minZ = zOrder( x0, y0, minX, minY, invSize ),\n\t\tmaxZ = zOrder( x1, y1, minX, minY, invSize );\n\n\tlet p = ear.prevZ,\n\t\tn = ear.nextZ;\n\n\t// look for points inside the triangle in both directions\n\twhile ( p && p.z >= minZ && n && n.z <= maxZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\t// look for remaining points in decreasing z-order\n\twhile ( p && p.z >= minZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t}\n\n\t// look for remaining points in increasing z-order\n\twhile ( n && n.z <= maxZ ) {\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\treturn true;\n\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections( start, triangles, dim ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tconst a = p.prev,\n\t\t\tb = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim | 0 );\n\t\t\ttriangles.push( p.i / dim | 0 );\n\t\t\ttriangles.push( b.i / dim | 0 );\n\n\t\t\t// remove two nodes involved\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn filterPoints( p );\n\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut( start, triangles, dim, minX, minY, invSize ) {\n\n\t// look for a valid diagonal that divides the polygon into two\n\tlet a = start;\n\tdo {\n\n\t\tlet b = a.next.next;\n\t\twhile ( b !== a.prev ) {\n\n\t\t\tif ( a.i !== b.i && isValidDiagonal( a, b ) ) {\n\n\t\t\t\t// split the polygon in two by the diagonal\n\t\t\t\tlet c = splitPolygon( a, b );\n\n\t\t\t\t// filter colinear points around the cuts\n\t\t\t\ta = filterPoints( a, a.next );\n\t\t\t\tc = filterPoints( c, c.next );\n\n\t\t\t\t// run earcut on each half\n\t\t\t\tearcutLinked( a, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\tearcutLinked( c, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tb = b.next;\n\n\t\t}\n\n\t\ta = a.next;\n\n\t} while ( a !== start );\n\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles( data, holeIndices, outerNode, dim ) {\n\n\tconst queue = [];\n\tlet i, len, start, end, list;\n\n\tfor ( i = 0, len = holeIndices.length; i < len; i ++ ) {\n\n\t\tstart = holeIndices[ i ] * dim;\n\t\tend = i < len - 1 ? holeIndices[ i + 1 ] * dim : data.length;\n\t\tlist = linkedList( data, start, end, dim, false );\n\t\tif ( list === list.next ) list.steiner = true;\n\t\tqueue.push( getLeftmost( list ) );\n\n\t}\n\n\tqueue.sort( compareX );\n\n\t// process holes from left to right\n\tfor ( i = 0; i < queue.length; i ++ ) {\n\n\t\touterNode = eliminateHole( queue[ i ], outerNode );\n\n\t}\n\n\treturn outerNode;\n\n}\n\nfunction compareX( a, b ) {\n\n\treturn a.x - b.x;\n\n}\n\n// find a bridge between vertices that connects hole with an outer ring and link it\nfunction eliminateHole( hole, outerNode ) {\n\n\tconst bridge = findHoleBridge( hole, outerNode );\n\tif ( ! bridge ) {\n\n\t\treturn outerNode;\n\n\t}\n\n\tconst bridgeReverse = splitPolygon( bridge, hole );\n\n\t// filter collinear points around the cuts\n\tfilterPoints( bridgeReverse, bridgeReverse.next );\n\treturn filterPoints( bridge, bridge.next );\n\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge( hole, outerNode ) {\n\n\tlet p = outerNode,\n\t\tqx = - Infinity,\n\t\tm;\n\n\tconst hx = hole.x, hy = hole.y;\n\n\t// find a segment intersected by a ray from the hole's leftmost point to the left;\n\t// segment's endpoint with lesser x will be potential connection point\n\tdo {\n\n\t\tif ( hy <= p.y && hy >= p.next.y && p.next.y !== p.y ) {\n\n\t\t\tconst x = p.x + ( hy - p.y ) * ( p.next.x - p.x ) / ( p.next.y - p.y );\n\t\t\tif ( x <= hx && x > qx ) {\n\n\t\t\t\tqx = x;\n\t\t\t\tm = p.x < p.next.x ? p : p.next;\n\t\t\t\tif ( x === hx ) return m; // hole touches outer segment; pick leftmost endpoint\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== outerNode );\n\n\tif ( ! m ) return null;\n\n\t// look for points inside the triangle of hole point, segment intersection and endpoint;\n\t// if there are no points found, we have a valid connection;\n\t// otherwise choose the point of the minimum angle with the ray as connection point\n\n\tconst stop = m,\n\t\tmx = m.x,\n\t\tmy = m.y;\n\tlet tanMin = Infinity, tan;\n\n\tp = m;\n\n\tdo {\n\n\t\tif ( hx >= p.x && p.x >= mx && hx !== p.x &&\n\t\t\t\tpointInTriangle( hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y ) ) {\n\n\t\t\ttan = Math.abs( hy - p.y ) / ( hx - p.x ); // tangential\n\n\t\t\tif ( locallyInside( p, hole ) && ( tan < tanMin || ( tan === tanMin && ( p.x > m.x || ( p.x === m.x && sectorContainsSector( m, p ) ) ) ) ) ) {\n\n\t\t\t\tm = p;\n\t\t\t\ttanMin = tan;\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== stop );\n\n\treturn m;\n\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector( m, p ) {\n\n\treturn area( m.prev, m, p.prev ) < 0 && area( p.next, m, m.next ) < 0;\n\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve( start, minX, minY, invSize ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tif ( p.z === 0 ) p.z = zOrder( p.x, p.y, minX, minY, invSize );\n\t\tp.prevZ = p.prev;\n\t\tp.nextZ = p.next;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\tp.prevZ.nextZ = null;\n\tp.prevZ = null;\n\n\tsortLinked( p );\n\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked( list ) {\n\n\tlet i, p, q, e, tail, numMerges, pSize, qSize,\n\t\tinSize = 1;\n\n\tdo {\n\n\t\tp = list;\n\t\tlist = null;\n\t\ttail = null;\n\t\tnumMerges = 0;\n\n\t\twhile ( p ) {\n\n\t\t\tnumMerges ++;\n\t\t\tq = p;\n\t\t\tpSize = 0;\n\t\t\tfor ( i = 0; i < inSize; i ++ ) {\n\n\t\t\t\tpSize ++;\n\t\t\t\tq = q.nextZ;\n\t\t\t\tif ( ! q ) break;\n\n\t\t\t}\n\n\t\t\tqSize = inSize;\n\n\t\t\twhile ( pSize > 0 || ( qSize > 0 && q ) ) {\n\n\t\t\t\tif ( pSize !== 0 && ( qSize === 0 || ! q || p.z <= q.z ) ) {\n\n\t\t\t\t\te = p;\n\t\t\t\t\tp = p.nextZ;\n\t\t\t\t\tpSize --;\n\n\t\t\t\t} else {\n\n\t\t\t\t\te = q;\n\t\t\t\t\tq = q.nextZ;\n\t\t\t\t\tqSize --;\n\n\t\t\t\t}\n\n\t\t\t\tif ( tail ) tail.nextZ = e;\n\t\t\t\telse list = e;\n\n\t\t\t\te.prevZ = tail;\n\t\t\t\ttail = e;\n\n\t\t\t}\n\n\t\t\tp = q;\n\n\t\t}\n\n\t\ttail.nextZ = null;\n\t\tinSize *= 2;\n\n\t} while ( numMerges > 1 );\n\n\treturn list;\n\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\tx = ( x - minX ) * invSize | 0;\n\ty = ( y - minY ) * invSize | 0;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost( start ) {\n\n\tlet p = start,\n\t\tleftmost = start;\n\tdo {\n\n\t\tif ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn leftmost;\n\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) >= ( ax - px ) * ( cy - py ) &&\n ( ax - px ) * ( by - py ) >= ( bx - px ) * ( ay - py ) &&\n ( bx - px ) * ( cy - py ) >= ( cx - px ) * ( by - py );\n\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal( a, b ) {\n\n\treturn a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // dones't intersect other edges\n ( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible\n ( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors\n equals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case\n\n}\n\n// signed area of a triangle\nfunction area( p, q, r ) {\n\n\treturn ( q.y - p.y ) * ( r.x - q.x ) - ( q.x - p.x ) * ( r.y - q.y );\n\n}\n\n// check if two points are equal\nfunction equals( p1, p2 ) {\n\n\treturn p1.x === p2.x && p1.y === p2.y;\n\n}\n\n// check if two segments intersect\nfunction intersects( p1, q1, p2, q2 ) {\n\n\tconst o1 = sign( area( p1, q1, p2 ) );\n\tconst o2 = sign( area( p1, q1, q2 ) );\n\tconst o3 = sign( area( p2, q2, p1 ) );\n\tconst o4 = sign( area( p2, q2, q1 ) );\n\n\tif ( o1 !== o2 && o3 !== o4 ) return true; // general case\n\n\tif ( o1 === 0 && onSegment( p1, p2, q1 ) ) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n\tif ( o2 === 0 && onSegment( p1, q2, q1 ) ) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n\tif ( o3 === 0 && onSegment( p2, p1, q2 ) ) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n\tif ( o4 === 0 && onSegment( p2, q1, q2 ) ) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n\treturn false;\n\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment( p, q, r ) {\n\n\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n}\n\nfunction sign( num ) {\n\n\treturn num > 0 ? 1 : num < 0 ? - 1 : 0;\n\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon( a, b ) {\n\n\tlet p = a;\n\tdo {\n\n\t\tif ( p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t\t\tintersects( p, p.next, a, b ) ) return true;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn false;\n\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside( a, b ) {\n\n\treturn area( a.prev, a, a.next ) < 0 ?\n\t\tarea( a, b, a.next ) >= 0 && area( a, a.prev, b ) >= 0 :\n\t\tarea( a, b, a.prev ) < 0 || area( a, a.next, b ) < 0;\n\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside( a, b ) {\n\n\tlet p = a,\n\t\tinside = false;\n\tconst px = ( a.x + b.x ) / 2,\n\t\tpy = ( a.y + b.y ) / 2;\n\tdo {\n\n\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) )\n\t\t\tinside = ! inside;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn inside;\n\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon( a, b ) {\n\n\tconst a2 = new Node( a.i, a.x, a.y ),\n\t\tb2 = new Node( b.i, b.x, b.y ),\n\t\tan = a.next,\n\t\tbp = b.prev;\n\n\ta.next = b;\n\tb.prev = a;\n\n\ta2.next = an;\n\tan.prev = a2;\n\n\tb2.next = a2;\n\ta2.prev = b2;\n\n\tbp.next = b2;\n\tb2.prev = bp;\n\n\treturn b2;\n\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode( i, x, y, last ) {\n\n\tconst p = new Node( i, x, y );\n\n\tif ( ! last ) {\n\n\t\tp.prev = p;\n\t\tp.next = p;\n\n\t} else {\n\n\t\tp.next = last.next;\n\t\tp.prev = last;\n\t\tlast.next.prev = p;\n\t\tlast.next = p;\n\n\t}\n\n\treturn p;\n\n}\n\nfunction removeNode( p ) {\n\n\tp.next.prev = p.prev;\n\tp.prev.next = p.next;\n\n\tif ( p.prevZ ) p.prevZ.nextZ = p.nextZ;\n\tif ( p.nextZ ) p.nextZ.prevZ = p.prevZ;\n\n}\n\nfunction Node( i, x, y ) {\n\n\t// vertex index in coordinates array\n\tthis.i = i;\n\n\t// vertex coordinates\n\tthis.x = x;\n\tthis.y = y;\n\n\t// previous and next vertex nodes in a polygon ring\n\tthis.prev = null;\n\tthis.next = null;\n\n\t// z-order curve value\n\tthis.z = 0;\n\n\t// previous and next nodes in z-order\n\tthis.prevZ = null;\n\tthis.nextZ = null;\n\n\t// indicates whether this is a steiner point\n\tthis.steiner = false;\n\n}\n\nfunction signedArea( data, start, end, dim ) {\n\n\tlet sum = 0;\n\tfor ( let i = start, j = end - dim; i < end; i += dim ) {\n\n\t\tsum += ( data[ j ] - data[ i ] ) * ( data[ i + 1 ] + data[ j + 1 ] );\n\t\tj = i;\n\n\t}\n\n\treturn sum;\n\n}\n\nclass ShapeUtils {\n\n\t// calculate area of the contour polygon\n\n\tstatic area( contour ) {\n\n\t\tconst n = contour.length;\n\t\tlet a = 0.0;\n\n\t\tfor ( let p = n - 1, q = 0; q < n; p = q ++ ) {\n\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\n\n\t\t}\n\n\t\treturn a * 0.5;\n\n\t}\n\n\tstatic isClockWise( pts ) {\n\n\t\treturn ShapeUtils.area( pts ) < 0;\n\n\t}\n\n\tstatic triangulateShape( contour, holes ) {\n\n\t\tconst vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n\t\tconst holeIndices = []; // array of hole indices\n\t\tconst faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n\n\t\tremoveDupEndPts( contour );\n\t\taddContour( vertices, contour );\n\n\t\t//\n\n\t\tlet holeIndex = contour.length;\n\n\t\tholes.forEach( removeDupEndPts );\n\n\t\tfor ( let i = 0; i < holes.length; i ++ ) {\n\n\t\t\tholeIndices.push( holeIndex );\n\t\t\tholeIndex += holes[ i ].length;\n\t\t\taddContour( vertices, holes[ i ] );\n\n\t\t}\n\n\t\t//\n\n\t\tconst triangles = Earcut.triangulate( vertices, holeIndices );\n\n\t\t//\n\n\t\tfor ( let i = 0; i < triangles.length; i += 3 ) {\n\n\t\t\tfaces.push( triangles.slice( i, i + 3 ) );\n\n\t\t}\n\n\t\treturn faces;\n\n\t}\n\n}\n\nfunction removeDupEndPts( points ) {\n\n\tconst l = points.length;\n\n\tif ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {\n\n\t\tpoints.pop();\n\n\t}\n\n}\n\nfunction addContour( vertices, contour ) {\n\n\tfor ( let i = 0; i < contour.length; i ++ ) {\n\n\t\tvertices.push( contour[ i ].x );\n\t\tvertices.push( contour[ i ].y );\n\n\t}\n\n}\n\n/**\n * Creates extruded geometry from a path shape.\n *\n * parameters = {\n *\n * curveSegments: , // number of points on the curves\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\n * depth: , // Depth to extrude the shape\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into the original shape bevel goes\n * bevelSize: , // how far from shape outline (including bevelOffset) is bevel\n * bevelOffset: , // how far from shape outline does bevel start\n * bevelSegments: , // number of bevel layers\n *\n * extrudePath: // curve to extrude shape along\n *\n * UVGenerator: // object that provides UV generator functions\n *\n * }\n */\n\n\nclass ExtrudeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( - 0.5, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ExtrudeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\toptions: options\n\t\t};\n\n\t\tshapes = Array.isArray( shapes ) ? shapes : [ shapes ];\n\n\t\tconst scope = this;\n\n\t\tconst verticesArray = [];\n\t\tconst uvArray = [];\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\t\t\taddShape( shape );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );\n\n\t\tthis.computeVertexNormals();\n\n\t\t// functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst placeholder = [];\n\n\t\t\t// options\n\n\t\t\tconst curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n\t\t\tconst steps = options.steps !== undefined ? options.steps : 1;\n\t\t\tconst depth = options.depth !== undefined ? options.depth : 1;\n\n\t\t\tlet bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n\t\t\tlet bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\n\t\t\tlet bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\n\t\t\tlet bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n\t\t\tlet bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n\n\t\t\tconst extrudePath = options.extrudePath;\n\n\t\t\tconst uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;\n\n\t\t\t//\n\n\t\t\tlet extrudePts, extrudeByPath = false;\n\t\t\tlet splineTube, binormal, normal, position2;\n\n\t\t\tif ( extrudePath ) {\n\n\t\t\t\textrudePts = extrudePath.getSpacedPoints( steps );\n\n\t\t\t\textrudeByPath = true;\n\t\t\t\tbevelEnabled = false; // bevels not supported for path extrusion\n\n\t\t\t\t// SETUP TNB variables\n\n\t\t\t\t// TODO1 - have a .isClosed in spline?\n\n\t\t\t\tsplineTube = extrudePath.computeFrenetFrames( steps, false );\n\n\t\t\t\t// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n\n\t\t\t\tbinormal = new Vector3();\n\t\t\t\tnormal = new Vector3();\n\t\t\t\tposition2 = new Vector3();\n\n\t\t\t}\n\n\t\t\t// Safeguards if bevels are not enabled\n\n\t\t\tif ( ! bevelEnabled ) {\n\n\t\t\t\tbevelSegments = 0;\n\t\t\t\tbevelThickness = 0;\n\t\t\t\tbevelSize = 0;\n\t\t\t\tbevelOffset = 0;\n\n\t\t\t}\n\n\t\t\t// Variables initialization\n\n\t\t\tconst shapePoints = shape.extractPoints( curveSegments );\n\n\t\t\tlet vertices = shapePoints.shape;\n\t\t\tconst holes = shapePoints.holes;\n\n\t\t\tconst reverse = ! ShapeUtils.isClockWise( vertices );\n\n\t\t\tif ( reverse ) {\n\n\t\t\t\tvertices = vertices.reverse();\n\n\t\t\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\t\tif ( ShapeUtils.isClockWise( ahole ) ) {\n\n\t\t\t\t\t\tholes[ h ] = ahole.reverse();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( vertices, holes );\n\n\t\t\t/* Vertices */\n\n\t\t\tconst contour = vertices; // vertices has all points but contour has only points of circumference\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\tvertices = vertices.concat( ahole );\n\n\t\t\t}\n\n\n\t\t\tfunction scalePt2( pt, vec, size ) {\n\n\t\t\t\tif ( ! vec ) console.error( 'THREE.ExtrudeGeometry: vec does not exist' );\n\n\t\t\t\treturn pt.clone().addScaledVector( vec, size );\n\n\t\t\t}\n\n\t\t\tconst vlen = vertices.length, flen = faces.length;\n\n\n\t\t\t// Find directions for point movement\n\n\n\t\t\tfunction getBevelVec( inPt, inPrev, inNext ) {\n\n\t\t\t\t// computes for inPt the corresponding point inPt' on a new contour\n\t\t\t\t// shifted by 1 unit (length of normalized vector) to the left\n\t\t\t\t// if we walk along contour clockwise, this new contour is outside the old one\n\t\t\t\t//\n\t\t\t\t// inPt' is the intersection of the two lines parallel to the two\n\t\t\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\n\n\t\t\t\tlet v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n\n\t\t\t\t// good reading for geometry algorithms (here: line-line intersection)\n\t\t\t\t// http://geomalgorithms.com/a05-_intersect-1.html\n\n\t\t\t\tconst v_prev_x = inPt.x - inPrev.x,\n\t\t\t\t\tv_prev_y = inPt.y - inPrev.y;\n\t\t\t\tconst v_next_x = inNext.x - inPt.x,\n\t\t\t\t\tv_next_y = inNext.y - inPt.y;\n\n\t\t\t\tconst v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\n\n\t\t\t\t// check for collinear edges\n\t\t\t\tconst collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\tif ( Math.abs( collinear0 ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not collinear\n\n\t\t\t\t\t// length of vectors for normalizing\n\n\t\t\t\t\tconst v_prev_len = Math.sqrt( v_prev_lensq );\n\t\t\t\t\tconst v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\n\n\t\t\t\t\t// shift adjacent points by unit vectors to the left\n\n\t\t\t\t\tconst ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\n\t\t\t\t\tconst ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\n\n\t\t\t\t\tconst ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\n\t\t\t\t\tconst ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\n\n\t\t\t\t\t// scaling factor for v_prev to intersection point\n\n\t\t\t\t\tconst sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\n\t\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\n\t\t\t\t\t\t( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\t\t// vector from inPt to intersection point\n\n\t\t\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\n\t\t\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\n\n\t\t\t\t\t// Don't normalize!, otherwise sharp corners become ugly\n\t\t\t\t\t// but prevent crazy spikes\n\t\t\t\t\tconst v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );\n\t\t\t\t\tif ( v_trans_lensq <= 2 ) {\n\n\t\t\t\t\t\treturn new Vector2( v_trans_x, v_trans_y );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// handle special case of collinear edges\n\n\t\t\t\t\tlet direction_eq = false; // assumes: opposite\n\n\t\t\t\t\tif ( v_prev_x > Number.EPSILON ) {\n\n\t\t\t\t\t\tif ( v_next_x > Number.EPSILON ) {\n\n\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( v_prev_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\tif ( v_next_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( direction_eq ) {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight sequence\");\n\t\t\t\t\t\tv_trans_x = - v_prev_y;\n\t\t\t\t\t\tv_trans_y = v_prev_x;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight spike\");\n\t\t\t\t\t\tv_trans_x = v_prev_x;\n\t\t\t\t\t\tv_trans_y = v_prev_y;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\n\n\t\t\t}\n\n\n\t\t\tconst contourMovements = [];\n\n\t\t\tfor ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t// console.log('i,j,k', i, j , k)\n\n\t\t\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\n\n\t\t\t}\n\n\t\t\tconst holesMovements = [];\n\t\t\tlet oneHoleMovements, verticesMovements = contourMovements.concat();\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\toneHoleMovements = [];\n\n\t\t\t\tfor ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\n\n\t\t\t\t}\n\n\t\t\t\tholesMovements.push( oneHoleMovements );\n\t\t\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\n\n\t\t\t}\n\n\n\t\t\t// Loop bevelSegments, 1 for the front, 1 for the back\n\n\t\t\tfor ( let b = 0; b < bevelSegments; b ++ ) {\n\n\t\t\t\t//for ( b = bevelSegments; b > 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\n\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst bs = bevelSize + bevelOffset;\n\n\t\t\t// Back facing vertices\n\n\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\tv( vert.x, vert.y, 0 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n\n\t\t\t\t\tnormal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );\n\t\t\t\t\tbinormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\tposition2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );\n\n\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Add stepped vertices...\n\t\t\t// Including front facing vertices\n\n\t\t\tfor ( let s = 1; s <= steps; s ++ ) {\n\n\t\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\tv( vert.x, vert.y, depth / steps * s );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n\n\t\t\t\t\t\tnormal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );\n\t\t\t\t\t\tbinormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\t\tposition2.copy( extrudePts[ s ] ).add( normal ).add( binormal );\n\n\t\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\t// Add bevel segments planes\n\n\t\t\t//for ( b = 1; b <= bevelSegments; b ++ ) {\n\t\t\tfor ( let b = bevelSegments - 1; b >= 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t/* Faces */\n\n\t\t\t// Top and bottom faces\n\n\t\t\tbuildLidFaces();\n\n\t\t\t// Sides faces\n\n\t\t\tbuildSideFaces();\n\n\n\t\t\t///// Internal functions\n\n\t\t\tfunction buildLidFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\n\t\t\t\tif ( bevelEnabled ) {\n\n\t\t\t\t\tlet layer = 0; // steps + 1\n\t\t\t\t\tlet offset = vlen * layer;\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlayer = steps + bevelSegments * 2;\n\t\t\t\t\toffset = vlen * layer;\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 0 );\n\n\t\t\t}\n\n\t\t\t// Create faces for the z-sides of the shape\n\n\t\t\tfunction buildSideFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\t\t\t\tlet layeroffset = 0;\n\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t//, true\n\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t}\n\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t}\n\n\t\t\tfunction sidewalls( contour, layeroffset ) {\n\n\t\t\t\tlet i = contour.length;\n\n\t\t\t\twhile ( -- i >= 0 ) {\n\n\t\t\t\t\tconst j = i;\n\t\t\t\t\tlet k = i - 1;\n\t\t\t\t\tif ( k < 0 ) k = contour.length - 1;\n\n\t\t\t\t\t//console.log('b', i,j, i-1, k,vertices.length);\n\n\t\t\t\t\tfor ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {\n\n\t\t\t\t\t\tconst slen1 = vlen * s;\n\t\t\t\t\t\tconst slen2 = vlen * ( s + 1 );\n\n\t\t\t\t\t\tconst a = layeroffset + j + slen1,\n\t\t\t\t\t\t\tb = layeroffset + k + slen1,\n\t\t\t\t\t\t\tc = layeroffset + k + slen2,\n\t\t\t\t\t\t\td = layeroffset + j + slen2;\n\n\t\t\t\t\t\tf4( a, b, c, d );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfunction v( x, y, z ) {\n\n\t\t\t\tplaceholder.push( x );\n\t\t\t\tplaceholder.push( y );\n\t\t\t\tplaceholder.push( z );\n\n\t\t\t}\n\n\n\t\t\tfunction f3( a, b, c ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\n\t\t\t}\n\n\t\t\tfunction f4( a, b, c, d ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( d );\n\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\t\t\t\taddVertex( d );\n\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t}\n\n\t\t\tfunction addVertex( index ) {\n\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 0 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 1 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 2 ] );\n\n\t\t\t}\n\n\n\t\t\tfunction addUV( vector2 ) {\n\n\t\t\t\tuvArray.push( vector2.x );\n\t\t\t\tuvArray.push( vector2.y );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\t\tconst options = this.parameters.options;\n\n\t\treturn toJSON$1( shapes, options, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\tconst extrudePath = data.options.extrudePath;\n\n\t\tif ( extrudePath !== undefined ) {\n\n\t\t\tdata.options.extrudePath = new Curves[ extrudePath.type ]().fromJSON( extrudePath );\n\n\t\t}\n\n\t\treturn new ExtrudeGeometry( geometryShapes, data.options );\n\n\t}\n\n}\n\nconst WorldUVGenerator = {\n\n\tgenerateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\n\t\treturn [\n\t\t\tnew Vector2( a_x, a_y ),\n\t\t\tnew Vector2( b_x, b_y ),\n\t\t\tnew Vector2( c_x, c_y )\n\t\t];\n\n\t},\n\n\tgenerateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst a_z = vertices[ indexA * 3 + 2 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst b_z = vertices[ indexB * 3 + 2 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\t\tconst c_z = vertices[ indexC * 3 + 2 ];\n\t\tconst d_x = vertices[ indexD * 3 ];\n\t\tconst d_y = vertices[ indexD * 3 + 1 ];\n\t\tconst d_z = vertices[ indexD * 3 + 2 ];\n\n\t\tif ( Math.abs( a_y - b_y ) < Math.abs( a_x - b_x ) ) {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_x, 1 - a_z ),\n\t\t\t\tnew Vector2( b_x, 1 - b_z ),\n\t\t\t\tnew Vector2( c_x, 1 - c_z ),\n\t\t\t\tnew Vector2( d_x, 1 - d_z )\n\t\t\t];\n\n\t\t} else {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_y, 1 - a_z ),\n\t\t\t\tnew Vector2( b_y, 1 - b_z ),\n\t\t\t\tnew Vector2( c_y, 1 - c_z ),\n\t\t\t\tnew Vector2( d_y, 1 - d_z )\n\t\t\t];\n\n\t\t}\n\n\t}\n\n};\n\nfunction toJSON$1( shapes, options, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\tdata.options = Object.assign( {}, options );\n\n\tif ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON();\n\n\treturn data;\n\n}\n\nclass IcosahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\n\t\tconst vertices = [\n\t\t\t- 1, t, 0, \t1, t, 0, \t- 1, - t, 0, \t1, - t, 0,\n\t\t\t0, - 1, t, \t0, 1, t,\t0, - 1, - t, \t0, 1, - t,\n\t\t\tt, 0, - 1, \tt, 0, 1, \t- t, 0, - 1, \t- t, 0, 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 11, 5, \t0, 5, 1, \t0, 1, 7, \t0, 7, 10, \t0, 10, 11,\n\t\t\t1, 5, 9, \t5, 11, 4,\t11, 10, 2,\t10, 7, 6,\t7, 1, 8,\n\t\t\t3, 9, 4, \t3, 4, 2,\t3, 2, 6,\t3, 6, 8,\t3, 8, 9,\n\t\t\t4, 9, 5, \t2, 4, 11,\t6, 2, 10,\t8, 6, 7,\t9, 8, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'IcosahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new IcosahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass OctahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 0, 0, \t- 1, 0, 0,\t0, 1, 0,\n\t\t\t0, - 1, 0, \t0, 0, 1,\t0, 0, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 2, 4,\t0, 4, 3,\t0, 3, 5,\n\t\t\t0, 5, 2,\t1, 2, 5,\t1, 5, 3,\n\t\t\t1, 3, 4,\t1, 4, 2\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'OctahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new OctahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass RingGeometry extends BufferGeometry {\n\n\tconstructor( innerRadius = 0.5, outerRadius = 1, thetaSegments = 32, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'RingGeometry';\n\n\t\tthis.parameters = {\n\t\t\tinnerRadius: innerRadius,\n\t\t\touterRadius: outerRadius,\n\t\t\tthetaSegments: thetaSegments,\n\t\t\tphiSegments: phiSegments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tthetaSegments = Math.max( 3, thetaSegments );\n\t\tphiSegments = Math.max( 1, phiSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// some helper variables\n\n\t\tlet radius = innerRadius;\n\t\tconst radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= phiSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= thetaSegments; i ++ ) {\n\n\t\t\t\t// values are generate from the inside of the ring to the outside\n\n\t\t\t\tconst segment = thetaStart + i / thetaSegments * thetaLength;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( vertex.x / outerRadius + 1 ) / 2;\n\t\t\t\tuv.y = ( vertex.y / outerRadius + 1 ) / 2;\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t}\n\n\t\t\t// increase the radius for next row of vertices\n\n\t\t\tradius += radiusStep;\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let j = 0; j < phiSegments; j ++ ) {\n\n\t\t\tconst thetaSegmentLevel = j * ( thetaSegments + 1 );\n\n\t\t\tfor ( let i = 0; i < thetaSegments; i ++ ) {\n\n\t\t\t\tconst segment = i + thetaSegmentLevel;\n\n\t\t\t\tconst a = segment;\n\t\t\t\tconst b = segment + thetaSegments + 1;\n\t\t\t\tconst c = segment + thetaSegments + 2;\n\t\t\t\tconst d = segment + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new RingGeometry( data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ShapeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), curveSegments = 12 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ShapeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\tcurveSegments: curveSegments\n\t\t};\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet groupStart = 0;\n\t\tlet groupCount = 0;\n\n\t\t// allow single and array values for \"shapes\" parameter\n\n\t\tif ( Array.isArray( shapes ) === false ) {\n\n\t\t\taddShape( shapes );\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0; i < shapes.length; i ++ ) {\n\n\t\t\t\taddShape( shapes[ i ] );\n\n\t\t\t\tthis.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support\n\n\t\t\t\tgroupStart += groupCount;\n\t\t\t\tgroupCount = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\n\t\t// helper functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst indexOffset = vertices.length / 3;\n\t\t\tconst points = shape.extractPoints( curveSegments );\n\n\t\t\tlet shapeVertices = points.shape;\n\t\t\tconst shapeHoles = points.holes;\n\n\t\t\t// check direction of vertices\n\n\t\t\tif ( ShapeUtils.isClockWise( shapeVertices ) === false ) {\n\n\t\t\t\tshapeVertices = shapeVertices.reverse();\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\n\t\t\t\tif ( ShapeUtils.isClockWise( shapeHole ) === true ) {\n\n\t\t\t\t\tshapeHoles[ i ] = shapeHole.reverse();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );\n\n\t\t\t// join vertices of inner and outer paths to a single array\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\t\t\t\tshapeVertices = shapeVertices.concat( shapeHole );\n\n\t\t\t}\n\n\t\t\t// vertices, normals, uvs\n\n\t\t\tfor ( let i = 0, l = shapeVertices.length; i < l; i ++ ) {\n\n\t\t\t\tconst vertex = shapeVertices[ i ];\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, 0 );\n\t\t\t\tnormals.push( 0, 0, 1 );\n\t\t\t\tuvs.push( vertex.x, vertex.y ); // world uvs\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\tfor ( let i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\t\t\tconst face = faces[ i ];\n\n\t\t\t\tconst a = face[ 0 ] + indexOffset;\n\t\t\t\tconst b = face[ 1 ] + indexOffset;\n\t\t\t\tconst c = face[ 2 ] + indexOffset;\n\n\t\t\t\tindices.push( a, b, c );\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\n\t\treturn toJSON( shapes, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\treturn new ShapeGeometry( geometryShapes, data.curveSegments );\n\n\t}\n\n}\n\nfunction toJSON( shapes, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\treturn data;\n\n}\n\nclass SphereGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'SphereGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\twidthSegments = Math.max( 3, Math.floor( widthSegments ) );\n\t\theightSegments = Math.max( 2, Math.floor( heightSegments ) );\n\n\t\tconst thetaEnd = Math.min( thetaStart + thetaLength, Math.PI );\n\n\t\tlet index = 0;\n\t\tconst grid = [];\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let iy = 0; iy <= heightSegments; iy ++ ) {\n\n\t\t\tconst verticesRow = [];\n\n\t\t\tconst v = iy / heightSegments;\n\n\t\t\t// special case for the poles\n\n\t\t\tlet uOffset = 0;\n\n\t\t\tif ( iy === 0 && thetaStart === 0 ) {\n\n\t\t\t\tuOffset = 0.5 / widthSegments;\n\n\t\t\t} else if ( iy === heightSegments && thetaEnd === Math.PI ) {\n\n\t\t\t\tuOffset = - 0.5 / widthSegments;\n\n\t\t\t}\n\n\t\t\tfor ( let ix = 0; ix <= widthSegments; ix ++ ) {\n\n\t\t\t\tconst u = ix / widthSegments;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\t\t\t\tvertex.y = radius * Math.cos( thetaStart + v * thetaLength );\n\t\t\t\tvertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.copy( vertex ).normalize();\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( u + uOffset, 1 - v );\n\n\t\t\t\tverticesRow.push( index ++ );\n\n\t\t\t}\n\n\t\t\tgrid.push( verticesRow );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let iy = 0; iy < heightSegments; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < widthSegments; ix ++ ) {\n\n\t\t\t\tconst a = grid[ iy ][ ix + 1 ];\n\t\t\t\tconst b = grid[ iy ][ ix ];\n\t\t\t\tconst c = grid[ iy + 1 ][ ix ];\n\t\t\t\tconst d = grid[ iy + 1 ][ ix + 1 ];\n\n\t\t\t\tif ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d );\n\t\t\t\tif ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new SphereGeometry( data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass TetrahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 1, 1, \t- 1, - 1, 1, \t- 1, 1, - 1, \t1, - 1, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t2, 1, 0, \t0, 3, 2,\t1, 3, 0,\t2, 3, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'TetrahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TetrahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass TorusGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\tradialSegments: radialSegments,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tarc: arc\n\t\t};\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\ttubularSegments = Math.floor( tubularSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst center = new Vector3();\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tconst u = i / tubularSegments * arc;\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\n\t\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\n\t\t\t\tvertex.z = tube * Math.sin( v );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tcenter.x = radius * Math.cos( u );\n\t\t\t\tcenter.y = radius * Math.sin( u );\n\t\t\t\tnormal.subVectors( vertex, center ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= tubularSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( tubularSegments + 1 ) * j + i - 1;\n\t\t\t\tconst b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\n\t\t\t\tconst c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\n\t\t\t\tconst d = ( tubularSegments + 1 ) * j + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc );\n\n\t}\n\n}\n\nclass TorusKnotGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusKnotGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t\tp: p,\n\t\t\tq: q\n\t\t};\n\n\t\ttubularSegments = Math.floor( tubularSegments );\n\t\tradialSegments = Math.floor( radialSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\tconst P1 = new Vector3();\n\t\tconst P2 = new Vector3();\n\n\t\tconst B = new Vector3();\n\t\tconst T = new Vector3();\n\t\tconst N = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let i = 0; i <= tubularSegments; ++ i ) {\n\n\t\t\t// the radian \"u\" is used to calculate the position on the torus curve of the current tubular segment\n\n\t\t\tconst u = i / tubularSegments * p * Math.PI * 2;\n\n\t\t\t// now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\n\t\t\t// these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\n\n\t\t\tcalculatePositionOnCurve( u, p, q, radius, P1 );\n\t\t\tcalculatePositionOnCurve( u + 0.01, p, q, radius, P2 );\n\n\t\t\t// calculate orthonormal basis\n\n\t\t\tT.subVectors( P2, P1 );\n\t\t\tN.addVectors( P2, P1 );\n\t\t\tB.crossVectors( T, N );\n\t\t\tN.crossVectors( B, T );\n\n\t\t\t// normalize B, N. T can be ignored, we don't use it\n\n\t\t\tB.normalize();\n\t\t\tN.normalize();\n\n\t\t\tfor ( let j = 0; j <= radialSegments; ++ j ) {\n\n\t\t\t\t// now calculate the vertices. they are nothing more than an extrusion of the torus curve.\n\t\t\t\t// because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\t\t\t\tconst cx = - tube * Math.cos( v );\n\t\t\t\tconst cy = tube * Math.sin( v );\n\n\t\t\t\t// now calculate the final vertex position.\n\t\t\t\t// first we orient the extrusion with our basis vectors, then we add it to the current position on the curve\n\n\t\t\t\tvertex.x = P1.x + ( cx * N.x + cy * B.x );\n\t\t\t\tvertex.y = P1.y + ( cx * N.y + cy * B.y );\n\t\t\t\tvertex.z = P1.z + ( cx * N.z + cy * B.z );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\n\n\t\t\t\tnormal.subVectors( vertex, P1 ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// this function calculates the current position on the torus curve\n\n\t\tfunction calculatePositionOnCurve( u, p, q, radius, position ) {\n\n\t\t\tconst cu = Math.cos( u );\n\t\t\tconst su = Math.sin( u );\n\t\t\tconst quOverP = q / p * u;\n\t\t\tconst cs = Math.cos( quOverP );\n\n\t\t\tposition.x = radius * ( 2 + cs ) * 0.5 * cu;\n\t\t\tposition.y = radius * ( 2 + cs ) * su * 0.5;\n\t\t\tposition.z = radius * Math.sin( quOverP ) * 0.5;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusKnotGeometry( data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q );\n\n\t}\n\n}\n\nclass TubeGeometry extends BufferGeometry {\n\n\tconstructor( path = new QuadraticBezierCurve3( new Vector3( - 1, - 1, 0 ), new Vector3( - 1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TubeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpath: path,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradius: radius,\n\t\t\tradialSegments: radialSegments,\n\t\t\tclosed: closed\n\t\t};\n\n\t\tconst frames = path.computeFrenetFrames( tubularSegments, closed );\n\n\t\t// expose internals\n\n\t\tthis.tangents = frames.tangents;\n\t\tthis.normals = frames.normals;\n\t\tthis.binormals = frames.binormals;\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tlet P = new Vector3();\n\n\t\t// buffer\n\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\t\tconst indices = [];\n\n\t\t// create buffer data\n\n\t\tgenerateBufferData();\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// functions\n\n\t\tfunction generateBufferData() {\n\n\t\t\tfor ( let i = 0; i < tubularSegments; i ++ ) {\n\n\t\t\t\tgenerateSegment( i );\n\n\t\t\t}\n\n\t\t\t// if the geometry is not closed, generate the last row of vertices and normals\n\t\t\t// at the regular position on the given path\n\t\t\t//\n\t\t\t// if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\n\n\t\t\tgenerateSegment( ( closed === false ) ? tubularSegments : 0 );\n\n\t\t\t// uvs are generated in a separate function.\n\t\t\t// this makes it easy compute correct values for closed geometries\n\n\t\t\tgenerateUVs();\n\n\t\t\t// finally create faces\n\n\t\t\tgenerateIndices();\n\n\t\t}\n\n\t\tfunction generateSegment( i ) {\n\n\t\t\t// we use getPointAt to sample evenly distributed points from the given path\n\n\t\t\tP = path.getPointAt( i / tubularSegments, P );\n\n\t\t\t// retrieve corresponding normal and binormal\n\n\t\t\tconst N = frames.normals[ i ];\n\t\t\tconst B = frames.binormals[ i ];\n\n\t\t\t// generate normals and vertices for the current segment\n\n\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\tconst sin = Math.sin( v );\n\t\t\t\tconst cos = - Math.cos( v );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.x = ( cos * N.x + sin * B.x );\n\t\t\t\tnormal.y = ( cos * N.y + sin * B.y );\n\t\t\t\tnormal.z = ( cos * N.z + sin * B.z );\n\t\t\t\tnormal.normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = P.x + radius * normal.x;\n\t\t\t\tvertex.y = P.y + radius * normal.y;\n\t\t\t\tvertex.z = P.z + radius * normal.z;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateIndices() {\n\n\t\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\t\tuv.x = i / tubularSegments;\n\t\t\t\t\tuv.y = j / radialSegments;\n\n\t\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.path = this.parameters.path.toJSON();\n\n\t\treturn data;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\t// This only works for built-in curves (e.g. CatmullRomCurve3).\n\t\t// User defined curves or instances of CurvePath will not be deserialized.\n\t\treturn new TubeGeometry(\n\t\t\tnew Curves[ data.path.type ]().fromJSON( data.path ),\n\t\t\tdata.tubularSegments,\n\t\t\tdata.radius,\n\t\t\tdata.radialSegments,\n\t\t\tdata.closed\n\t\t);\n\n\t}\n\n}\n\nclass WireframeGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'WireframeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\t// buffer\n\n\t\t\tconst vertices = [];\n\t\t\tconst edges = new Set();\n\n\t\t\t// helper variables\n\n\t\t\tconst start = new Vector3();\n\t\t\tconst end = new Vector3();\n\n\t\t\tif ( geometry.index !== null ) {\n\n\t\t\t\t// indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\t\t\t\tconst indices = geometry.index;\n\t\t\t\tlet groups = geometry.groups;\n\n\t\t\t\tif ( groups.length === 0 ) {\n\n\t\t\t\t\tgroups = [ { start: 0, count: indices.count, materialIndex: 0 } ];\n\n\t\t\t\t}\n\n\t\t\t\t// create a data structure that contains all edges without duplicates\n\n\t\t\t\tfor ( let o = 0, ol = groups.length; o < ol; ++ o ) {\n\n\t\t\t\t\tconst group = groups[ o ];\n\n\t\t\t\t\tconst groupStart = group.start;\n\t\t\t\t\tconst groupCount = group.count;\n\n\t\t\t\t\tfor ( let i = groupStart, l = ( groupStart + groupCount ); i < l; i += 3 ) {\n\n\t\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t\tconst index1 = indices.getX( i + j );\n\t\t\t\t\t\t\tconst index2 = indices.getX( i + ( j + 1 ) % 3 );\n\n\t\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\n\t\t\t\tfor ( let i = 0, l = ( position.count / 3 ); i < l; i ++ ) {\n\n\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t// three edges per triangle, an edge is represented as (index1, index2)\n\t\t\t\t\t\t// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\n\n\t\t\t\t\t\tconst index1 = 3 * i + j;\n\t\t\t\t\t\tconst index2 = 3 * i + ( ( j + 1 ) % 3 );\n\n\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// build geometry\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction isUniqueEdge( start, end, edges ) {\n\n\tconst hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;\n\tconst hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge\n\n\tif ( edges.has( hash1 ) === true || edges.has( hash2 ) === true ) {\n\n\t\treturn false;\n\n\t} else {\n\n\t\tedges.add( hash1 );\n\t\tedges.add( hash2 );\n\t\treturn true;\n\n\t}\n\n}\n\nvar Geometries = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tBoxGeometry: BoxGeometry,\n\tCapsuleGeometry: CapsuleGeometry,\n\tCircleGeometry: CircleGeometry,\n\tConeGeometry: ConeGeometry,\n\tCylinderGeometry: CylinderGeometry,\n\tDodecahedronGeometry: DodecahedronGeometry,\n\tEdgesGeometry: EdgesGeometry,\n\tExtrudeGeometry: ExtrudeGeometry,\n\tIcosahedronGeometry: IcosahedronGeometry,\n\tLatheGeometry: LatheGeometry,\n\tOctahedronGeometry: OctahedronGeometry,\n\tPlaneGeometry: PlaneGeometry,\n\tPolyhedronGeometry: PolyhedronGeometry,\n\tRingGeometry: RingGeometry,\n\tShapeGeometry: ShapeGeometry,\n\tSphereGeometry: SphereGeometry,\n\tTetrahedronGeometry: TetrahedronGeometry,\n\tTorusGeometry: TorusGeometry,\n\tTorusKnotGeometry: TorusKnotGeometry,\n\tTubeGeometry: TubeGeometry,\n\tWireframeGeometry: WireframeGeometry\n});\n\nclass ShadowMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isShadowMaterial = true;\n\n\t\tthis.type = 'ShadowMaterial';\n\n\t\tthis.color = new Color( 0x000000 );\n\t\tthis.transparent = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass RawShaderMaterial extends ShaderMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper( parameters );\n\n\t\tthis.isRawShaderMaterial = true;\n\n\t\tthis.type = 'RawShaderMaterial';\n\n\t}\n\n}\n\nclass MeshStandardMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshStandardMaterial = true;\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.type = 'MeshStandardMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.roughness = 1.0;\n\t\tthis.metalness = 0.0;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.roughnessMap = null;\n\n\t\tthis.metalnessMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapRotation = new Euler();\n\t\tthis.envMapIntensity = 1.0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.color.copy( source.color );\n\t\tthis.roughness = source.roughness;\n\t\tthis.metalness = source.metalness;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.roughnessMap = source.roughnessMap;\n\n\t\tthis.metalnessMap = source.metalnessMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapRotation.copy( source.envMapRotation );\n\t\tthis.envMapIntensity = source.envMapIntensity;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshPhysicalMaterial extends MeshStandardMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhysicalMaterial = true;\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.type = 'MeshPhysicalMaterial';\n\n\t\tthis.anisotropyRotation = 0;\n\t\tthis.anisotropyMap = null;\n\n\t\tthis.clearcoatMap = null;\n\t\tthis.clearcoatRoughness = 0.0;\n\t\tthis.clearcoatRoughnessMap = null;\n\t\tthis.clearcoatNormalScale = new Vector2( 1, 1 );\n\t\tthis.clearcoatNormalMap = null;\n\n\t\tthis.ior = 1.5;\n\n\t\tObject.defineProperty( this, 'reflectivity', {\n\t\t\tget: function () {\n\n\t\t\t\treturn ( clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );\n\n\t\t\t},\n\t\t\tset: function ( reflectivity ) {\n\n\t\t\t\tthis.ior = ( 1 + 0.4 * reflectivity ) / ( 1 - 0.4 * reflectivity );\n\n\t\t\t}\n\t\t} );\n\n\t\tthis.iridescenceMap = null;\n\t\tthis.iridescenceIOR = 1.3;\n\t\tthis.iridescenceThicknessRange = [ 100, 400 ];\n\t\tthis.iridescenceThicknessMap = null;\n\n\t\tthis.sheenColor = new Color( 0x000000 );\n\t\tthis.sheenColorMap = null;\n\t\tthis.sheenRoughness = 1.0;\n\t\tthis.sheenRoughnessMap = null;\n\n\t\tthis.transmissionMap = null;\n\n\t\tthis.thickness = 0;\n\t\tthis.thicknessMap = null;\n\t\tthis.attenuationDistance = Infinity;\n\t\tthis.attenuationColor = new Color( 1, 1, 1 );\n\n\t\tthis.specularIntensity = 1.0;\n\t\tthis.specularIntensityMap = null;\n\t\tthis.specularColor = new Color( 1, 1, 1 );\n\t\tthis.specularColorMap = null;\n\n\t\tthis._anisotropy = 0;\n\t\tthis._clearcoat = 0;\n\t\tthis._iridescence = 0;\n\t\tthis._sheen = 0.0;\n\t\tthis._transmission = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tget anisotropy() {\n\n\t\treturn this._anisotropy;\n\n\t}\n\n\tset anisotropy( value ) {\n\n\t\tif ( this._anisotropy > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._anisotropy = value;\n\n\t}\n\n\tget clearcoat() {\n\n\t\treturn this._clearcoat;\n\n\t}\n\n\tset clearcoat( value ) {\n\n\t\tif ( this._clearcoat > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._clearcoat = value;\n\n\t}\n\n\tget iridescence() {\n\n\t\treturn this._iridescence;\n\n\t}\n\n\tset iridescence( value ) {\n\n\t\tif ( this._iridescence > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._iridescence = value;\n\n\t}\n\n\tget sheen() {\n\n\t\treturn this._sheen;\n\n\t}\n\n\tset sheen( value ) {\n\n\t\tif ( this._sheen > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._sheen = value;\n\n\t}\n\n\tget transmission() {\n\n\t\treturn this._transmission;\n\n\t}\n\n\tset transmission( value ) {\n\n\t\tif ( this._transmission > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._transmission = value;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.anisotropy = source.anisotropy;\n\t\tthis.anisotropyRotation = source.anisotropyRotation;\n\t\tthis.anisotropyMap = source.anisotropyMap;\n\n\t\tthis.clearcoat = source.clearcoat;\n\t\tthis.clearcoatMap = source.clearcoatMap;\n\t\tthis.clearcoatRoughness = source.clearcoatRoughness;\n\t\tthis.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\n\t\tthis.clearcoatNormalMap = source.clearcoatNormalMap;\n\t\tthis.clearcoatNormalScale.copy( source.clearcoatNormalScale );\n\n\t\tthis.ior = source.ior;\n\n\t\tthis.iridescence = source.iridescence;\n\t\tthis.iridescenceMap = source.iridescenceMap;\n\t\tthis.iridescenceIOR = source.iridescenceIOR;\n\t\tthis.iridescenceThicknessRange = [ ...source.iridescenceThicknessRange ];\n\t\tthis.iridescenceThicknessMap = source.iridescenceThicknessMap;\n\n\t\tthis.sheen = source.sheen;\n\t\tthis.sheenColor.copy( source.sheenColor );\n\t\tthis.sheenColorMap = source.sheenColorMap;\n\t\tthis.sheenRoughness = source.sheenRoughness;\n\t\tthis.sheenRoughnessMap = source.sheenRoughnessMap;\n\n\t\tthis.transmission = source.transmission;\n\t\tthis.transmissionMap = source.transmissionMap;\n\n\t\tthis.thickness = source.thickness;\n\t\tthis.thicknessMap = source.thicknessMap;\n\t\tthis.attenuationDistance = source.attenuationDistance;\n\t\tthis.attenuationColor.copy( source.attenuationColor );\n\n\t\tthis.specularIntensity = source.specularIntensity;\n\t\tthis.specularIntensityMap = source.specularIntensityMap;\n\t\tthis.specularColor.copy( source.specularColor );\n\t\tthis.specularColorMap = source.specularColorMap;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshPhongMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhongMaterial = true;\n\n\t\tthis.type = 'MeshPhongMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.specular = new Color( 0x111111 );\n\t\tthis.shininess = 30;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapRotation = new Euler();\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.specular.copy( source.specular );\n\t\tthis.shininess = source.shininess;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapRotation.copy( source.envMapRotation );\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshToonMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshToonMaterial = true;\n\n\t\tthis.defines = { 'TOON': '' };\n\n\t\tthis.type = 'MeshToonMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\t\tthis.gradientMap = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\t\tthis.gradientMap = source.gradientMap;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshNormalMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshNormalMaterial = true;\n\n\t\tthis.type = 'MeshNormalMaterial';\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshLambertMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshLambertMaterial = true;\n\n\t\tthis.type = 'MeshLambertMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapRotation = new Euler();\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapRotation.copy( source.envMapRotation );\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshMatcapMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshMatcapMaterial = true;\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.type = 'MeshMatcapMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.matcap = null;\n\n\t\tthis.map = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.matcap = source.matcap;\n\n\t\tthis.map = source.map;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineDashedMaterial extends LineBasicMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineDashedMaterial = true;\n\n\t\tthis.type = 'LineDashedMaterial';\n\n\t\tthis.scale = 1;\n\t\tthis.dashSize = 3;\n\t\tthis.gapSize = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.scale = source.scale;\n\t\tthis.dashSize = source.dashSize;\n\t\tthis.gapSize = source.gapSize;\n\n\t\treturn this;\n\n\t}\n\n}\n\n// converts an array to a specific type\nfunction convertArray( array, type, forceClone ) {\n\n\tif ( ! array || // let 'undefined' and 'null' pass\n\t\t! forceClone && array.constructor === type ) return array;\n\n\tif ( typeof type.BYTES_PER_ELEMENT === 'number' ) {\n\n\t\treturn new type( array ); // create typed array\n\n\t}\n\n\treturn Array.prototype.slice.call( array ); // create Array\n\n}\n\nfunction isTypedArray( object ) {\n\n\treturn ArrayBuffer.isView( object ) &&\n\t\t! ( object instanceof DataView );\n\n}\n\n// returns an array by which times and values can be sorted\nfunction getKeyframeOrder( times ) {\n\n\tfunction compareTime( i, j ) {\n\n\t\treturn times[ i ] - times[ j ];\n\n\t}\n\n\tconst n = times.length;\n\tconst result = new Array( n );\n\tfor ( let i = 0; i !== n; ++ i ) result[ i ] = i;\n\n\tresult.sort( compareTime );\n\n\treturn result;\n\n}\n\n// uses the array previously returned by 'getKeyframeOrder' to sort data\nfunction sortedArray( values, stride, order ) {\n\n\tconst nValues = values.length;\n\tconst result = new values.constructor( nValues );\n\n\tfor ( let i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) {\n\n\t\tconst srcOffset = order[ i ] * stride;\n\n\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\tresult[ dstOffset ++ ] = values[ srcOffset + j ];\n\n\t\t}\n\n\t}\n\n\treturn result;\n\n}\n\n// function for parsing AOS keyframe formats\nfunction flattenJSON( jsonKeys, times, values, valuePropertyName ) {\n\n\tlet i = 1, key = jsonKeys[ 0 ];\n\n\twhile ( key !== undefined && key[ valuePropertyName ] === undefined ) {\n\n\t\tkey = jsonKeys[ i ++ ];\n\n\t}\n\n\tif ( key === undefined ) return; // no data\n\n\tlet value = key[ valuePropertyName ];\n\tif ( value === undefined ) return; // no data\n\n\tif ( Array.isArray( value ) ) {\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push.apply( values, value ); // push all elements\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else if ( value.toArray !== undefined ) {\n\n\t\t// ...assume THREE.Math-ish\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalue.toArray( values, values.length );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else {\n\n\t\t// otherwise push as-is\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push( value );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t}\n\n}\n\nfunction subclip( sourceClip, name, startFrame, endFrame, fps = 30 ) {\n\n\tconst clip = sourceClip.clone();\n\n\tclip.name = name;\n\n\tconst tracks = [];\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tconst track = clip.tracks[ i ];\n\t\tconst valueSize = track.getValueSize();\n\n\t\tconst times = [];\n\t\tconst values = [];\n\n\t\tfor ( let j = 0; j < track.times.length; ++ j ) {\n\n\t\t\tconst frame = track.times[ j ] * fps;\n\n\t\t\tif ( frame < startFrame || frame >= endFrame ) continue;\n\n\t\t\ttimes.push( track.times[ j ] );\n\n\t\t\tfor ( let k = 0; k < valueSize; ++ k ) {\n\n\t\t\t\tvalues.push( track.values[ j * valueSize + k ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( times.length === 0 ) continue;\n\n\t\ttrack.times = convertArray( times, track.times.constructor );\n\t\ttrack.values = convertArray( values, track.values.constructor );\n\n\t\ttracks.push( track );\n\n\t}\n\n\tclip.tracks = tracks;\n\n\t// find minimum .times value across all tracks in the trimmed clip\n\n\tlet minStartTime = Infinity;\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tif ( minStartTime > clip.tracks[ i ].times[ 0 ] ) {\n\n\t\t\tminStartTime = clip.tracks[ i ].times[ 0 ];\n\n\t\t}\n\n\t}\n\n\t// shift all tracks such that clip begins at t=0\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tclip.tracks[ i ].shift( - 1 * minStartTime );\n\n\t}\n\n\tclip.resetDuration();\n\n\treturn clip;\n\n}\n\nfunction makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30 ) {\n\n\tif ( fps <= 0 ) fps = 30;\n\n\tconst numTracks = referenceClip.tracks.length;\n\tconst referenceTime = referenceFrame / fps;\n\n\t// Make each track's values relative to the values at the reference frame\n\tfor ( let i = 0; i < numTracks; ++ i ) {\n\n\t\tconst referenceTrack = referenceClip.tracks[ i ];\n\t\tconst referenceTrackType = referenceTrack.ValueTypeName;\n\n\t\t// Skip this track if it's non-numeric\n\t\tif ( referenceTrackType === 'bool' || referenceTrackType === 'string' ) continue;\n\n\t\t// Find the track in the target clip whose name and type matches the reference track\n\t\tconst targetTrack = targetClip.tracks.find( function ( track ) {\n\n\t\t\treturn track.name === referenceTrack.name\n\t\t\t\t&& track.ValueTypeName === referenceTrackType;\n\n\t\t} );\n\n\t\tif ( targetTrack === undefined ) continue;\n\n\t\tlet referenceOffset = 0;\n\t\tconst referenceValueSize = referenceTrack.getValueSize();\n\n\t\tif ( referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\treferenceOffset = referenceValueSize / 3;\n\n\t\t}\n\n\t\tlet targetOffset = 0;\n\t\tconst targetValueSize = targetTrack.getValueSize();\n\n\t\tif ( targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\ttargetOffset = targetValueSize / 3;\n\n\t\t}\n\n\t\tconst lastIndex = referenceTrack.times.length - 1;\n\t\tlet referenceValue;\n\n\t\t// Find the value to subtract out of the track\n\t\tif ( referenceTime <= referenceTrack.times[ 0 ] ) {\n\n\t\t\t// Reference frame is earlier than the first keyframe, so just use the first keyframe\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\treferenceValue = referenceTrack.values.slice( startIndex, endIndex );\n\n\t\t} else if ( referenceTime >= referenceTrack.times[ lastIndex ] ) {\n\n\t\t\t// Reference frame is after the last keyframe, so just use the last keyframe\n\t\t\tconst startIndex = lastIndex * referenceValueSize + referenceOffset;\n\t\t\tconst endIndex = startIndex + referenceValueSize - referenceOffset;\n\t\t\treferenceValue = referenceTrack.values.slice( startIndex, endIndex );\n\n\t\t} else {\n\n\t\t\t// Interpolate to the reference value\n\t\t\tconst interpolant = referenceTrack.createInterpolant();\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\tinterpolant.evaluate( referenceTime );\n\t\t\treferenceValue = interpolant.resultBuffer.slice( startIndex, endIndex );\n\n\t\t}\n\n\t\t// Conjugate the quaternion\n\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\tconst referenceQuat = new Quaternion().fromArray( referenceValue ).normalize().conjugate();\n\t\t\treferenceQuat.toArray( referenceValue );\n\n\t\t}\n\n\t\t// Subtract the reference value from all of the track values\n\n\t\tconst numTimes = targetTrack.times.length;\n\t\tfor ( let j = 0; j < numTimes; ++ j ) {\n\n\t\t\tconst valueStart = j * targetValueSize + targetOffset;\n\n\t\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\t\t// Multiply the conjugate for quaternion track types\n\t\t\t\tQuaternion.multiplyQuaternionsFlat(\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart,\n\t\t\t\t\treferenceValue,\n\t\t\t\t\t0,\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart\n\t\t\t\t);\n\n\t\t\t} else {\n\n\t\t\t\tconst valueEnd = targetValueSize - targetOffset * 2;\n\n\t\t\t\t// Subtract each value for all other numeric track types\n\t\t\t\tfor ( let k = 0; k < valueEnd; ++ k ) {\n\n\t\t\t\t\ttargetTrack.values[ valueStart + k ] -= referenceValue[ k ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttargetClip.blendMode = AdditiveAnimationBlendMode;\n\n\treturn targetClip;\n\n}\n\nconst AnimationUtils = {\n\tconvertArray: convertArray,\n\tisTypedArray: isTypedArray,\n\tgetKeyframeOrder: getKeyframeOrder,\n\tsortedArray: sortedArray,\n\tflattenJSON: flattenJSON,\n\tsubclip: subclip,\n\tmakeClipAdditive: makeClipAdditive\n};\n\n/**\n * Abstract base class of interpolants over parametric samples.\n *\n * The parameter domain is one dimensional, typically the time or a path\n * along a curve defined by the data.\n *\n * The sample values can have any dimensionality and derived classes may\n * apply special interpretations to the data.\n *\n * This class provides the interval seek in a Template Method, deferring\n * the actual interpolation to derived classes.\n *\n * Time complexity is O(1) for linear access crossing at most two points\n * and O(log N) for random access, where N is the number of positions.\n *\n * References:\n *\n * \t\thttp://www.oodesign.com/template-method-pattern.html\n *\n */\n\nclass Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tthis.parameterPositions = parameterPositions;\n\t\tthis._cachedIndex = 0;\n\n\t\tthis.resultBuffer = resultBuffer !== undefined ?\n\t\t\tresultBuffer : new sampleValues.constructor( sampleSize );\n\t\tthis.sampleValues = sampleValues;\n\t\tthis.valueSize = sampleSize;\n\n\t\tthis.settings = null;\n\t\tthis.DefaultSettings_ = {};\n\n\t}\n\n\tevaluate( t ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet i1 = this._cachedIndex,\n\t\t\tt1 = pp[ i1 ],\n\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\tvalidate_interval: {\n\n\t\t\tseek: {\n\n\t\t\t\tlet right;\n\n\t\t\t\tlinear_scan: {\n\n\t\t\t\t\t//- See http://jsperf.com/comparison-to-undefined/3\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\n\t\t\t\t\t//- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\n\t\t\t\t\tforward_scan: if ( ! ( t < t1 ) ) {\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 + 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\t\t\t\tif ( t < t0 ) break forward_scan;\n\n\t\t\t\t\t\t\t\t// after end\n\n\t\t\t\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt0 = t1;\n\t\t\t\t\t\t\tt1 = pp[ ++ i1 ];\n\n\t\t\t\t\t\t\tif ( t < t1 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the right side of the index\n\t\t\t\t\t\tright = pp.length;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\n\t\t\t\t\tif ( ! ( t >= t0 ) ) {\n\n\t\t\t\t\t\t// looping?\n\n\t\t\t\t\t\tconst t1global = pp[ 1 ];\n\n\t\t\t\t\t\tif ( t < t1global ) {\n\n\t\t\t\t\t\t\ti1 = 2; // + 1, using the scan for the details\n\t\t\t\t\t\t\tt0 = t1global;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// linear reverse scan\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 - 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\t\t\t\t// before start\n\n\t\t\t\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt1 = t0;\n\t\t\t\t\t\t\tt0 = pp[ -- i1 - 1 ];\n\n\t\t\t\t\t\t\tif ( t >= t0 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the left side of the index\n\t\t\t\t\t\tright = i1;\n\t\t\t\t\t\ti1 = 0;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the interval is valid\n\n\t\t\t\t\tbreak validate_interval;\n\n\t\t\t\t} // linear scan\n\n\t\t\t\t// binary search\n\n\t\t\t\twhile ( i1 < right ) {\n\n\t\t\t\t\tconst mid = ( i1 + right ) >>> 1;\n\n\t\t\t\t\tif ( t < pp[ mid ] ) {\n\n\t\t\t\t\t\tright = mid;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ti1 = mid + 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tt1 = pp[ i1 ];\n\t\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\t\t\t// check boundary cases, again\n\n\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t}\n\n\t\t\t} // seek\n\n\t\t\tthis._cachedIndex = i1;\n\n\t\t\tthis.intervalChanged_( i1, t0, t1 );\n\n\t\t} // validate_interval\n\n\t\treturn this.interpolate_( i1, t0, t, t1 );\n\n\t}\n\n\tgetSettings_() {\n\n\t\treturn this.settings || this.DefaultSettings_;\n\n\t}\n\n\tcopySampleValue_( index ) {\n\n\t\t// copies a sample value to the result buffer\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = index * stride;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] = values[ offset + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t// Template methods for derived classes:\n\n\tinterpolate_( /* i1, t0, t, t1 */ ) {\n\n\t\tthrow new Error( 'call to abstract method' );\n\t\t// implementations shall return this.resultBuffer\n\n\t}\n\n\tintervalChanged_( /* i1, t0, t1 */ ) {\n\n\t\t// empty\n\n\t}\n\n}\n\n/**\n * Fast and simple cubic spline interpolant.\n *\n * It was derived from a Hermitian construction setting the first derivative\n * at each sample position to the linear slope between neighboring positions\n * over their parameter interval.\n */\n\nclass CubicInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t\tthis._weightPrev = - 0;\n\t\tthis._offsetPrev = - 0;\n\t\tthis._weightNext = - 0;\n\t\tthis._offsetNext = - 0;\n\n\t\tthis.DefaultSettings_ = {\n\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\n\t\t};\n\n\t}\n\n\tintervalChanged_( i1, t0, t1 ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet iPrev = i1 - 2,\n\t\t\tiNext = i1 + 1,\n\n\t\t\ttPrev = pp[ iPrev ],\n\t\t\ttNext = pp[ iNext ];\n\n\t\tif ( tPrev === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingStart ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(t0) = 0\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = 2 * t0 - t1;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiPrev = pp.length - 2;\n\t\t\t\t\ttPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(t0) = 0 a.k.a. Natural Spline\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = t1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tNext === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingEnd ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(tN) = 0\n\t\t\t\t\tiNext = i1;\n\t\t\t\t\ttNext = 2 * t1 - t0;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiNext = 1;\n\t\t\t\t\ttNext = t1 + pp[ 1 ] - pp[ 0 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(tN) = 0, a.k.a. Natural Spline\n\t\t\t\t\tiNext = i1 - 1;\n\t\t\t\t\ttNext = t0;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst halfDt = ( t1 - t0 ) * 0.5,\n\t\t\tstride = this.valueSize;\n\n\t\tthis._weightPrev = halfDt / ( t0 - tPrev );\n\t\tthis._weightNext = halfDt / ( tNext - t1 );\n\t\tthis._offsetPrev = iPrev * stride;\n\t\tthis._offsetNext = iNext * stride;\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\to1 = i1 * stride,\t\to0 = o1 - stride,\n\t\t\toP = this._offsetPrev, \toN = this._offsetNext,\n\t\t\twP = this._weightPrev,\twN = this._weightNext,\n\n\t\t\tp = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tpp = p * p,\n\t\t\tppp = pp * p;\n\n\t\t// evaluate polynomials\n\n\t\tconst sP = - wP * ppp + 2 * wP * pp - wP * p;\n\t\tconst s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1;\n\t\tconst s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;\n\t\tconst sN = wN * ppp - wN * pp;\n\n\t\t// combine data linearly\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tsP * values[ oP + i ] +\n\t\t\t\t\ts0 * values[ o0 + i ] +\n\t\t\t\t\ts1 * values[ o1 + i ] +\n\t\t\t\t\tsN * values[ oN + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\nclass LinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\toffset1 = i1 * stride,\n\t\t\toffset0 = offset1 - stride,\n\n\t\t\tweight1 = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tweight0 = 1 - weight1;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tvalues[ offset0 + i ] * weight0 +\n\t\t\t\t\tvalues[ offset1 + i ] * weight1;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n *\n * Interpolant that evaluates to the sample value at the position preceding\n * the parameter.\n */\n\nclass DiscreteInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1 /*, t0, t, t1 */ ) {\n\n\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t}\n\n}\n\nclass KeyframeTrack {\n\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tif ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' );\n\t\tif ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name );\n\n\t\tthis.name = name;\n\n\t\tthis.times = convertArray( times, this.TimeBufferType );\n\t\tthis.values = convertArray( values, this.ValueBufferType );\n\n\t\tthis.setInterpolation( interpolation || this.DefaultInterpolation );\n\n\t}\n\n\t// Serialization (in static context, because of constructor invocation\n\t// and automatic invocation of .toJSON):\n\n\tstatic toJSON( track ) {\n\n\t\tconst trackType = track.constructor;\n\n\t\tlet json;\n\n\t\t// derived classes can define a static toJSON method\n\t\tif ( trackType.toJSON !== this.toJSON ) {\n\n\t\t\tjson = trackType.toJSON( track );\n\n\t\t} else {\n\n\t\t\t// by default, we assume the data can be serialized as-is\n\t\t\tjson = {\n\n\t\t\t\t'name': track.name,\n\t\t\t\t'times': convertArray( track.times, Array ),\n\t\t\t\t'values': convertArray( track.values, Array )\n\n\t\t\t};\n\n\t\t\tconst interpolation = track.getInterpolation();\n\n\t\t\tif ( interpolation !== track.DefaultInterpolation ) {\n\n\t\t\t\tjson.interpolation = interpolation;\n\n\t\t\t}\n\n\t\t}\n\n\t\tjson.type = track.ValueTypeName; // mandatory\n\n\t\treturn json;\n\n\t}\n\n\tInterpolantFactoryMethodDiscrete( result ) {\n\n\t\treturn new DiscreteInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new LinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodSmooth( result ) {\n\n\t\treturn new CubicInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tsetInterpolation( interpolation ) {\n\n\t\tlet factoryMethod;\n\n\t\tswitch ( interpolation ) {\n\n\t\t\tcase InterpolateDiscrete:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodDiscrete;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateLinear:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodLinear;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateSmooth:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodSmooth;\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( factoryMethod === undefined ) {\n\n\t\t\tconst message = 'unsupported interpolation for ' +\n\t\t\t\tthis.ValueTypeName + ' keyframe track named ' + this.name;\n\n\t\t\tif ( this.createInterpolant === undefined ) {\n\n\t\t\t\t// fall back to default, unless the default itself is messed up\n\t\t\t\tif ( interpolation !== this.DefaultInterpolation ) {\n\n\t\t\t\t\tthis.setInterpolation( this.DefaultInterpolation );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( message ); // fatal, in this case\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconsole.warn( 'THREE.KeyframeTrack:', message );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tthis.createInterpolant = factoryMethod;\n\n\t\treturn this;\n\n\t}\n\n\tgetInterpolation() {\n\n\t\tswitch ( this.createInterpolant ) {\n\n\t\t\tcase this.InterpolantFactoryMethodDiscrete:\n\n\t\t\t\treturn InterpolateDiscrete;\n\n\t\t\tcase this.InterpolantFactoryMethodLinear:\n\n\t\t\t\treturn InterpolateLinear;\n\n\t\t\tcase this.InterpolantFactoryMethodSmooth:\n\n\t\t\t\treturn InterpolateSmooth;\n\n\t\t}\n\n\t}\n\n\tgetValueSize() {\n\n\t\treturn this.values.length / this.times.length;\n\n\t}\n\n\t// move all keyframes either forwards or backwards in time\n\tshift( timeOffset ) {\n\n\t\tif ( timeOffset !== 0.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] += timeOffset;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// scale all keyframe times by a factor (useful for frame <-> seconds conversions)\n\tscale( timeScale ) {\n\n\t\tif ( timeScale !== 1.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] *= timeScale;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// removes keyframes before and after animation without changing any values within the range [startTime, endTime].\n\t// IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values\n\ttrim( startTime, endTime ) {\n\n\t\tconst times = this.times,\n\t\t\tnKeys = times.length;\n\n\t\tlet from = 0,\n\t\t\tto = nKeys - 1;\n\n\t\twhile ( from !== nKeys && times[ from ] < startTime ) {\n\n\t\t\t++ from;\n\n\t\t}\n\n\t\twhile ( to !== - 1 && times[ to ] > endTime ) {\n\n\t\t\t-- to;\n\n\t\t}\n\n\t\t++ to; // inclusive -> exclusive bound\n\n\t\tif ( from !== 0 || to !== nKeys ) {\n\n\t\t\t// empty tracks are forbidden, so keep at least one keyframe\n\t\t\tif ( from >= to ) {\n\n\t\t\t\tto = Math.max( to, 1 );\n\t\t\t\tfrom = to - 1;\n\n\t\t\t}\n\n\t\t\tconst stride = this.getValueSize();\n\t\t\tthis.times = times.slice( from, to );\n\t\t\tthis.values = this.values.slice( from * stride, to * stride );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tconst valueSize = this.getValueSize();\n\t\tif ( valueSize - Math.floor( valueSize ) !== 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Invalid value size in track.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tconst times = this.times,\n\t\t\tvalues = this.values,\n\n\t\t\tnKeys = times.length;\n\n\t\tif ( nKeys === 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Track is empty.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tlet prevTime = null;\n\n\t\tfor ( let i = 0; i !== nKeys; i ++ ) {\n\n\t\t\tconst currTime = times[ i ];\n\n\t\t\tif ( typeof currTime === 'number' && isNaN( currTime ) ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( prevTime !== null && prevTime > currTime ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tprevTime = currTime;\n\n\t\t}\n\n\t\tif ( values !== undefined ) {\n\n\t\t\tif ( isTypedArray( values ) ) {\n\n\t\t\t\tfor ( let i = 0, n = values.length; i !== n; ++ i ) {\n\n\t\t\t\t\tconst value = values[ i ];\n\n\t\t\t\t\tif ( isNaN( value ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Value is not a valid number.', this, i, value );\n\t\t\t\t\t\tvalid = false;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\t// removes equivalent sequential keys as common in morph target sequences\n\t// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)\n\toptimize() {\n\n\t\t// times or values may be shared with other tracks, so overwriting is unsafe\n\t\tconst times = this.times.slice(),\n\t\t\tvalues = this.values.slice(),\n\t\t\tstride = this.getValueSize(),\n\n\t\t\tsmoothInterpolation = this.getInterpolation() === InterpolateSmooth,\n\n\t\t\tlastIndex = times.length - 1;\n\n\t\tlet writeIndex = 1;\n\n\t\tfor ( let i = 1; i < lastIndex; ++ i ) {\n\n\t\t\tlet keep = false;\n\n\t\t\tconst time = times[ i ];\n\t\t\tconst timeNext = times[ i + 1 ];\n\n\t\t\t// remove adjacent keyframes scheduled at the same time\n\n\t\t\tif ( time !== timeNext && ( i !== 1 || time !== times[ 0 ] ) ) {\n\n\t\t\t\tif ( ! smoothInterpolation ) {\n\n\t\t\t\t\t// remove unnecessary keyframes same as their neighbors\n\n\t\t\t\t\tconst offset = i * stride,\n\t\t\t\t\t\toffsetP = offset - stride,\n\t\t\t\t\t\toffsetN = offset + stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tconst value = values[ offset + j ];\n\n\t\t\t\t\t\tif ( value !== values[ offsetP + j ] ||\n\t\t\t\t\t\t\tvalue !== values[ offsetN + j ] ) {\n\n\t\t\t\t\t\t\tkeep = true;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tkeep = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// in-place compaction\n\n\t\t\tif ( keep ) {\n\n\t\t\t\tif ( i !== writeIndex ) {\n\n\t\t\t\t\ttimes[ writeIndex ] = times[ i ];\n\n\t\t\t\t\tconst readOffset = i * stride,\n\t\t\t\t\t\twriteOffset = writeIndex * stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t++ writeIndex;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// flush last keyframe (compaction looks ahead)\n\n\t\tif ( lastIndex > 0 ) {\n\n\t\t\ttimes[ writeIndex ] = times[ lastIndex ];\n\n\t\t\tfor ( let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) {\n\n\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t}\n\n\t\t\t++ writeIndex;\n\n\t\t}\n\n\t\tif ( writeIndex !== times.length ) {\n\n\t\t\tthis.times = times.slice( 0, writeIndex );\n\t\t\tthis.values = values.slice( 0, writeIndex * stride );\n\n\t\t} else {\n\n\t\t\tthis.times = times;\n\t\t\tthis.values = values;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst times = this.times.slice();\n\t\tconst values = this.values.slice();\n\n\t\tconst TypedKeyframeTrack = this.constructor;\n\t\tconst track = new TypedKeyframeTrack( this.name, times, values );\n\n\t\t// Interpolant argument to constructor is not saved, so copy the factory method directly.\n\t\ttrack.createInterpolant = this.createInterpolant;\n\n\t\treturn track;\n\n\t}\n\n}\n\nKeyframeTrack.prototype.TimeBufferType = Float32Array;\nKeyframeTrack.prototype.ValueBufferType = Float32Array;\nKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\n\n/**\n * A Track of Boolean keyframe values.\n */\nclass BooleanKeyframeTrack extends KeyframeTrack {}\n\nBooleanKeyframeTrack.prototype.ValueTypeName = 'bool';\nBooleanKeyframeTrack.prototype.ValueBufferType = Array;\nBooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of keyframe values that represent color.\n */\nclass ColorKeyframeTrack extends KeyframeTrack {}\n\nColorKeyframeTrack.prototype.ValueTypeName = 'color';\n\n/**\n * A Track of numeric keyframe values.\n */\nclass NumberKeyframeTrack extends KeyframeTrack {}\n\nNumberKeyframeTrack.prototype.ValueTypeName = 'number';\n\n/**\n * Spherical linear unit quaternion interpolant.\n */\n\nclass QuaternionLinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\talpha = ( t - t0 ) / ( t1 - t0 );\n\n\t\tlet offset = i1 * stride;\n\n\t\tfor ( let end = offset + stride; offset !== end; offset += 4 ) {\n\n\t\t\tQuaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n * A Track of quaternion keyframe values.\n */\nclass QuaternionKeyframeTrack extends KeyframeTrack {\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n}\n\nQuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';\n// ValueBufferType is inherited\nQuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\nQuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track that interpolates Strings\n */\nclass StringKeyframeTrack extends KeyframeTrack {}\n\nStringKeyframeTrack.prototype.ValueTypeName = 'string';\nStringKeyframeTrack.prototype.ValueBufferType = Array;\nStringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of vectored keyframe values.\n */\nclass VectorKeyframeTrack extends KeyframeTrack {}\n\nVectorKeyframeTrack.prototype.ValueTypeName = 'vector';\n\nclass AnimationClip {\n\n\tconstructor( name = '', duration = - 1, tracks = [], blendMode = NormalAnimationBlendMode ) {\n\n\t\tthis.name = name;\n\t\tthis.tracks = tracks;\n\t\tthis.duration = duration;\n\t\tthis.blendMode = blendMode;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// this means it should figure out its duration by scanning the tracks\n\t\tif ( this.duration < 0 ) {\n\n\t\t\tthis.resetDuration();\n\n\t\t}\n\n\t}\n\n\n\tstatic parse( json ) {\n\n\t\tconst tracks = [],\n\t\t\tjsonTracks = json.tracks,\n\t\t\tframeTime = 1.0 / ( json.fps || 1.0 );\n\n\t\tfor ( let i = 0, n = jsonTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( parseKeyframeTrack( jsonTracks[ i ] ).scale( frameTime ) );\n\n\t\t}\n\n\t\tconst clip = new this( json.name, json.duration, tracks, json.blendMode );\n\t\tclip.uuid = json.uuid;\n\n\t\treturn clip;\n\n\t}\n\n\tstatic toJSON( clip ) {\n\n\t\tconst tracks = [],\n\t\t\tclipTracks = clip.tracks;\n\n\t\tconst json = {\n\n\t\t\t'name': clip.name,\n\t\t\t'duration': clip.duration,\n\t\t\t'tracks': tracks,\n\t\t\t'uuid': clip.uuid,\n\t\t\t'blendMode': clip.blendMode\n\n\t\t};\n\n\t\tfor ( let i = 0, n = clipTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) );\n\n\t\t}\n\n\t\treturn json;\n\n\t}\n\n\tstatic CreateFromMorphTargetSequence( name, morphTargetSequence, fps, noLoop ) {\n\n\t\tconst numMorphTargets = morphTargetSequence.length;\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < numMorphTargets; i ++ ) {\n\n\t\t\tlet times = [];\n\t\t\tlet values = [];\n\n\t\t\ttimes.push(\n\t\t\t\t( i + numMorphTargets - 1 ) % numMorphTargets,\n\t\t\t\ti,\n\t\t\t\t( i + 1 ) % numMorphTargets );\n\n\t\t\tvalues.push( 0, 1, 0 );\n\n\t\t\tconst order = getKeyframeOrder( times );\n\t\t\ttimes = sortedArray( times, 1, order );\n\t\t\tvalues = sortedArray( values, 1, order );\n\n\t\t\t// if there is a key at the first frame, duplicate it as the\n\t\t\t// last frame as well for perfect loop.\n\t\t\tif ( ! noLoop && times[ 0 ] === 0 ) {\n\n\t\t\t\ttimes.push( numMorphTargets );\n\t\t\t\tvalues.push( values[ 0 ] );\n\n\t\t\t}\n\n\t\t\ttracks.push(\n\t\t\t\tnew NumberKeyframeTrack(\n\t\t\t\t\t'.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']',\n\t\t\t\t\ttimes, values\n\t\t\t\t).scale( 1.0 / fps ) );\n\n\t\t}\n\n\t\treturn new this( name, - 1, tracks );\n\n\t}\n\n\tstatic findByName( objectOrClipArray, name ) {\n\n\t\tlet clipArray = objectOrClipArray;\n\n\t\tif ( ! Array.isArray( objectOrClipArray ) ) {\n\n\t\t\tconst o = objectOrClipArray;\n\t\t\tclipArray = o.geometry && o.geometry.animations || o.animations;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < clipArray.length; i ++ ) {\n\n\t\t\tif ( clipArray[ i ].name === name ) {\n\n\t\t\t\treturn clipArray[ i ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\tstatic CreateClipsFromMorphTargetSequences( morphTargets, fps, noLoop ) {\n\n\t\tconst animationToMorphTargets = {};\n\n\t\t// tested with https://regex101.com/ on trick sequences\n\t\t// such flamingo_flyA_003, flamingo_run1_003, crdeath0059\n\t\tconst pattern = /^([\\w-]*?)([\\d]+)$/;\n\n\t\t// sort morph target names into animation groups based\n\t\t// patterns like Walk_001, Walk_002, Run_001, Run_002\n\t\tfor ( let i = 0, il = morphTargets.length; i < il; i ++ ) {\n\n\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\tconst parts = morphTarget.name.match( pattern );\n\n\t\t\tif ( parts && parts.length > 1 ) {\n\n\t\t\t\tconst name = parts[ 1 ];\n\n\t\t\t\tlet animationMorphTargets = animationToMorphTargets[ name ];\n\n\t\t\t\tif ( ! animationMorphTargets ) {\n\n\t\t\t\t\tanimationToMorphTargets[ name ] = animationMorphTargets = [];\n\n\t\t\t\t}\n\n\t\t\t\tanimationMorphTargets.push( morphTarget );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst clips = [];\n\n\t\tfor ( const name in animationToMorphTargets ) {\n\n\t\t\tclips.push( this.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) );\n\n\t\t}\n\n\t\treturn clips;\n\n\t}\n\n\t// parse the animation.hierarchy format\n\tstatic parseAnimation( animation, bones ) {\n\n\t\tif ( ! animation ) {\n\n\t\t\tconsole.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {\n\n\t\t\t// only return track if there are actually keys.\n\t\t\tif ( animationKeys.length !== 0 ) {\n\n\t\t\t\tconst times = [];\n\t\t\t\tconst values = [];\n\n\t\t\t\tflattenJSON( animationKeys, times, values, propertyName );\n\n\t\t\t\t// empty keys are filtered out, so check again\n\t\t\t\tif ( times.length !== 0 ) {\n\n\t\t\t\t\tdestTracks.push( new trackType( trackName, times, values ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tconst tracks = [];\n\n\t\tconst clipName = animation.name || 'default';\n\t\tconst fps = animation.fps || 30;\n\t\tconst blendMode = animation.blendMode;\n\n\t\t// automatic length determination in AnimationClip.\n\t\tlet duration = animation.length || - 1;\n\n\t\tconst hierarchyTracks = animation.hierarchy || [];\n\n\t\tfor ( let h = 0; h < hierarchyTracks.length; h ++ ) {\n\n\t\t\tconst animationKeys = hierarchyTracks[ h ].keys;\n\n\t\t\t// skip empty tracks\n\t\t\tif ( ! animationKeys || animationKeys.length === 0 ) continue;\n\n\t\t\t// process morph targets\n\t\t\tif ( animationKeys[ 0 ].morphTargets ) {\n\n\t\t\t\t// figure out all morph targets used in this track\n\t\t\t\tconst morphTargetNames = {};\n\n\t\t\t\tlet k;\n\n\t\t\t\tfor ( k = 0; k < animationKeys.length; k ++ ) {\n\n\t\t\t\t\tif ( animationKeys[ k ].morphTargets ) {\n\n\t\t\t\t\t\tfor ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {\n\n\t\t\t\t\t\t\tmorphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = - 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// create a track for each morph target with all zero\n\t\t\t\t// morphTargetInfluences except for the keys in which\n\t\t\t\t// the morphTarget is named.\n\t\t\t\tfor ( const morphTargetName in morphTargetNames ) {\n\n\t\t\t\t\tconst times = [];\n\t\t\t\t\tconst values = [];\n\n\t\t\t\t\tfor ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {\n\n\t\t\t\t\t\tconst animationKey = animationKeys[ k ];\n\n\t\t\t\t\t\ttimes.push( animationKey.time );\n\t\t\t\t\t\tvalues.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );\n\n\t\t\t\t}\n\n\t\t\t\tduration = morphTargetNames.length * fps;\n\n\t\t\t} else {\n\n\t\t\t\t// ...assume skeletal animation\n\n\t\t\t\tconst boneName = '.bones[' + bones[ h ].name + ']';\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.position',\n\t\t\t\t\tanimationKeys, 'pos', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tQuaternionKeyframeTrack, boneName + '.quaternion',\n\t\t\t\t\tanimationKeys, 'rot', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.scale',\n\t\t\t\t\tanimationKeys, 'scl', tracks );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tracks.length === 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst clip = new this( clipName, duration, tracks, blendMode );\n\n\t\treturn clip;\n\n\t}\n\n\tresetDuration() {\n\n\t\tconst tracks = this.tracks;\n\t\tlet duration = 0;\n\n\t\tfor ( let i = 0, n = tracks.length; i !== n; ++ i ) {\n\n\t\t\tconst track = this.tracks[ i ];\n\n\t\t\tduration = Math.max( duration, track.times[ track.times.length - 1 ] );\n\n\t\t}\n\n\t\tthis.duration = duration;\n\n\t\treturn this;\n\n\t}\n\n\ttrim() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].trim( 0, this.duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tvalid = valid && this.tracks[ i ].validate();\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\toptimize() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].optimize();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\ttracks.push( this.tracks[ i ].clone() );\n\n\t\t}\n\n\t\treturn new this.constructor( this.name, this.duration, tracks, this.blendMode );\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.constructor.toJSON( this );\n\n\t}\n\n}\n\nfunction getTrackTypeForValueTypeName( typeName ) {\n\n\tswitch ( typeName.toLowerCase() ) {\n\n\t\tcase 'scalar':\n\t\tcase 'double':\n\t\tcase 'float':\n\t\tcase 'number':\n\t\tcase 'integer':\n\n\t\t\treturn NumberKeyframeTrack;\n\n\t\tcase 'vector':\n\t\tcase 'vector2':\n\t\tcase 'vector3':\n\t\tcase 'vector4':\n\n\t\t\treturn VectorKeyframeTrack;\n\n\t\tcase 'color':\n\n\t\t\treturn ColorKeyframeTrack;\n\n\t\tcase 'quaternion':\n\n\t\t\treturn QuaternionKeyframeTrack;\n\n\t\tcase 'bool':\n\t\tcase 'boolean':\n\n\t\t\treturn BooleanKeyframeTrack;\n\n\t\tcase 'string':\n\n\t\t\treturn StringKeyframeTrack;\n\n\t}\n\n\tthrow new Error( 'THREE.KeyframeTrack: Unsupported typeName: ' + typeName );\n\n}\n\nfunction parseKeyframeTrack( json ) {\n\n\tif ( json.type === undefined ) {\n\n\t\tthrow new Error( 'THREE.KeyframeTrack: track type undefined, can not parse' );\n\n\t}\n\n\tconst trackType = getTrackTypeForValueTypeName( json.type );\n\n\tif ( json.times === undefined ) {\n\n\t\tconst times = [], values = [];\n\n\t\tflattenJSON( json.keys, times, values, 'value' );\n\n\t\tjson.times = times;\n\t\tjson.values = values;\n\n\t}\n\n\t// derived classes can define a static parse method\n\tif ( trackType.parse !== undefined ) {\n\n\t\treturn trackType.parse( json );\n\n\t} else {\n\n\t\t// by default, we assume a constructor compatible with the base\n\t\treturn new trackType( json.name, json.times, json.values, json.interpolation );\n\n\t}\n\n}\n\nconst Cache = {\n\n\tenabled: false,\n\n\tfiles: {},\n\n\tadd: function ( key, file ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Adding key:', key );\n\n\t\tthis.files[ key ] = file;\n\n\t},\n\n\tget: function ( key ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Checking key:', key );\n\n\t\treturn this.files[ key ];\n\n\t},\n\n\tremove: function ( key ) {\n\n\t\tdelete this.files[ key ];\n\n\t},\n\n\tclear: function () {\n\n\t\tthis.files = {};\n\n\t}\n\n};\n\nclass LoadingManager {\n\n\tconstructor( onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tlet isLoading = false;\n\t\tlet itemsLoaded = 0;\n\t\tlet itemsTotal = 0;\n\t\tlet urlModifier = undefined;\n\t\tconst handlers = [];\n\n\t\t// Refer to #5689 for the reason why we don't set .onStart\n\t\t// in the constructor\n\n\t\tthis.onStart = undefined;\n\t\tthis.onLoad = onLoad;\n\t\tthis.onProgress = onProgress;\n\t\tthis.onError = onError;\n\n\t\tthis.itemStart = function ( url ) {\n\n\t\t\titemsTotal ++;\n\n\t\t\tif ( isLoading === false ) {\n\n\t\t\t\tif ( scope.onStart !== undefined ) {\n\n\t\t\t\t\tscope.onStart( url, itemsLoaded, itemsTotal );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tisLoading = true;\n\n\t\t};\n\n\t\tthis.itemEnd = function ( url ) {\n\n\t\t\titemsLoaded ++;\n\n\t\t\tif ( scope.onProgress !== undefined ) {\n\n\t\t\t\tscope.onProgress( url, itemsLoaded, itemsTotal );\n\n\t\t\t}\n\n\t\t\tif ( itemsLoaded === itemsTotal ) {\n\n\t\t\t\tisLoading = false;\n\n\t\t\t\tif ( scope.onLoad !== undefined ) {\n\n\t\t\t\t\tscope.onLoad();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.itemError = function ( url ) {\n\n\t\t\tif ( scope.onError !== undefined ) {\n\n\t\t\t\tscope.onError( url );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.resolveURL = function ( url ) {\n\n\t\t\tif ( urlModifier ) {\n\n\t\t\t\treturn urlModifier( url );\n\n\t\t\t}\n\n\t\t\treturn url;\n\n\t\t};\n\n\t\tthis.setURLModifier = function ( transform ) {\n\n\t\t\turlModifier = transform;\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.addHandler = function ( regex, loader ) {\n\n\t\t\thandlers.push( regex, loader );\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.removeHandler = function ( regex ) {\n\n\t\t\tconst index = handlers.indexOf( regex );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\thandlers.splice( index, 2 );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.getHandler = function ( file ) {\n\n\t\t\tfor ( let i = 0, l = handlers.length; i < l; i += 2 ) {\n\n\t\t\t\tconst regex = handlers[ i ];\n\t\t\t\tconst loader = handlers[ i + 1 ];\n\n\t\t\t\tif ( regex.global ) regex.lastIndex = 0; // see #17920\n\n\t\t\t\tif ( regex.test( file ) ) {\n\n\t\t\t\t\treturn loader;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t};\n\n\t}\n\n}\n\nconst DefaultLoadingManager = /*@__PURE__*/ new LoadingManager();\n\nclass Loader {\n\n\tconstructor( manager ) {\n\n\t\tthis.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;\n\n\t\tthis.crossOrigin = 'anonymous';\n\t\tthis.withCredentials = false;\n\t\tthis.path = '';\n\t\tthis.resourcePath = '';\n\t\tthis.requestHeader = {};\n\n\t}\n\n\tload( /* url, onLoad, onProgress, onError */ ) {}\n\n\tloadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tscope.load( url, resolve, onProgress, reject );\n\n\t\t} );\n\n\t}\n\n\tparse( /* data */ ) {}\n\n\tsetCrossOrigin( crossOrigin ) {\n\n\t\tthis.crossOrigin = crossOrigin;\n\t\treturn this;\n\n\t}\n\n\tsetWithCredentials( value ) {\n\n\t\tthis.withCredentials = value;\n\t\treturn this;\n\n\t}\n\n\tsetPath( path ) {\n\n\t\tthis.path = path;\n\t\treturn this;\n\n\t}\n\n\tsetResourcePath( resourcePath ) {\n\n\t\tthis.resourcePath = resourcePath;\n\t\treturn this;\n\n\t}\n\n\tsetRequestHeader( requestHeader ) {\n\n\t\tthis.requestHeader = requestHeader;\n\t\treturn this;\n\n\t}\n\n}\n\nLoader.DEFAULT_MATERIAL_NAME = '__DEFAULT';\n\nconst loading = {};\n\nclass HttpError extends Error {\n\n\tconstructor( message, response ) {\n\n\t\tsuper( message );\n\t\tthis.response = response;\n\n\t}\n\n}\n\nclass FileLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tthis.manager.itemStart( url );\n\n\t\t\tsetTimeout( () => {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\t// Check if request is duplicate\n\n\t\tif ( loading[ url ] !== undefined ) {\n\n\t\t\tloading[ url ].push( {\n\n\t\t\t\tonLoad: onLoad,\n\t\t\t\tonProgress: onProgress,\n\t\t\t\tonError: onError\n\n\t\t\t} );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Initialise array for duplicate requests\n\t\tloading[ url ] = [];\n\n\t\tloading[ url ].push( {\n\t\t\tonLoad: onLoad,\n\t\t\tonProgress: onProgress,\n\t\t\tonError: onError,\n\t\t} );\n\n\t\t// create request\n\t\tconst req = new Request( url, {\n\t\t\theaders: new Headers( this.requestHeader ),\n\t\t\tcredentials: this.withCredentials ? 'include' : 'same-origin',\n\t\t\t// An abort controller could be added within a future PR\n\t\t} );\n\n\t\t// record states ( avoid data race )\n\t\tconst mimeType = this.mimeType;\n\t\tconst responseType = this.responseType;\n\n\t\t// start the fetch\n\t\tfetch( req )\n\t\t\t.then( response => {\n\n\t\t\t\tif ( response.status === 200 || response.status === 0 ) {\n\n\t\t\t\t\t// Some browsers return HTTP Status 0 when using non-http protocol\n\t\t\t\t\t// e.g. 'file://' or 'data://'. Handle as success.\n\n\t\t\t\t\tif ( response.status === 0 ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.FileLoader: HTTP Status 0 received.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Workaround: Checking if response.body === undefined for Alipay browser #23548\n\n\t\t\t\t\tif ( typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined ) {\n\n\t\t\t\t\t\treturn response;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\t\tconst reader = response.body.getReader();\n\n\t\t\t\t\t// Nginx needs X-File-Size check\n\t\t\t\t\t// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content\n\t\t\t\t\tconst contentLength = response.headers.get( 'Content-Length' ) || response.headers.get( 'X-File-Size' );\n\t\t\t\t\tconst total = contentLength ? parseInt( contentLength ) : 0;\n\t\t\t\t\tconst lengthComputable = total !== 0;\n\t\t\t\t\tlet loaded = 0;\n\n\t\t\t\t\t// periodically read data into the new stream tracking while download progress\n\t\t\t\t\tconst stream = new ReadableStream( {\n\t\t\t\t\t\tstart( controller ) {\n\n\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\tfunction readData() {\n\n\t\t\t\t\t\t\t\treader.read().then( ( { done, value } ) => {\n\n\t\t\t\t\t\t\t\t\tif ( done ) {\n\n\t\t\t\t\t\t\t\t\t\tcontroller.close();\n\n\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\tloaded += value.byteLength;\n\n\t\t\t\t\t\t\t\t\t\tconst event = new ProgressEvent( 'progress', { lengthComputable, loaded, total } );\n\t\t\t\t\t\t\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\t\t\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\t\t\t\t\t\t\tif ( callback.onProgress ) callback.onProgress( event );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tcontroller.enqueue( value );\n\t\t\t\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn new Response( stream );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new HttpError( `fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}`, response );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( response => {\n\n\t\t\t\tswitch ( responseType ) {\n\n\t\t\t\t\tcase 'arraybuffer':\n\n\t\t\t\t\t\treturn response.arrayBuffer();\n\n\t\t\t\t\tcase 'blob':\n\n\t\t\t\t\t\treturn response.blob();\n\n\t\t\t\t\tcase 'document':\n\n\t\t\t\t\t\treturn response.text()\n\t\t\t\t\t\t\t.then( text => {\n\n\t\t\t\t\t\t\t\tconst parser = new DOMParser();\n\t\t\t\t\t\t\t\treturn parser.parseFromString( text, mimeType );\n\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\tcase 'json':\n\n\t\t\t\t\t\treturn response.json();\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( mimeType === undefined ) {\n\n\t\t\t\t\t\t\treturn response.text();\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// sniff encoding\n\t\t\t\t\t\t\tconst re = /charset=\"?([^;\"\\s]*)\"?/i;\n\t\t\t\t\t\t\tconst exec = re.exec( mimeType );\n\t\t\t\t\t\t\tconst label = exec && exec[ 1 ] ? exec[ 1 ].toLowerCase() : undefined;\n\t\t\t\t\t\t\tconst decoder = new TextDecoder( label );\n\t\t\t\t\t\t\treturn response.arrayBuffer().then( ab => decoder.decode( ab ) );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( data => {\n\n\t\t\t\t// Add to cache only on HTTP success, so that we do not cache\n\t\t\t\t// error response bodies as proper responses to requests.\n\t\t\t\tCache.add( url, data );\n\n\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onLoad ) callback.onLoad( data );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.catch( err => {\n\n\t\t\t\t// Abort errors and other errors are handled the same\n\n\t\t\t\tconst callbacks = loading[ url ];\n\n\t\t\t\tif ( callbacks === undefined ) {\n\n\t\t\t\t\t// When onLoad was called and url was deleted in `loading`\n\t\t\t\t\tthis.manager.itemError( url );\n\t\t\t\t\tthrow err;\n\n\t\t\t\t}\n\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onError ) callback.onError( err );\n\n\t\t\t\t}\n\n\t\t\t\tthis.manager.itemError( url );\n\n\t\t\t} )\n\t\t\t.finally( () => {\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\tthis.manager.itemStart( url );\n\n\t}\n\n\tsetResponseType( value ) {\n\n\t\tthis.responseType = value;\n\t\treturn this;\n\n\t}\n\n\tsetMimeType( value ) {\n\n\t\tthis.mimeType = value;\n\t\treturn this;\n\n\t}\n\n}\n\nclass AnimationLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst animations = [];\n\n\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\tconst clip = AnimationClip.parse( json[ i ] );\n\n\t\t\tanimations.push( clip );\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to block based textures loader (dds, pvr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass CompressedTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst images = [];\n\n\t\tconst texture = new CompressedTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( url[ i ], function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\timages[ i ] = {\n\t\t\t\t\twidth: texDatas.width,\n\t\t\t\t\theight: texDatas.height,\n\t\t\t\t\tformat: texDatas.format,\n\t\t\t\t\tmipmaps: texDatas.mipmaps\n\t\t\t\t};\n\n\t\t\t\tloaded += 1;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\tif ( texDatas.mipmapCount === 1 ) texture.minFilter = LinearFilter;\n\n\t\t\t\t\ttexture.image = images;\n\t\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\tif ( Array.isArray( url ) ) {\n\n\t\t\tfor ( let i = 0, il = url.length; i < il; ++ i ) {\n\n\t\t\t\tloadTexture( i );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// compressed cubemap texture stored in a single DDS file\n\n\t\t\tloader.load( url, function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\tif ( texDatas.isCubemap ) {\n\n\t\t\t\t\tconst faces = texDatas.mipmaps.length / texDatas.mipmapCount;\n\n\t\t\t\t\tfor ( let f = 0; f < faces; f ++ ) {\n\n\t\t\t\t\t\timages[ f ] = { mipmaps: [] };\n\n\t\t\t\t\t\tfor ( let i = 0; i < texDatas.mipmapCount; i ++ ) {\n\n\t\t\t\t\t\t\timages[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );\n\t\t\t\t\t\t\timages[ f ].format = texDatas.format;\n\t\t\t\t\t\t\timages[ f ].width = texDatas.width;\n\t\t\t\t\t\t\timages[ f ].height = texDatas.height;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.image = images;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture.image.width = texDatas.width;\n\t\t\t\t\ttexture.image.height = texDatas.height;\n\t\t\t\t\ttexture.mipmaps = texDatas.mipmaps;\n\n\t\t\t\t}\n\n\t\t\t\tif ( texDatas.mipmapCount === 1 ) {\n\n\t\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t\t}\n\n\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass ImageLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst image = createElementNS( 'img' );\n\n\t\tfunction onImageLoad() {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tCache.add( url, this );\n\n\t\t\tif ( onLoad ) onLoad( this );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction onImageError( event ) {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tif ( onError ) onError( event );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction removeEventListeners() {\n\n\t\t\timage.removeEventListener( 'load', onImageLoad, false );\n\t\t\timage.removeEventListener( 'error', onImageError, false );\n\n\t\t}\n\n\t\timage.addEventListener( 'load', onImageLoad, false );\n\t\timage.addEventListener( 'error', onImageError, false );\n\n\t\tif ( url.slice( 0, 5 ) !== 'data:' ) {\n\n\t\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\n\n\t\t}\n\n\t\tscope.manager.itemStart( url );\n\n\t\timage.src = url;\n\n\t\treturn image;\n\n\t}\n\n}\n\nclass CubeTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( urls, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new CubeTexture();\n\t\ttexture.colorSpace = SRGBColorSpace;\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( urls[ i ], function ( image ) {\n\n\t\t\t\ttexture.images[ i ] = image;\n\n\t\t\t\tloaded ++;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, undefined, onError );\n\n\t\t}\n\n\t\tfor ( let i = 0; i < urls.length; ++ i ) {\n\n\t\t\tloadTexture( i );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass DataTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst texture = new DataTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setPath( this.path );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\tlet texData;\n\n\t\t\ttry {\n\n\t\t\t\ttexData = scope.parse( buffer );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) {\n\n\t\t\t\t\tonError( error );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( error );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( texData.image !== undefined ) {\n\n\t\t\t\ttexture.image = texData.image;\n\n\t\t\t} else if ( texData.data !== undefined ) {\n\n\t\t\t\ttexture.image.width = texData.width;\n\t\t\t\ttexture.image.height = texData.height;\n\t\t\t\ttexture.image.data = texData.data;\n\n\t\t\t}\n\n\t\t\ttexture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;\n\t\t\ttexture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;\n\n\t\t\ttexture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;\n\t\t\ttexture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;\n\n\t\t\ttexture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\n\n\t\t\tif ( texData.colorSpace !== undefined ) {\n\n\t\t\t\ttexture.colorSpace = texData.colorSpace;\n\n\t\t\t}\n\n\t\t\tif ( texData.flipY !== undefined ) {\n\n\t\t\t\ttexture.flipY = texData.flipY;\n\n\t\t\t}\n\n\t\t\tif ( texData.format !== undefined ) {\n\n\t\t\t\ttexture.format = texData.format;\n\n\t\t\t}\n\n\t\t\tif ( texData.type !== undefined ) {\n\n\t\t\t\ttexture.type = texData.type;\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmaps !== undefined ) {\n\n\t\t\t\ttexture.mipmaps = texData.mipmaps;\n\t\t\t\ttexture.minFilter = LinearMipmapLinearFilter; // presumably...\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmapCount === 1 ) {\n\n\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t}\n\n\t\t\tif ( texData.generateMipmaps !== undefined ) {\n\n\t\t\t\ttexture.generateMipmaps = texData.generateMipmaps;\n\n\t\t\t}\n\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad ) onLoad( texture, texData );\n\n\t\t}, onProgress, onError );\n\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass TextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new Texture();\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tloader.load( url, function ( image ) {\n\n\t\t\ttexture.image = image;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad !== undefined ) {\n\n\t\t\t\tonLoad( texture );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass Light extends Object3D {\n\n\tconstructor( color, intensity = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.isLight = true;\n\n\t\tthis.type = 'Light';\n\n\t\tthis.color = new Color( color );\n\t\tthis.intensity = intensity;\n\n\t}\n\n\tdispose() {\n\n\t\t// Empty here in base class; some subclasses override.\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.intensity = source.intensity;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.color = this.color.getHex();\n\t\tdata.object.intensity = this.intensity;\n\n\t\tif ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();\n\n\t\tif ( this.distance !== undefined ) data.object.distance = this.distance;\n\t\tif ( this.angle !== undefined ) data.object.angle = this.angle;\n\t\tif ( this.decay !== undefined ) data.object.decay = this.decay;\n\t\tif ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;\n\n\t\tif ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass HemisphereLight extends Light {\n\n\tconstructor( skyColor, groundColor, intensity ) {\n\n\t\tsuper( skyColor, intensity );\n\n\t\tthis.isHemisphereLight = true;\n\n\t\tthis.type = 'HemisphereLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.groundColor = new Color( groundColor );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.groundColor.copy( source.groundColor );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld$1 = /*@__PURE__*/ new Vector3();\nconst _lookTarget$1 = /*@__PURE__*/ new Vector3();\n\nclass LightShadow {\n\n\tconstructor( camera ) {\n\n\t\tthis.camera = camera;\n\n\t\tthis.bias = 0;\n\t\tthis.normalBias = 0;\n\t\tthis.radius = 1;\n\t\tthis.blurSamples = 8;\n\n\t\tthis.mapSize = new Vector2( 512, 512 );\n\n\t\tthis.map = null;\n\t\tthis.mapPass = null;\n\t\tthis.matrix = new Matrix4();\n\n\t\tthis.autoUpdate = true;\n\t\tthis.needsUpdate = false;\n\n\t\tthis._frustum = new Frustum();\n\t\tthis._frameExtents = new Vector2( 1, 1 );\n\n\t\tthis._viewportCount = 1;\n\n\t\tthis._viewports = [\n\n\t\t\tnew Vector4( 0, 0, 1, 1 )\n\n\t\t];\n\n\t}\n\n\tgetViewportCount() {\n\n\t\treturn this._viewportCount;\n\n\t}\n\n\tgetFrustum() {\n\n\t\treturn this._frustum;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst shadowCamera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\t_lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld );\n\t\tshadowCamera.position.copy( _lightPositionWorld$1 );\n\n\t\t_lookTarget$1.setFromMatrixPosition( light.target.matrixWorld );\n\t\tshadowCamera.lookAt( _lookTarget$1 );\n\t\tshadowCamera.updateMatrixWorld();\n\n\t\t_projScreenMatrix$1.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix$1 );\n\n\t\tshadowMatrix.set(\n\t\t\t0.5, 0.0, 0.0, 0.5,\n\t\t\t0.0, 0.5, 0.0, 0.5,\n\t\t\t0.0, 0.0, 0.5, 0.5,\n\t\t\t0.0, 0.0, 0.0, 1.0\n\t\t);\n\n\t\tshadowMatrix.multiply( _projScreenMatrix$1 );\n\n\t}\n\n\tgetViewport( viewportIndex ) {\n\n\t\treturn this._viewports[ viewportIndex ];\n\n\t}\n\n\tgetFrameExtents() {\n\n\t\treturn this._frameExtents;\n\n\t}\n\n\tdispose() {\n\n\t\tif ( this.map ) {\n\n\t\t\tthis.map.dispose();\n\n\t\t}\n\n\t\tif ( this.mapPass ) {\n\n\t\t\tthis.mapPass.dispose();\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.camera = source.camera.clone();\n\n\t\tthis.bias = source.bias;\n\t\tthis.radius = source.radius;\n\n\t\tthis.mapSize.copy( source.mapSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst object = {};\n\n\t\tif ( this.bias !== 0 ) object.bias = this.bias;\n\t\tif ( this.normalBias !== 0 ) object.normalBias = this.normalBias;\n\t\tif ( this.radius !== 1 ) object.radius = this.radius;\n\t\tif ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();\n\n\t\tobject.camera = this.camera.toJSON( false ).object;\n\t\tdelete object.camera.matrix;\n\n\t\treturn object;\n\n\t}\n\n}\n\nclass SpotLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 50, 1, 0.5, 500 ) );\n\n\t\tthis.isSpotLightShadow = true;\n\n\t\tthis.focus = 1;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst camera = this.camera;\n\n\t\tconst fov = RAD2DEG * 2 * light.angle * this.focus;\n\t\tconst aspect = this.mapSize.width / this.mapSize.height;\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {\n\n\t\t\tcamera.fov = fov;\n\t\t\tcamera.aspect = aspect;\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\tsuper.updateMatrices( light );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.focus = source.focus;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass SpotLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isSpotLight = true;\n\n\t\tthis.type = 'SpotLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.distance = distance;\n\t\tthis.angle = angle;\n\t\tthis.penumbra = penumbra;\n\t\tthis.decay = decay;\n\n\t\tthis.map = null;\n\n\t\tthis.shadow = new SpotLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)\n\t\treturn this.intensity * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / Math.PI;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.angle = source.angle;\n\t\tthis.penumbra = source.penumbra;\n\t\tthis.decay = source.decay;\n\n\t\tthis.target = source.target.clone();\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _projScreenMatrix = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld = /*@__PURE__*/ new Vector3();\nconst _lookTarget = /*@__PURE__*/ new Vector3();\n\nclass PointLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 90, 1, 0.5, 500 ) );\n\n\t\tthis.isPointLightShadow = true;\n\n\t\tthis._frameExtents = new Vector2( 4, 2 );\n\n\t\tthis._viewportCount = 6;\n\n\t\tthis._viewports = [\n\t\t\t// These viewports map a cube-map onto a 2D texture with the\n\t\t\t// following orientation:\n\t\t\t//\n\t\t\t// xzXZ\n\t\t\t// y Y\n\t\t\t//\n\t\t\t// X - Positive x direction\n\t\t\t// x - Negative x direction\n\t\t\t// Y - Positive y direction\n\t\t\t// y - Negative y direction\n\t\t\t// Z - Positive z direction\n\t\t\t// z - Negative z direction\n\n\t\t\t// positive X\n\t\t\tnew Vector4( 2, 1, 1, 1 ),\n\t\t\t// negative X\n\t\t\tnew Vector4( 0, 1, 1, 1 ),\n\t\t\t// positive Z\n\t\t\tnew Vector4( 3, 1, 1, 1 ),\n\t\t\t// negative Z\n\t\t\tnew Vector4( 1, 1, 1, 1 ),\n\t\t\t// positive Y\n\t\t\tnew Vector4( 3, 0, 1, 1 ),\n\t\t\t// negative Y\n\t\t\tnew Vector4( 1, 0, 1, 1 )\n\t\t];\n\n\t\tthis._cubeDirections = [\n\t\t\tnew Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ),\n\t\t\tnew Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 )\n\t\t];\n\n\t\tthis._cubeUps = [\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ),\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ),\tnew Vector3( 0, 0, - 1 )\n\t\t];\n\n\t}\n\n\tupdateMatrices( light, viewportIndex = 0 ) {\n\n\t\tconst camera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( far !== camera.far ) {\n\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\t_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );\n\t\tcamera.position.copy( _lightPositionWorld );\n\n\t\t_lookTarget.copy( camera.position );\n\t\t_lookTarget.add( this._cubeDirections[ viewportIndex ] );\n\t\tcamera.up.copy( this._cubeUps[ viewportIndex ] );\n\t\tcamera.lookAt( _lookTarget );\n\t\tcamera.updateMatrixWorld();\n\n\t\tshadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );\n\n\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t}\n\n}\n\nclass PointLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isPointLight = true;\n\n\t\tthis.type = 'PointLight';\n\n\t\tthis.distance = distance;\n\t\tthis.decay = decay;\n\n\t\tthis.shadow = new PointLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd)\n\t\treturn this.intensity * 4 * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( 4 * Math.PI );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.decay = source.decay;\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass DirectionalLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );\n\n\t\tthis.isDirectionalLightShadow = true;\n\n\t}\n\n}\n\nclass DirectionalLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isDirectionalLight = true;\n\n\t\tthis.type = 'DirectionalLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.shadow = new DirectionalLightShadow();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.target = source.target.clone();\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass AmbientLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isAmbientLight = true;\n\n\t\tthis.type = 'AmbientLight';\n\n\t}\n\n}\n\nclass RectAreaLight extends Light {\n\n\tconstructor( color, intensity, width = 10, height = 10 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isRectAreaLight = true;\n\n\t\tthis.type = 'RectAreaLight';\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in nits)\n\t\treturn this.intensity * this.width * this.height * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in nits) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( this.width * this.height * Math.PI );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.width = this.width;\n\t\tdata.object.height = this.height;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Primary reference:\n * https://graphics.stanford.edu/papers/envmap/envmap.pdf\n *\n * Secondary reference:\n * https://www.ppsloan.org/publications/StupidSH36.pdf\n */\n\n// 3-band SH defined by 9 coefficients\n\nclass SphericalHarmonics3 {\n\n\tconstructor() {\n\n\t\tthis.isSphericalHarmonics3 = true;\n\n\t\tthis.coefficients = [];\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients.push( new Vector3() );\n\n\t\t}\n\n\t}\n\n\tset( coefficients ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].copy( coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tzero() {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].set( 0, 0, 0 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// get the radiance in the direction of the normal\n\t// target is a Vector3\n\tgetAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 0.488603 * y );\n\t\ttarget.addScaledVector( coeff[ 2 ], 0.488603 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 0.488603 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) );\n\t\ttarget.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );\n\t\ttarget.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );\n\n\t\treturn target;\n\n\t}\n\n\t// get the irradiance (radiance convolved with cosine lobe) in the direction of the normal\n\t// target is a Vector3\n\t// https://graphics.stanford.edu/papers/envmap/envmap.pdf\n\tgetIrradianceAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // π * 0.282095\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * π / 3 ) * 0.488603\n\t\ttarget.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( π / 4 ) * 1.092548\n\t\ttarget.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( π / 4 ) * 0.315392 * 3\n\t\ttarget.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( π / 4 ) * 0.546274\n\n\t\treturn target;\n\n\t}\n\n\tadd( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].add( sh.coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\taddScaledSH( sh, s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tscale( s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].multiplyScalar( s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tlerp( sh, alpha ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcopy( sh ) {\n\n\t\treturn this.set( sh.coefficients );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].fromArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].toArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn array;\n\n\t}\n\n\t// evaluate the basis functions\n\t// shBasis is an Array[ 9 ]\n\tstatic getBasisAt( normal, shBasis ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\t// band 0\n\t\tshBasis[ 0 ] = 0.282095;\n\n\t\t// band 1\n\t\tshBasis[ 1 ] = 0.488603 * y;\n\t\tshBasis[ 2 ] = 0.488603 * z;\n\t\tshBasis[ 3 ] = 0.488603 * x;\n\n\t\t// band 2\n\t\tshBasis[ 4 ] = 1.092548 * x * y;\n\t\tshBasis[ 5 ] = 1.092548 * y * z;\n\t\tshBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );\n\t\tshBasis[ 7 ] = 1.092548 * x * z;\n\t\tshBasis[ 8 ] = 0.546274 * ( x * x - y * y );\n\n\t}\n\n}\n\nclass LightProbe extends Light {\n\n\tconstructor( sh = new SphericalHarmonics3(), intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tthis.isLightProbe = true;\n\n\t\tthis.sh = sh;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.sh.copy( source.sh );\n\n\t\treturn this;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();\n\t\tthis.sh.fromArray( json.sh );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.sh = this.sh.toArray();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass MaterialLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\t\tthis.textures = {};\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst textures = this.textures;\n\n\t\tfunction getTexture( name ) {\n\n\t\t\tif ( textures[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.MaterialLoader: Undefined texture', name );\n\n\t\t\t}\n\n\t\t\treturn textures[ name ];\n\n\t\t}\n\n\t\tconst material = MaterialLoader.createMaterialFromType( json.type );\n\n\t\tif ( json.uuid !== undefined ) material.uuid = json.uuid;\n\t\tif ( json.name !== undefined ) material.name = json.name;\n\t\tif ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );\n\t\tif ( json.roughness !== undefined ) material.roughness = json.roughness;\n\t\tif ( json.metalness !== undefined ) material.metalness = json.metalness;\n\t\tif ( json.sheen !== undefined ) material.sheen = json.sheen;\n\t\tif ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );\n\t\tif ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;\n\t\tif ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );\n\t\tif ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );\n\t\tif ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;\n\t\tif ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );\n\t\tif ( json.shininess !== undefined ) material.shininess = json.shininess;\n\t\tif ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;\n\t\tif ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;\n\t\tif ( json.iridescence !== undefined ) material.iridescence = json.iridescence;\n\t\tif ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;\n\t\tif ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;\n\t\tif ( json.transmission !== undefined ) material.transmission = json.transmission;\n\t\tif ( json.thickness !== undefined ) material.thickness = json.thickness;\n\t\tif ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;\n\t\tif ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );\n\t\tif ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;\n\t\tif ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;\n\t\tif ( json.fog !== undefined ) material.fog = json.fog;\n\t\tif ( json.flatShading !== undefined ) material.flatShading = json.flatShading;\n\t\tif ( json.blending !== undefined ) material.blending = json.blending;\n\t\tif ( json.combine !== undefined ) material.combine = json.combine;\n\t\tif ( json.side !== undefined ) material.side = json.side;\n\t\tif ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;\n\t\tif ( json.opacity !== undefined ) material.opacity = json.opacity;\n\t\tif ( json.transparent !== undefined ) material.transparent = json.transparent;\n\t\tif ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;\n\t\tif ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;\n\t\tif ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;\n\t\tif ( json.depthTest !== undefined ) material.depthTest = json.depthTest;\n\t\tif ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;\n\t\tif ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;\n\t\tif ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;\n\t\tif ( json.blendDst !== undefined ) material.blendDst = json.blendDst;\n\t\tif ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;\n\t\tif ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;\n\t\tif ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;\n\t\tif ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;\n\t\tif ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );\n\t\tif ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;\n\t\tif ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;\n\t\tif ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;\n\t\tif ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;\n\t\tif ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;\n\t\tif ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;\n\t\tif ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;\n\t\tif ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;\n\t\tif ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;\n\n\t\tif ( json.wireframe !== undefined ) material.wireframe = json.wireframe;\n\t\tif ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;\n\t\tif ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;\n\t\tif ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;\n\n\t\tif ( json.rotation !== undefined ) material.rotation = json.rotation;\n\n\t\tif ( json.linewidth !== undefined ) material.linewidth = json.linewidth;\n\t\tif ( json.dashSize !== undefined ) material.dashSize = json.dashSize;\n\t\tif ( json.gapSize !== undefined ) material.gapSize = json.gapSize;\n\t\tif ( json.scale !== undefined ) material.scale = json.scale;\n\n\t\tif ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;\n\t\tif ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;\n\t\tif ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;\n\n\t\tif ( json.dithering !== undefined ) material.dithering = json.dithering;\n\n\t\tif ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;\n\t\tif ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;\n\t\tif ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;\n\n\t\tif ( json.visible !== undefined ) material.visible = json.visible;\n\n\t\tif ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;\n\n\t\tif ( json.userData !== undefined ) material.userData = json.userData;\n\n\t\tif ( json.vertexColors !== undefined ) {\n\n\t\t\tif ( typeof json.vertexColors === 'number' ) {\n\n\t\t\t\tmaterial.vertexColors = ( json.vertexColors > 0 ) ? true : false;\n\n\t\t\t} else {\n\n\t\t\t\tmaterial.vertexColors = json.vertexColors;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Shader Material\n\n\t\tif ( json.uniforms !== undefined ) {\n\n\t\t\tfor ( const name in json.uniforms ) {\n\n\t\t\t\tconst uniform = json.uniforms[ name ];\n\n\t\t\t\tmaterial.uniforms[ name ] = {};\n\n\t\t\t\tswitch ( uniform.type ) {\n\n\t\t\t\t\tcase 't':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = getTexture( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'c':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Color().setHex( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v2':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector2().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = uniform.value;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.defines !== undefined ) material.defines = json.defines;\n\t\tif ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;\n\t\tif ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;\n\t\tif ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;\n\n\t\tif ( json.extensions !== undefined ) {\n\n\t\t\tfor ( const key in json.extensions ) {\n\n\t\t\t\tmaterial.extensions[ key ] = json.extensions[ key ];\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.lights !== undefined ) material.lights = json.lights;\n\t\tif ( json.clipping !== undefined ) material.clipping = json.clipping;\n\n\t\t// for PointsMaterial\n\n\t\tif ( json.size !== undefined ) material.size = json.size;\n\t\tif ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;\n\n\t\t// maps\n\n\t\tif ( json.map !== undefined ) material.map = getTexture( json.map );\n\t\tif ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );\n\n\t\tif ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );\n\n\t\tif ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );\n\t\tif ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;\n\n\t\tif ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );\n\t\tif ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;\n\t\tif ( json.normalScale !== undefined ) {\n\n\t\t\tlet normalScale = json.normalScale;\n\n\t\t\tif ( Array.isArray( normalScale ) === false ) {\n\n\t\t\t\t// Blender exporter used to export a scalar. See #7459\n\n\t\t\t\tnormalScale = [ normalScale, normalScale ];\n\n\t\t\t}\n\n\t\t\tmaterial.normalScale = new Vector2().fromArray( normalScale );\n\n\t\t}\n\n\t\tif ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );\n\t\tif ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;\n\t\tif ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;\n\n\t\tif ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );\n\t\tif ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );\n\n\t\tif ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );\n\t\tif ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;\n\n\t\tif ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );\n\t\tif ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );\n\t\tif ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );\n\n\t\tif ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );\n\t\tif ( json.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );\n\t\tif ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;\n\n\t\tif ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;\n\t\tif ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;\n\n\t\tif ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );\n\t\tif ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;\n\n\t\tif ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );\n\t\tif ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;\n\n\t\tif ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );\n\n\t\tif ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );\n\t\tif ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );\n\t\tif ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );\n\t\tif ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );\n\n\t\tif ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );\n\t\tif ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );\n\n\t\tif ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );\n\t\tif ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );\n\n\t\tif ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );\n\n\t\tif ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );\n\t\tif ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );\n\n\t\treturn material;\n\n\t}\n\n\tsetTextures( value ) {\n\n\t\tthis.textures = value;\n\t\treturn this;\n\n\t}\n\n\tstatic createMaterialFromType( type ) {\n\n\t\tconst materialLib = {\n\t\t\tShadowMaterial,\n\t\t\tSpriteMaterial,\n\t\t\tRawShaderMaterial,\n\t\t\tShaderMaterial,\n\t\t\tPointsMaterial,\n\t\t\tMeshPhysicalMaterial,\n\t\t\tMeshStandardMaterial,\n\t\t\tMeshPhongMaterial,\n\t\t\tMeshToonMaterial,\n\t\t\tMeshNormalMaterial,\n\t\t\tMeshLambertMaterial,\n\t\t\tMeshDepthMaterial,\n\t\t\tMeshDistanceMaterial,\n\t\t\tMeshBasicMaterial,\n\t\t\tMeshMatcapMaterial,\n\t\t\tLineDashedMaterial,\n\t\t\tLineBasicMaterial,\n\t\t\tMaterial\n\t\t};\n\n\t\treturn new materialLib[ type ]();\n\n\t}\n\n}\n\nclass LoaderUtils {\n\n\tstatic decodeText( array ) {\n\n\t\tif ( typeof TextDecoder !== 'undefined' ) {\n\n\t\t\treturn new TextDecoder().decode( array );\n\n\t\t}\n\n\t\t// Avoid the String.fromCharCode.apply(null, array) shortcut, which\n\t\t// throws a \"maximum call stack size exceeded\" error for large arrays.\n\n\t\tlet s = '';\n\n\t\tfor ( let i = 0, il = array.length; i < il; i ++ ) {\n\n\t\t\t// Implicitly assumes little-endian.\n\t\t\ts += String.fromCharCode( array[ i ] );\n\n\t\t}\n\n\t\ttry {\n\n\t\t\t// merges multi-byte utf-8 characters.\n\n\t\t\treturn decodeURIComponent( escape( s ) );\n\n\t\t} catch ( e ) { // see #16358\n\n\t\t\treturn s;\n\n\t\t}\n\n\t}\n\n\tstatic extractUrlBase( url ) {\n\n\t\tconst index = url.lastIndexOf( '/' );\n\n\t\tif ( index === - 1 ) return './';\n\n\t\treturn url.slice( 0, index + 1 );\n\n\t}\n\n\tstatic resolveURL( url, path ) {\n\n\t\t// Invalid URL\n\t\tif ( typeof url !== 'string' || url === '' ) return '';\n\n\t\t// Host Relative URL\n\t\tif ( /^https?:\\/\\//i.test( path ) && /^\\//.test( url ) ) {\n\n\t\t\tpath = path.replace( /(^https?:\\/\\/[^\\/]+).*/i, '$1' );\n\n\t\t}\n\n\t\t// Absolute URL http://,https://,//\n\t\tif ( /^(https?:)?\\/\\//i.test( url ) ) return url;\n\n\t\t// Data URI\n\t\tif ( /^data:.*,.*$/i.test( url ) ) return url;\n\n\t\t// Blob URL\n\t\tif ( /^blob:.*$/i.test( url ) ) return url;\n\n\t\t// Relative URL\n\t\treturn path + url;\n\n\t}\n\n}\n\nclass InstancedBufferGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isInstancedBufferGeometry = true;\n\n\t\tthis.type = 'InstancedBufferGeometry';\n\t\tthis.instanceCount = Infinity;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.instanceCount = source.instanceCount;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.instanceCount = this.instanceCount;\n\n\t\tdata.isInstancedBufferGeometry = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass BufferGeometryLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst interleavedBufferMap = {};\n\t\tconst arrayBufferMap = {};\n\n\t\tfunction getInterleavedBuffer( json, uuid ) {\n\n\t\t\tif ( interleavedBufferMap[ uuid ] !== undefined ) return interleavedBufferMap[ uuid ];\n\n\t\t\tconst interleavedBuffers = json.interleavedBuffers;\n\t\t\tconst interleavedBuffer = interleavedBuffers[ uuid ];\n\n\t\t\tconst buffer = getArrayBuffer( json, interleavedBuffer.buffer );\n\n\t\t\tconst array = getTypedArray( interleavedBuffer.type, buffer );\n\t\t\tconst ib = new InterleavedBuffer( array, interleavedBuffer.stride );\n\t\t\tib.uuid = interleavedBuffer.uuid;\n\n\t\t\tinterleavedBufferMap[ uuid ] = ib;\n\n\t\t\treturn ib;\n\n\t\t}\n\n\t\tfunction getArrayBuffer( json, uuid ) {\n\n\t\t\tif ( arrayBufferMap[ uuid ] !== undefined ) return arrayBufferMap[ uuid ];\n\n\t\t\tconst arrayBuffers = json.arrayBuffers;\n\t\t\tconst arrayBuffer = arrayBuffers[ uuid ];\n\n\t\t\tconst ab = new Uint32Array( arrayBuffer ).buffer;\n\n\t\t\tarrayBufferMap[ uuid ] = ab;\n\n\t\t\treturn ab;\n\n\t\t}\n\n\t\tconst geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();\n\n\t\tconst index = json.data.index;\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst typedArray = getTypedArray( index.type, index.array );\n\t\t\tgeometry.setIndex( new BufferAttribute( typedArray, 1 ) );\n\n\t\t}\n\n\t\tconst attributes = json.data.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\t\t\tlet bufferAttribute;\n\n\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t} else {\n\n\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\tconst bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;\n\t\t\t\tbufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t}\n\n\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\tif ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );\n\n\t\t\tgeometry.setAttribute( key, bufferAttribute );\n\n\t\t}\n\n\t\tconst morphAttributes = json.data.morphAttributes;\n\n\t\tif ( morphAttributes ) {\n\n\t\t\tfor ( const key in morphAttributes ) {\n\n\t\t\t\tconst attributeArray = morphAttributes[ key ];\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attribute = attributeArray[ i ];\n\t\t\t\t\tlet bufferAttribute;\n\n\t\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\t\t\tbufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\t\t\tarray.push( bufferAttribute );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.morphAttributes[ key ] = array;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst morphTargetsRelative = json.data.morphTargetsRelative;\n\n\t\tif ( morphTargetsRelative ) {\n\n\t\t\tgeometry.morphTargetsRelative = true;\n\n\t\t}\n\n\t\tconst groups = json.data.groups || json.data.drawcalls || json.data.offsets;\n\n\t\tif ( groups !== undefined ) {\n\n\t\t\tfor ( let i = 0, n = groups.length; i !== n; ++ i ) {\n\n\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\tgeometry.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst boundingSphere = json.data.boundingSphere;\n\n\t\tif ( boundingSphere !== undefined ) {\n\n\t\t\tconst center = new Vector3();\n\n\t\t\tif ( boundingSphere.center !== undefined ) {\n\n\t\t\t\tcenter.fromArray( boundingSphere.center );\n\n\t\t\t}\n\n\t\t\tgeometry.boundingSphere = new Sphere( center, boundingSphere.radius );\n\n\t\t}\n\n\t\tif ( json.name ) geometry.name = json.name;\n\t\tif ( json.userData ) geometry.userData = json.userData;\n\n\t\treturn geometry;\n\n\t}\n\n}\n\nclass ObjectLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tlet json = null;\n\n\t\t\ttry {\n\n\t\t\t\tjson = JSON.parse( text );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( error );\n\n\t\t\t\tconsole.error( 'THREE:ObjectLoader: Can\\'t parse ' + url + '.', error.message );\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst metadata = json.metadata;\n\n\t\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( new Error( 'THREE.ObjectLoader: Can\\'t load ' + url ) );\n\n\t\t\t\tconsole.error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tscope.parse( json, onLoad );\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tasync loadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\n\t\tconst text = await loader.loadAsync( url, onProgress );\n\n\t\tconst json = JSON.parse( text );\n\n\t\tconst metadata = json.metadata;\n\n\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\tthrow new Error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\n\t\t}\n\n\t\treturn await scope.parseAsync( json );\n\n\t}\n\n\tparse( json, onLoad ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = this.parseImages( json.images, function () {\n\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\n\n\t\t} );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\n\t\t//\n\n\t\tif ( onLoad !== undefined ) {\n\n\t\t\tlet hasImages = false;\n\n\t\t\tfor ( const uuid in images ) {\n\n\t\t\t\tif ( images[ uuid ].data instanceof HTMLImageElement ) {\n\n\t\t\t\t\thasImages = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( hasImages === false ) onLoad( object );\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tasync parseAsync( json ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = await this.parseImagesAsync( json.images );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\n\t\treturn object;\n\n\t}\n\n\tparseShapes( json ) {\n\n\t\tconst shapes = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst shape = new Shape().fromJSON( json[ i ] );\n\n\t\t\t\tshapes[ shape.uuid ] = shape;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn shapes;\n\n\t}\n\n\tparseSkeletons( json, object ) {\n\n\t\tconst skeletons = {};\n\t\tconst bones = {};\n\n\t\t// generate bone lookup table\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isBone ) bones[ child.uuid ] = child;\n\n\t\t} );\n\n\t\t// create skeletons\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst skeleton = new Skeleton().fromJSON( json[ i ], bones );\n\n\t\t\t\tskeletons[ skeleton.uuid ] = skeleton;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn skeletons;\n\n\t}\n\n\tparseGeometries( json, shapes ) {\n\n\t\tconst geometries = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst bufferGeometryLoader = new BufferGeometryLoader();\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tlet geometry;\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tswitch ( data.type ) {\n\n\t\t\t\t\tcase 'BufferGeometry':\n\t\t\t\t\tcase 'InstancedBufferGeometry':\n\n\t\t\t\t\t\tgeometry = bufferGeometryLoader.parse( data );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( data.type in Geometries ) {\n\n\t\t\t\t\t\t\tgeometry = Geometries[ data.type ].fromJSON( data, shapes );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tconsole.warn( `THREE.ObjectLoader: Unsupported geometry type \"${ data.type }\"` );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) geometry.name = data.name;\n\t\t\t\tif ( data.userData !== undefined ) geometry.userData = data.userData;\n\n\t\t\t\tgeometries[ data.uuid ] = geometry;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn geometries;\n\n\t}\n\n\tparseMaterials( json, textures ) {\n\n\t\tconst cache = {}; // MultiMaterial\n\t\tconst materials = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst loader = new MaterialLoader();\n\t\t\tloader.setTextures( textures );\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( cache[ data.uuid ] === undefined ) {\n\n\t\t\t\t\tcache[ data.uuid ] = loader.parse( data );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials[ data.uuid ] = cache[ data.uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn materials;\n\n\t}\n\n\tparseAnimations( json ) {\n\n\t\tconst animations = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tconst clip = AnimationClip.parse( data );\n\n\t\t\t\tanimations[ clip.uuid ] = clip;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n\tparseImages( json, onLoad ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tfunction loadImage( url ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\treturn loader.load( url, function () {\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, undefined, function () {\n\n\t\t\t\tscope.manager.itemError( url );\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\t}\n\n\t\tfunction deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn loadImage( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tconst manager = new LoadingManager( onLoad );\n\n\t\t\tloader = new ImageLoader( manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tasync parseImagesAsync( json ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tasync function deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn await loader.loadAsync( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tloader = new ImageLoader( this.manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = await deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = await deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tparseTextures( json, images ) {\n\n\t\tfunction parseConstant( value, type ) {\n\n\t\t\tif ( typeof value === 'number' ) return value;\n\n\t\t\tconsole.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value );\n\n\t\t\treturn type[ value ];\n\n\t\t}\n\n\t\tconst textures = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( data.image === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No \"image\" specified for', data.uuid );\n\n\t\t\t\t}\n\n\t\t\t\tif ( images[ data.image ] === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined image', data.image );\n\n\t\t\t\t}\n\n\t\t\t\tconst source = images[ data.image ];\n\t\t\t\tconst image = source.data;\n\n\t\t\t\tlet texture;\n\n\t\t\t\tif ( Array.isArray( image ) ) {\n\n\t\t\t\t\ttexture = new CubeTexture();\n\n\t\t\t\t\tif ( image.length === 6 ) texture.needsUpdate = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( image && image.data ) {\n\n\t\t\t\t\t\ttexture = new DataTexture();\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttexture = new Texture();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( image ) texture.needsUpdate = true; // textures can have undefined image data\n\n\t\t\t\t}\n\n\t\t\t\ttexture.source = source;\n\n\t\t\t\ttexture.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) texture.name = data.name;\n\n\t\t\t\tif ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING );\n\t\t\t\tif ( data.channel !== undefined ) texture.channel = data.channel;\n\n\t\t\t\tif ( data.offset !== undefined ) texture.offset.fromArray( data.offset );\n\t\t\t\tif ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );\n\t\t\t\tif ( data.center !== undefined ) texture.center.fromArray( data.center );\n\t\t\t\tif ( data.rotation !== undefined ) texture.rotation = data.rotation;\n\n\t\t\t\tif ( data.wrap !== undefined ) {\n\n\t\t\t\t\ttexture.wrapS = parseConstant( data.wrap[ 0 ], TEXTURE_WRAPPING );\n\t\t\t\t\ttexture.wrapT = parseConstant( data.wrap[ 1 ], TEXTURE_WRAPPING );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.format !== undefined ) texture.format = data.format;\n\t\t\t\tif ( data.internalFormat !== undefined ) texture.internalFormat = data.internalFormat;\n\t\t\t\tif ( data.type !== undefined ) texture.type = data.type;\n\t\t\t\tif ( data.colorSpace !== undefined ) texture.colorSpace = data.colorSpace;\n\n\t\t\t\tif ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;\n\n\t\t\t\tif ( data.flipY !== undefined ) texture.flipY = data.flipY;\n\n\t\t\t\tif ( data.generateMipmaps !== undefined ) texture.generateMipmaps = data.generateMipmaps;\n\t\t\t\tif ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;\n\t\t\t\tif ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;\n\t\t\t\tif ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;\n\n\t\t\t\tif ( data.userData !== undefined ) texture.userData = data.userData;\n\n\t\t\t\ttextures[ data.uuid ] = texture;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn textures;\n\n\t}\n\n\tparseObject( data, geometries, materials, textures, animations ) {\n\n\t\tlet object;\n\n\t\tfunction getGeometry( name ) {\n\n\t\t\tif ( geometries[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined geometry', name );\n\n\t\t\t}\n\n\t\t\treturn geometries[ name ];\n\n\t\t}\n\n\t\tfunction getMaterial( name ) {\n\n\t\t\tif ( name === undefined ) return undefined;\n\n\t\t\tif ( Array.isArray( name ) ) {\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, l = name.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst uuid = name[ i ];\n\n\t\t\t\t\tif ( materials[ uuid ] === undefined ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', uuid );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tarray.push( materials[ uuid ] );\n\n\t\t\t\t}\n\n\t\t\t\treturn array;\n\n\t\t\t}\n\n\t\t\tif ( materials[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', name );\n\n\t\t\t}\n\n\t\t\treturn materials[ name ];\n\n\t\t}\n\n\t\tfunction getTexture( uuid ) {\n\n\t\t\tif ( textures[ uuid ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined texture', uuid );\n\n\t\t\t}\n\n\t\t\treturn textures[ uuid ];\n\n\t\t}\n\n\t\tlet geometry, material;\n\n\t\tswitch ( data.type ) {\n\n\t\t\tcase 'Scene':\n\n\t\t\t\tobject = new Scene();\n\n\t\t\t\tif ( data.background !== undefined ) {\n\n\t\t\t\t\tif ( Number.isInteger( data.background ) ) {\n\n\t\t\t\t\t\tobject.background = new Color( data.background );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tobject.background = getTexture( data.background );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.environment !== undefined ) {\n\n\t\t\t\t\tobject.environment = getTexture( data.environment );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.fog !== undefined ) {\n\n\t\t\t\t\tif ( data.fog.type === 'Fog' ) {\n\n\t\t\t\t\t\tobject.fog = new Fog( data.fog.color, data.fog.near, data.fog.far );\n\n\t\t\t\t\t} else if ( data.fog.type === 'FogExp2' ) {\n\n\t\t\t\t\t\tobject.fog = new FogExp2( data.fog.color, data.fog.density );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( data.fog.name !== '' ) {\n\n\t\t\t\t\t\tobject.fog.name = data.fog.name;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;\n\t\t\t\tif ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;\n\t\t\t\tif ( data.backgroundRotation !== undefined ) object.backgroundRotation.fromArray( data.backgroundRotation );\n\n\t\t\t\tif ( data.environmentIntensity !== undefined ) object.environmentIntensity = data.environmentIntensity;\n\t\t\t\tif ( data.environmentRotation !== undefined ) object.environmentRotation.fromArray( data.environmentRotation );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PerspectiveCamera':\n\n\t\t\t\tobject = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far );\n\n\t\t\t\tif ( data.focus !== undefined ) object.focus = data.focus;\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge;\n\t\t\t\tif ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'OrthographicCamera':\n\n\t\t\t\tobject = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );\n\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'AmbientLight':\n\n\t\t\t\tobject = new AmbientLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'DirectionalLight':\n\n\t\t\t\tobject = new DirectionalLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointLight':\n\n\t\t\t\tobject = new PointLight( data.color, data.intensity, data.distance, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'RectAreaLight':\n\n\t\t\t\tobject = new RectAreaLight( data.color, data.intensity, data.width, data.height );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SpotLight':\n\n\t\t\t\tobject = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'HemisphereLight':\n\n\t\t\t\tobject = new HemisphereLight( data.color, data.groundColor, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LightProbe':\n\n\t\t\t\tobject = new LightProbe().fromJSON( data );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SkinnedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t \tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new SkinnedMesh( geometry, material );\n\n\t\t\t\tif ( data.bindMode !== undefined ) object.bindMode = data.bindMode;\n\t\t\t\tif ( data.bindMatrix !== undefined ) object.bindMatrix.fromArray( data.bindMatrix );\n\t\t\t\tif ( data.skeleton !== undefined ) object.skeleton = data.skeleton;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Mesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new Mesh( geometry, material );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'InstancedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\t\t\t\tconst count = data.count;\n\t\t\t\tconst instanceMatrix = data.instanceMatrix;\n\t\t\t\tconst instanceColor = data.instanceColor;\n\n\t\t\t\tobject = new InstancedMesh( geometry, material, count );\n\t\t\t\tobject.instanceMatrix = new InstancedBufferAttribute( new Float32Array( instanceMatrix.array ), 16 );\n\t\t\t\tif ( instanceColor !== undefined ) object.instanceColor = new InstancedBufferAttribute( new Float32Array( instanceColor.array ), instanceColor.itemSize );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'BatchedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new BatchedMesh( data.maxGeometryCount, data.maxVertexCount, data.maxIndexCount, material );\n\t\t\t\tobject.geometry = geometry;\n\t\t\t\tobject.perObjectFrustumCulled = data.perObjectFrustumCulled;\n\t\t\t\tobject.sortObjects = data.sortObjects;\n\n\t\t\t\tobject._drawRanges = data.drawRanges;\n\t\t\t\tobject._reservedRanges = data.reservedRanges;\n\n\t\t\t\tobject._visibility = data.visibility;\n\t\t\t\tobject._active = data.active;\n\t\t\t\tobject._bounds = data.bounds.map( bound => {\n\n\t\t\t\t\tconst box = new Box3();\n\t\t\t\t\tbox.min.fromArray( bound.boxMin );\n\t\t\t\t\tbox.max.fromArray( bound.boxMax );\n\n\t\t\t\t\tconst sphere = new Sphere();\n\t\t\t\t\tsphere.radius = bound.sphereRadius;\n\t\t\t\t\tsphere.center.fromArray( bound.sphereCenter );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\t\t\t\tbox: box,\n\n\t\t\t\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\t\t\t\tsphere: sphere\n\t\t\t\t\t};\n\n\t\t\t\t} );\n\n\t\t\t\tobject._maxGeometryCount = data.maxGeometryCount;\n\t\t\t\tobject._maxVertexCount = data.maxVertexCount;\n\t\t\t\tobject._maxIndexCount = data.maxIndexCount;\n\n\t\t\t\tobject._geometryInitialized = data.geometryInitialized;\n\t\t\t\tobject._geometryCount = data.geometryCount;\n\n\t\t\t\tobject._matricesTexture = getTexture( data.matricesTexture.uuid );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LOD':\n\n\t\t\t\tobject = new LOD();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Line':\n\n\t\t\t\tobject = new Line( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineLoop':\n\n\t\t\t\tobject = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineSegments':\n\n\t\t\t\tobject = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointCloud':\n\t\t\tcase 'Points':\n\n\t\t\t\tobject = new Points( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Sprite':\n\n\t\t\t\tobject = new Sprite( getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Group':\n\n\t\t\t\tobject = new Group();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Bone':\n\n\t\t\t\tobject = new Bone();\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tobject = new Object3D();\n\n\t\t}\n\n\t\tobject.uuid = data.uuid;\n\n\t\tif ( data.name !== undefined ) object.name = data.name;\n\n\t\tif ( data.matrix !== undefined ) {\n\n\t\t\tobject.matrix.fromArray( data.matrix );\n\n\t\t\tif ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate;\n\t\t\tif ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale );\n\n\t\t} else {\n\n\t\t\tif ( data.position !== undefined ) object.position.fromArray( data.position );\n\t\t\tif ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );\n\t\t\tif ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion );\n\t\t\tif ( data.scale !== undefined ) object.scale.fromArray( data.scale );\n\n\t\t}\n\n\t\tif ( data.up !== undefined ) object.up.fromArray( data.up );\n\n\t\tif ( data.castShadow !== undefined ) object.castShadow = data.castShadow;\n\t\tif ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;\n\n\t\tif ( data.shadow ) {\n\n\t\t\tif ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;\n\t\t\tif ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;\n\t\t\tif ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;\n\t\t\tif ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );\n\t\t\tif ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );\n\n\t\t}\n\n\t\tif ( data.visible !== undefined ) object.visible = data.visible;\n\t\tif ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled;\n\t\tif ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder;\n\t\tif ( data.userData !== undefined ) object.userData = data.userData;\n\t\tif ( data.layers !== undefined ) object.layers.mask = data.layers;\n\n\t\tif ( data.children !== undefined ) {\n\n\t\t\tconst children = data.children;\n\n\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\tobject.add( this.parseObject( children[ i ], geometries, materials, textures, animations ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.animations !== undefined ) {\n\n\t\t\tconst objectAnimations = data.animations;\n\n\t\t\tfor ( let i = 0; i < objectAnimations.length; i ++ ) {\n\n\t\t\t\tconst uuid = objectAnimations[ i ];\n\n\t\t\t\tobject.animations.push( animations[ uuid ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.type === 'LOD' ) {\n\n\t\t\tif ( data.autoUpdate !== undefined ) object.autoUpdate = data.autoUpdate;\n\n\t\t\tconst levels = data.levels;\n\n\t\t\tfor ( let l = 0; l < levels.length; l ++ ) {\n\n\t\t\t\tconst level = levels[ l ];\n\t\t\t\tconst child = object.getObjectByProperty( 'uuid', level.object );\n\n\t\t\t\tif ( child !== undefined ) {\n\n\t\t\t\t\tobject.addLevel( child, level.distance, level.hysteresis );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tbindSkeletons( object, skeletons ) {\n\n\t\tif ( Object.keys( skeletons ).length === 0 ) return;\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isSkinnedMesh === true && child.skeleton !== undefined ) {\n\n\t\t\t\tconst skeleton = skeletons[ child.skeleton ];\n\n\t\t\t\tif ( skeleton === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tchild.bind( skeleton, child.bindMatrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n}\n\nconst TEXTURE_MAPPING = {\n\tUVMapping: UVMapping,\n\tCubeReflectionMapping: CubeReflectionMapping,\n\tCubeRefractionMapping: CubeRefractionMapping,\n\tEquirectangularReflectionMapping: EquirectangularReflectionMapping,\n\tEquirectangularRefractionMapping: EquirectangularRefractionMapping,\n\tCubeUVReflectionMapping: CubeUVReflectionMapping\n};\n\nconst TEXTURE_WRAPPING = {\n\tRepeatWrapping: RepeatWrapping,\n\tClampToEdgeWrapping: ClampToEdgeWrapping,\n\tMirroredRepeatWrapping: MirroredRepeatWrapping\n};\n\nconst TEXTURE_FILTER = {\n\tNearestFilter: NearestFilter,\n\tNearestMipmapNearestFilter: NearestMipmapNearestFilter,\n\tNearestMipmapLinearFilter: NearestMipmapLinearFilter,\n\tLinearFilter: LinearFilter,\n\tLinearMipmapNearestFilter: LinearMipmapNearestFilter,\n\tLinearMipmapLinearFilter: LinearMipmapLinearFilter\n};\n\nclass ImageBitmapLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tthis.isImageBitmapLoader = true;\n\n\t\tif ( typeof createImageBitmap === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' );\n\n\t\t}\n\n\t\tif ( typeof fetch === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' );\n\n\t\t}\n\n\t\tthis.options = { premultiplyAlpha: 'none' };\n\n\t}\n\n\tsetOptions( options ) {\n\n\t\tthis.options = options;\n\n\t\treturn this;\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\t// If cached is a promise, wait for it to resolve\n\t\t\tif ( cached.then ) {\n\n\t\t\t\tcached.then( imageBitmap => {\n\n\t\t\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t} ).catch( e => {\n\n\t\t\t\t\tif ( onError ) onError( e );\n\n\t\t\t\t} );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t// If cached is not a promise (i.e., it's already an imageBitmap)\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst fetchOptions = {};\n\t\tfetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';\n\t\tfetchOptions.headers = this.requestHeader;\n\n\t\tconst promise = fetch( url, fetchOptions ).then( function ( res ) {\n\n\t\t\treturn res.blob();\n\n\t\t} ).then( function ( blob ) {\n\n\t\t\treturn createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) );\n\n\t\t} ).then( function ( imageBitmap ) {\n\n\t\t\tCache.add( url, imageBitmap );\n\n\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t\treturn imageBitmap;\n\n\t\t} ).catch( function ( e ) {\n\n\t\t\tif ( onError ) onError( e );\n\n\t\t\tCache.remove( url );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} );\n\n\t\tCache.add( url, promise );\n\t\tscope.manager.itemStart( url );\n\n\t}\n\n}\n\nlet _context;\n\nclass AudioContext {\n\n\tstatic getContext() {\n\n\t\tif ( _context === undefined ) {\n\n\t\t\t_context = new ( window.AudioContext || window.webkitAudioContext )();\n\n\t\t}\n\n\t\treturn _context;\n\n\t}\n\n\tstatic setContext( value ) {\n\n\t\t_context = value;\n\n\t}\n\n}\n\nclass AudioLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\ttry {\n\n\t\t\t\t// Create a copy of the buffer. The `decodeAudioData` method\n\t\t\t\t// detaches the buffer when complete, preventing reuse.\n\t\t\t\tconst bufferCopy = buffer.slice( 0 );\n\n\t\t\t\tconst context = AudioContext.getContext();\n\t\t\t\tcontext.decodeAudioData( bufferCopy, function ( audioBuffer ) {\n\n\t\t\t\t\tonLoad( audioBuffer );\n\n\t\t\t\t} ).catch( handleError );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\thandleError( e );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\tfunction handleError( e ) {\n\n\t\t\tif ( onError ) {\n\n\t\t\t\tonError( e );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( e );\n\n\t\t\t}\n\n\t\t\tscope.manager.itemError( url );\n\n\t\t}\n\n\t}\n\n}\n\nconst _eyeRight = /*@__PURE__*/ new Matrix4();\nconst _eyeLeft = /*@__PURE__*/ new Matrix4();\nconst _projectionMatrix = /*@__PURE__*/ new Matrix4();\n\nclass StereoCamera {\n\n\tconstructor() {\n\n\t\tthis.type = 'StereoCamera';\n\n\t\tthis.aspect = 1;\n\n\t\tthis.eyeSep = 0.064;\n\n\t\tthis.cameraL = new PerspectiveCamera();\n\t\tthis.cameraL.layers.enable( 1 );\n\t\tthis.cameraL.matrixAutoUpdate = false;\n\n\t\tthis.cameraR = new PerspectiveCamera();\n\t\tthis.cameraR.layers.enable( 2 );\n\t\tthis.cameraR.matrixAutoUpdate = false;\n\n\t\tthis._cache = {\n\t\t\tfocus: null,\n\t\t\tfov: null,\n\t\t\taspect: null,\n\t\t\tnear: null,\n\t\t\tfar: null,\n\t\t\tzoom: null,\n\t\t\teyeSep: null\n\t\t};\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst cache = this._cache;\n\n\t\tconst needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov ||\n\t\t\tcache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near ||\n\t\t\tcache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tcache.focus = camera.focus;\n\t\t\tcache.fov = camera.fov;\n\t\t\tcache.aspect = camera.aspect * this.aspect;\n\t\t\tcache.near = camera.near;\n\t\t\tcache.far = camera.far;\n\t\t\tcache.zoom = camera.zoom;\n\t\t\tcache.eyeSep = this.eyeSep;\n\n\t\t\t// Off-axis stereoscopic effect based on\n\t\t\t// http://paulbourke.net/stereographics/stereorender/\n\n\t\t\t_projectionMatrix.copy( camera.projectionMatrix );\n\t\t\tconst eyeSepHalf = cache.eyeSep / 2;\n\t\t\tconst eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\n\t\t\tconst ymax = ( cache.near * Math.tan( DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;\n\t\t\tlet xmin, xmax;\n\n\t\t\t// translate xOffset\n\n\t\t\t_eyeLeft.elements[ 12 ] = - eyeSepHalf;\n\t\t\t_eyeRight.elements[ 12 ] = eyeSepHalf;\n\n\t\t\t// for left eye\n\n\t\t\txmin = - ymax * cache.aspect + eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect + eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraL.projectionMatrix.copy( _projectionMatrix );\n\n\t\t\t// for right eye\n\n\t\t\txmin = - ymax * cache.aspect - eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect - eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraR.projectionMatrix.copy( _projectionMatrix );\n\n\t\t}\n\n\t\tthis.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );\n\t\tthis.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );\n\n\t}\n\n}\n\nclass Clock {\n\n\tconstructor( autoStart = true ) {\n\n\t\tthis.autoStart = autoStart;\n\n\t\tthis.startTime = 0;\n\t\tthis.oldTime = 0;\n\t\tthis.elapsedTime = 0;\n\n\t\tthis.running = false;\n\n\t}\n\n\tstart() {\n\n\t\tthis.startTime = now();\n\n\t\tthis.oldTime = this.startTime;\n\t\tthis.elapsedTime = 0;\n\t\tthis.running = true;\n\n\t}\n\n\tstop() {\n\n\t\tthis.getElapsedTime();\n\t\tthis.running = false;\n\t\tthis.autoStart = false;\n\n\t}\n\n\tgetElapsedTime() {\n\n\t\tthis.getDelta();\n\t\treturn this.elapsedTime;\n\n\t}\n\n\tgetDelta() {\n\n\t\tlet diff = 0;\n\n\t\tif ( this.autoStart && ! this.running ) {\n\n\t\t\tthis.start();\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tif ( this.running ) {\n\n\t\t\tconst newTime = now();\n\n\t\t\tdiff = ( newTime - this.oldTime ) / 1000;\n\t\t\tthis.oldTime = newTime;\n\n\t\t\tthis.elapsedTime += diff;\n\n\t\t}\n\n\t\treturn diff;\n\n\t}\n\n}\n\nfunction now() {\n\n\treturn ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732\n\n}\n\nconst _position$1 = /*@__PURE__*/ new Vector3();\nconst _quaternion$1 = /*@__PURE__*/ new Quaternion();\nconst _scale$1 = /*@__PURE__*/ new Vector3();\nconst _orientation$1 = /*@__PURE__*/ new Vector3();\n\nclass AudioListener extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'AudioListener';\n\n\t\tthis.context = AudioContext.getContext();\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( this.context.destination );\n\n\t\tthis.filter = null;\n\n\t\tthis.timeDelta = 0;\n\n\t\t// private\n\n\t\tthis._clock = new Clock();\n\n\t}\n\n\tgetInput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tremoveFilter() {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\t\t\tthis.gain.connect( this.context.destination );\n\t\t\tthis.filter = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.filter;\n\n\t}\n\n\tsetFilter( value ) {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\n\t\t} else {\n\n\t\t\tthis.gain.disconnect( this.context.destination );\n\n\t\t}\n\n\t\tthis.filter = value;\n\t\tthis.gain.connect( this.filter );\n\t\tthis.filter.connect( this.context.destination );\n\n\t\treturn this;\n\n\t}\n\n\tgetMasterVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetMasterVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tconst listener = this.context.listener;\n\t\tconst up = this.up;\n\n\t\tthis.timeDelta = this._clock.getDelta();\n\n\t\tthis.matrixWorld.decompose( _position$1, _quaternion$1, _scale$1 );\n\n\t\t_orientation$1.set( 0, 0, - 1 ).applyQuaternion( _quaternion$1 );\n\n\t\tif ( listener.positionX ) {\n\n\t\t\t// code path for Chrome (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.timeDelta;\n\n\t\t\tlistener.positionX.linearRampToValueAtTime( _position$1.x, endTime );\n\t\t\tlistener.positionY.linearRampToValueAtTime( _position$1.y, endTime );\n\t\t\tlistener.positionZ.linearRampToValueAtTime( _position$1.z, endTime );\n\t\t\tlistener.forwardX.linearRampToValueAtTime( _orientation$1.x, endTime );\n\t\t\tlistener.forwardY.linearRampToValueAtTime( _orientation$1.y, endTime );\n\t\t\tlistener.forwardZ.linearRampToValueAtTime( _orientation$1.z, endTime );\n\t\t\tlistener.upX.linearRampToValueAtTime( up.x, endTime );\n\t\t\tlistener.upY.linearRampToValueAtTime( up.y, endTime );\n\t\t\tlistener.upZ.linearRampToValueAtTime( up.z, endTime );\n\n\t\t} else {\n\n\t\t\tlistener.setPosition( _position$1.x, _position$1.y, _position$1.z );\n\t\t\tlistener.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass Audio extends Object3D {\n\n\tconstructor( listener ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Audio';\n\n\t\tthis.listener = listener;\n\t\tthis.context = listener.context;\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( listener.getInput() );\n\n\t\tthis.autoplay = false;\n\n\t\tthis.buffer = null;\n\t\tthis.detune = 0;\n\t\tthis.loop = false;\n\t\tthis.loopStart = 0;\n\t\tthis.loopEnd = 0;\n\t\tthis.offset = 0;\n\t\tthis.duration = undefined;\n\t\tthis.playbackRate = 1;\n\t\tthis.isPlaying = false;\n\t\tthis.hasPlaybackControl = true;\n\t\tthis.source = null;\n\t\tthis.sourceType = 'empty';\n\n\t\tthis._startedAt = 0;\n\t\tthis._progress = 0;\n\t\tthis._connected = false;\n\n\t\tthis.filters = [];\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tsetNodeSource( audioNode ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'audioNode';\n\t\tthis.source = audioNode;\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaElementSource( mediaElement ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaNode';\n\t\tthis.source = this.context.createMediaElementSource( mediaElement );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaStreamSource( mediaStream ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaStreamNode';\n\t\tthis.source = this.context.createMediaStreamSource( mediaStream );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetBuffer( audioBuffer ) {\n\n\t\tthis.buffer = audioBuffer;\n\t\tthis.sourceType = 'buffer';\n\n\t\tif ( this.autoplay ) this.play();\n\n\t\treturn this;\n\n\t}\n\n\tplay( delay = 0 ) {\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: Audio is already playing.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._startedAt = this.context.currentTime + delay;\n\n\t\tconst source = this.context.createBufferSource();\n\t\tsource.buffer = this.buffer;\n\t\tsource.loop = this.loop;\n\t\tsource.loopStart = this.loopStart;\n\t\tsource.loopEnd = this.loopEnd;\n\t\tsource.onended = this.onEnded.bind( this );\n\t\tsource.start( this._startedAt, this._progress + this.offset, this.duration );\n\n\t\tthis.isPlaying = true;\n\n\t\tthis.source = source;\n\n\t\tthis.setDetune( this.detune );\n\t\tthis.setPlaybackRate( this.playbackRate );\n\n\t\treturn this.connect();\n\n\t}\n\n\tpause() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\t// update current progress\n\n\t\t\tthis._progress += Math.max( this.context.currentTime - this._startedAt, 0 ) * this.playbackRate;\n\n\t\t\tif ( this.loop === true ) {\n\n\t\t\t\t// ensure _progress does not exceed duration with looped audios\n\n\t\t\t\tthis._progress = this._progress % ( this.duration || this.buffer.duration );\n\n\t\t\t}\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t\tthis.isPlaying = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._progress = 0;\n\n\t\tif ( this.source !== null ) {\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t}\n\n\t\tthis.isPlaying = false;\n\n\t\treturn this;\n\n\t}\n\n\tconnect() {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.connect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].connect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].connect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.connect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = true;\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect() {\n\n\t\tif ( this._connected === false ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.disconnect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].disconnect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].disconnect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.disconnect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = false;\n\n\t\treturn this;\n\n\t}\n\n\tgetFilters() {\n\n\t\treturn this.filters;\n\n\t}\n\n\tsetFilters( value ) {\n\n\t\tif ( ! value ) value = [];\n\n\t\tif ( this._connected === true ) {\n\n\t\t\tthis.disconnect();\n\t\t\tthis.filters = value.slice();\n\t\t\tthis.connect();\n\n\t\t} else {\n\n\t\t\tthis.filters = value.slice();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetDetune( value ) {\n\n\t\tthis.detune = value;\n\n\t\tif ( this.isPlaying === true && this.source.detune !== undefined ) {\n\n\t\t\tthis.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetDetune() {\n\n\t\treturn this.detune;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.getFilters()[ 0 ];\n\n\t}\n\n\tsetFilter( filter ) {\n\n\t\treturn this.setFilters( filter ? [ filter ] : [] );\n\n\t}\n\n\tsetPlaybackRate( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.playbackRate = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetPlaybackRate() {\n\n\t\treturn this.playbackRate;\n\n\t}\n\n\tonEnded() {\n\n\t\tthis.isPlaying = false;\n\n\t}\n\n\tgetLoop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn this.loop;\n\n\t}\n\n\tsetLoop( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.loop = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.loop = this.loop;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopStart( value ) {\n\n\t\tthis.loopStart = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopEnd( value ) {\n\n\t\tthis.loopEnd = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _position = /*@__PURE__*/ new Vector3();\nconst _quaternion = /*@__PURE__*/ new Quaternion();\nconst _scale = /*@__PURE__*/ new Vector3();\nconst _orientation = /*@__PURE__*/ new Vector3();\n\nclass PositionalAudio extends Audio {\n\n\tconstructor( listener ) {\n\n\t\tsuper( listener );\n\n\t\tthis.panner = this.context.createPanner();\n\t\tthis.panner.panningModel = 'HRTF';\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tconnect() {\n\n\t\tsuper.connect();\n\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tdisconnect() {\n\n\t\tsuper.disconnect();\n\n\t\tthis.panner.disconnect( this.gain );\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.panner;\n\n\t}\n\n\tgetRefDistance() {\n\n\t\treturn this.panner.refDistance;\n\n\t}\n\n\tsetRefDistance( value ) {\n\n\t\tthis.panner.refDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetRolloffFactor() {\n\n\t\treturn this.panner.rolloffFactor;\n\n\t}\n\n\tsetRolloffFactor( value ) {\n\n\t\tthis.panner.rolloffFactor = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetDistanceModel() {\n\n\t\treturn this.panner.distanceModel;\n\n\t}\n\n\tsetDistanceModel( value ) {\n\n\t\tthis.panner.distanceModel = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxDistance() {\n\n\t\treturn this.panner.maxDistance;\n\n\t}\n\n\tsetMaxDistance( value ) {\n\n\t\tthis.panner.maxDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetDirectionalCone( coneInnerAngle, coneOuterAngle, coneOuterGain ) {\n\n\t\tthis.panner.coneInnerAngle = coneInnerAngle;\n\t\tthis.panner.coneOuterAngle = coneOuterAngle;\n\t\tthis.panner.coneOuterGain = coneOuterGain;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.hasPlaybackControl === true && this.isPlaying === false ) return;\n\n\t\tthis.matrixWorld.decompose( _position, _quaternion, _scale );\n\n\t\t_orientation.set( 0, 0, 1 ).applyQuaternion( _quaternion );\n\n\t\tconst panner = this.panner;\n\n\t\tif ( panner.positionX ) {\n\n\t\t\t// code path for Chrome and Firefox (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.listener.timeDelta;\n\n\t\t\tpanner.positionX.linearRampToValueAtTime( _position.x, endTime );\n\t\t\tpanner.positionY.linearRampToValueAtTime( _position.y, endTime );\n\t\t\tpanner.positionZ.linearRampToValueAtTime( _position.z, endTime );\n\t\t\tpanner.orientationX.linearRampToValueAtTime( _orientation.x, endTime );\n\t\t\tpanner.orientationY.linearRampToValueAtTime( _orientation.y, endTime );\n\t\t\tpanner.orientationZ.linearRampToValueAtTime( _orientation.z, endTime );\n\n\t\t} else {\n\n\t\t\tpanner.setPosition( _position.x, _position.y, _position.z );\n\t\t\tpanner.setOrientation( _orientation.x, _orientation.y, _orientation.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass AudioAnalyser {\n\n\tconstructor( audio, fftSize = 2048 ) {\n\n\t\tthis.analyser = audio.context.createAnalyser();\n\t\tthis.analyser.fftSize = fftSize;\n\n\t\tthis.data = new Uint8Array( this.analyser.frequencyBinCount );\n\n\t\taudio.getOutput().connect( this.analyser );\n\n\t}\n\n\n\tgetFrequencyData() {\n\n\t\tthis.analyser.getByteFrequencyData( this.data );\n\n\t\treturn this.data;\n\n\t}\n\n\tgetAverageFrequency() {\n\n\t\tlet value = 0;\n\t\tconst data = this.getFrequencyData();\n\n\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\tvalue += data[ i ];\n\n\t\t}\n\n\t\treturn value / data.length;\n\n\t}\n\n}\n\nclass PropertyMixer {\n\n\tconstructor( binding, typeName, valueSize ) {\n\n\t\tthis.binding = binding;\n\t\tthis.valueSize = valueSize;\n\n\t\tlet mixFunction,\n\t\t\tmixFunctionAdditive,\n\t\t\tsetIdentity;\n\n\t\t// buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]\n\t\t//\n\t\t// interpolators can use .buffer as their .result\n\t\t// the data then goes to 'incoming'\n\t\t//\n\t\t// 'accu0' and 'accu1' are used frame-interleaved for\n\t\t// the cumulative result and are compared to detect\n\t\t// changes\n\t\t//\n\t\t// 'orig' stores the original state of the property\n\t\t//\n\t\t// 'add' is used for additive cumulative results\n\t\t//\n\t\t// 'work' is optional and is only present for quaternion types. It is used\n\t\t// to store intermediate quaternion multiplication results\n\n\t\tswitch ( typeName ) {\n\n\t\t\tcase 'quaternion':\n\t\t\t\tmixFunction = this._slerp;\n\t\t\t\tmixFunctionAdditive = this._slerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityQuaternion;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 6 );\n\t\t\t\tthis._workIndex = 5;\n\t\t\t\tbreak;\n\n\t\t\tcase 'string':\n\t\t\tcase 'bool':\n\t\t\t\tmixFunction = this._select;\n\n\t\t\t\t// Use the regular mix function and for additive on these types,\n\t\t\t\t// additive is not relevant for non-numeric types\n\t\t\t\tmixFunctionAdditive = this._select;\n\n\t\t\t\tsetIdentity = this._setAdditiveIdentityOther;\n\n\t\t\t\tthis.buffer = new Array( valueSize * 5 );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tmixFunction = this._lerp;\n\t\t\t\tmixFunctionAdditive = this._lerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityNumeric;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 5 );\n\n\t\t}\n\n\t\tthis._mixBufferRegion = mixFunction;\n\t\tthis._mixBufferRegionAdditive = mixFunctionAdditive;\n\t\tthis._setIdentity = setIdentity;\n\t\tthis._origIndex = 3;\n\t\tthis._addIndex = 4;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tthis.useCount = 0;\n\t\tthis.referenceCount = 0;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'accu'\n\taccumulate( accuIndex, weight ) {\n\n\t\t// note: happily accumulating nothing when weight = 0, the caller knows\n\t\t// the weight and shouldn't have made the call in the first place\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = accuIndex * stride + stride;\n\n\t\tlet currentWeight = this.cumulativeWeight;\n\n\t\tif ( currentWeight === 0 ) {\n\n\t\t\t// accuN := incoming * weight\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ offset + i ] = buffer[ i ];\n\n\t\t\t}\n\n\t\t\tcurrentWeight = weight;\n\n\t\t} else {\n\n\t\t\t// accuN := accuN + incoming * weight\n\n\t\t\tcurrentWeight += weight;\n\t\t\tconst mix = weight / currentWeight;\n\t\t\tthis._mixBufferRegion( buffer, offset, 0, mix, stride );\n\n\t\t}\n\n\t\tthis.cumulativeWeight = currentWeight;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'add'\n\taccumulateAdditive( weight ) {\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = stride * this._addIndex;\n\n\t\tif ( this.cumulativeWeightAdditive === 0 ) {\n\n\t\t\t// add = identity\n\n\t\t\tthis._setIdentity();\n\n\t\t}\n\n\t\t// add := add + incoming * weight\n\n\t\tthis._mixBufferRegionAdditive( buffer, offset, 0, weight, stride );\n\t\tthis.cumulativeWeightAdditive += weight;\n\n\t}\n\n\t// apply the state of 'accu' to the binding when accus differ\n\tapply( accuIndex ) {\n\n\t\tconst stride = this.valueSize,\n\t\t\tbuffer = this.buffer,\n\t\t\toffset = accuIndex * stride + stride,\n\n\t\t\tweight = this.cumulativeWeight,\n\t\t\tweightAdditive = this.cumulativeWeightAdditive,\n\n\t\t\tbinding = this.binding;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tif ( weight < 1 ) {\n\n\t\t\t// accuN := accuN + original * ( 1 - cumulativeWeight )\n\n\t\t\tconst originalValueOffset = stride * this._origIndex;\n\n\t\t\tthis._mixBufferRegion(\n\t\t\t\tbuffer, offset, originalValueOffset, 1 - weight, stride );\n\n\t\t}\n\n\t\tif ( weightAdditive > 0 ) {\n\n\t\t\t// accuN := accuN + additive accuN\n\n\t\t\tthis._mixBufferRegionAdditive( buffer, offset, this._addIndex * stride, 1, stride );\n\n\t\t}\n\n\t\tfor ( let i = stride, e = stride + stride; i !== e; ++ i ) {\n\n\t\t\tif ( buffer[ i ] !== buffer[ i + stride ] ) {\n\n\t\t\t\t// value has changed -> update scene graph\n\n\t\t\t\tbinding.setValue( buffer, offset );\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remember the state of the bound property and copy it to both accus\n\tsaveOriginalState() {\n\n\t\tconst binding = this.binding;\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\n\t\t\toriginalValueOffset = stride * this._origIndex;\n\n\t\tbinding.getValue( buffer, originalValueOffset );\n\n\t\t// accu[0..1] := orig -- initially detect changes against the original\n\t\tfor ( let i = stride, e = originalValueOffset; i !== e; ++ i ) {\n\n\t\t\tbuffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ];\n\n\t\t}\n\n\t\t// Add to identity for additive\n\t\tthis._setIdentity();\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t}\n\n\t// apply the state previously taken via 'saveOriginalState' to the binding\n\trestoreOriginalState() {\n\n\t\tconst originalValueOffset = this.valueSize * 3;\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\n\n\t}\n\n\t_setAdditiveIdentityNumeric() {\n\n\t\tconst startIndex = this._addIndex * this.valueSize;\n\t\tconst endIndex = startIndex + this.valueSize;\n\n\t\tfor ( let i = startIndex; i < endIndex; i ++ ) {\n\n\t\t\tthis.buffer[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\t_setAdditiveIdentityQuaternion() {\n\n\t\tthis._setAdditiveIdentityNumeric();\n\t\tthis.buffer[ this._addIndex * this.valueSize + 3 ] = 1;\n\n\t}\n\n\t_setAdditiveIdentityOther() {\n\n\t\tconst startIndex = this._origIndex * this.valueSize;\n\t\tconst targetIndex = this._addIndex * this.valueSize;\n\n\t\tfor ( let i = 0; i < this.valueSize; i ++ ) {\n\n\t\t\tthis.buffer[ targetIndex + i ] = this.buffer[ startIndex + i ];\n\n\t\t}\n\n\t}\n\n\n\t// mix functions\n\n\t_select( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tif ( t >= 0.5 ) {\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ dstOffset + i ] = buffer[ srcOffset + i ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_slerp( buffer, dstOffset, srcOffset, t ) {\n\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t );\n\n\t}\n\n\t_slerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst workOffset = this._workIndex * stride;\n\n\t\t// Store result in intermediate buffer offset\n\t\tQuaternion.multiplyQuaternionsFlat( buffer, workOffset, buffer, dstOffset, buffer, srcOffset );\n\n\t\t// Slerp to the intermediate result\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t );\n\n\t}\n\n\t_lerp( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst s = 1 - t;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n\t_lerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n}\n\n// Characters [].:/ are reserved for track binding syntax.\nconst _RESERVED_CHARS_RE = '\\\\[\\\\]\\\\.:\\\\/';\nconst _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );\n\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\n// only latin characters, and the unicode \\p{L} is not yet supported. So\n// instead, we exclude reserved characters and match everything else.\nconst _wordChar = '[^' + _RESERVED_CHARS_RE + ']';\nconst _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\\\.', '' ) + ']';\n\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\n// be matched to parse the rest of the track name.\nconst _directoryRe = /*@__PURE__*/ /((?:WC+[\\/:])*)/.source.replace( 'WC', _wordChar );\n\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\nconst _nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot );\n\n// Object on target node, and accessor. May not contain reserved\n// characters. Accessor may contain any character except closing bracket.\nconst _objectRe = /*@__PURE__*/ /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace( 'WC', _wordChar );\n\n// Property and accessor. May not contain reserved characters. Accessor may\n// contain any non-bracket characters.\nconst _propertyRe = /*@__PURE__*/ /\\.(WC+)(?:\\[(.+)\\])?/.source.replace( 'WC', _wordChar );\n\nconst _trackRe = new RegExp( ''\n\t+ '^'\n\t+ _directoryRe\n\t+ _nodeRe\n\t+ _objectRe\n\t+ _propertyRe\n\t+ '$'\n);\n\nconst _supportedObjectNames = [ 'material', 'materials', 'bones', 'map' ];\n\nclass Composite {\n\n\tconstructor( targetGroup, path, optionalParsedPath ) {\n\n\t\tconst parsedPath = optionalParsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis._targetGroup = targetGroup;\n\t\tthis._bindings = targetGroup.subscribe_( path, parsedPath );\n\n\t}\n\n\tgetValue( array, offset ) {\n\n\t\tthis.bind(); // bind all binding\n\n\t\tconst firstValidIndex = this._targetGroup.nCachedObjects_,\n\t\t\tbinding = this._bindings[ firstValidIndex ];\n\n\t\t// and only call .getValue on the first\n\t\tif ( binding !== undefined ) binding.getValue( array, offset );\n\n\t}\n\n\tsetValue( array, offset ) {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].setValue( array, offset );\n\n\t\t}\n\n\t}\n\n\tbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].bind();\n\n\t\t}\n\n\t}\n\n\tunbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].unbind();\n\n\t\t}\n\n\t}\n\n}\n\n// Note: This class uses a State pattern on a per-method basis:\n// 'bind' sets 'this.getValue' / 'setValue' and shadows the\n// prototype version of these methods with one that represents\n// the bound state. When the property is not found, the methods\n// become no-ops.\nclass PropertyBinding {\n\n\tconstructor( rootNode, path, parsedPath ) {\n\n\t\tthis.path = path;\n\t\tthis.parsedPath = parsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis.node = PropertyBinding.findNode( rootNode, this.parsedPath.nodeName );\n\n\t\tthis.rootNode = rootNode;\n\n\t\t// initial state of these methods that calls 'bind'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n\n\tstatic create( root, path, parsedPath ) {\n\n\t\tif ( ! ( root && root.isAnimationObjectGroup ) ) {\n\n\t\t\treturn new PropertyBinding( root, path, parsedPath );\n\n\t\t} else {\n\n\t\t\treturn new PropertyBinding.Composite( root, path, parsedPath );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Replaces spaces with underscores and removes unsupported characters from\n\t * node names, to ensure compatibility with parseTrackName().\n\t *\n\t * @param {string} name Node name to be sanitized.\n\t * @return {string}\n\t */\n\tstatic sanitizeNodeName( name ) {\n\n\t\treturn name.replace( /\\s/g, '_' ).replace( _reservedRe, '' );\n\n\t}\n\n\tstatic parseTrackName( trackName ) {\n\n\t\tconst matches = _trackRe.exec( trackName );\n\n\t\tif ( matches === null ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );\n\n\t\t}\n\n\t\tconst results = {\n\t\t\t// directoryName: matches[ 1 ], // (tschw) currently unused\n\t\t\tnodeName: matches[ 2 ],\n\t\t\tobjectName: matches[ 3 ],\n\t\t\tobjectIndex: matches[ 4 ],\n\t\t\tpropertyName: matches[ 5 ], // required\n\t\t\tpropertyIndex: matches[ 6 ]\n\t\t};\n\n\t\tconst lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );\n\n\t\tif ( lastDot !== undefined && lastDot !== - 1 ) {\n\n\t\t\tconst objectName = results.nodeName.substring( lastDot + 1 );\n\n\t\t\t// Object names must be checked against an allowlist. Otherwise, there\n\t\t\t// is no way to parse 'foo.bar.baz': 'baz' must be a property, but\n\t\t\t// 'bar' could be the objectName, or part of a nodeName (which can\n\t\t\t// include '.' characters).\n\t\t\tif ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) {\n\n\t\t\t\tresults.nodeName = results.nodeName.substring( 0, lastDot );\n\t\t\t\tresults.objectName = objectName;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( results.propertyName === null || results.propertyName.length === 0 ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );\n\n\t\t}\n\n\t\treturn results;\n\n\t}\n\n\tstatic findNode( root, nodeName ) {\n\n\t\tif ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {\n\n\t\t\treturn root;\n\n\t\t}\n\n\t\t// search into skeleton bones.\n\t\tif ( root.skeleton ) {\n\n\t\t\tconst bone = root.skeleton.getBoneByName( nodeName );\n\n\t\t\tif ( bone !== undefined ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// search into node subtree.\n\t\tif ( root.children ) {\n\n\t\t\tconst searchNodeSubtree = function ( children ) {\n\n\t\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\t\tconst childNode = children[ i ];\n\n\t\t\t\t\tif ( childNode.name === nodeName || childNode.uuid === nodeName ) {\n\n\t\t\t\t\t\treturn childNode;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = searchNodeSubtree( childNode.children );\n\n\t\t\t\t\tif ( result ) return result;\n\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\n\t\t\t};\n\n\t\t\tconst subTreeNode = searchNodeSubtree( root.children );\n\n\t\t\tif ( subTreeNode ) {\n\n\t\t\t\treturn subTreeNode;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// these are used to \"bind\" a nonexistent property\n\t_getValue_unavailable() {}\n\t_setValue_unavailable() {}\n\n\t// Getters\n\n\t_getValue_direct( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.targetObject[ this.propertyName ];\n\n\t}\n\n\t_getValue_array( buffer, offset ) {\n\n\t\tconst source = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = source.length; i !== n; ++ i ) {\n\n\t\t\tbuffer[ offset ++ ] = source[ i ];\n\n\t\t}\n\n\t}\n\n\t_getValue_arrayElement( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];\n\n\t}\n\n\t_getValue_toArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.toArray( buffer, offset );\n\n\t}\n\n\t// Direct\n\n\t_setValue_direct( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_direct_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// EntireArray\n\n\t_setValue_array( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t}\n\n\t_setValue_array_setNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// ArrayElement\n\n\t_setValue_arrayElement( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_arrayElement_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// HasToFromArray\n\n\t_setValue_fromArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\n\t}\n\n\t_setValue_fromArray_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t_getValue_unbound( targetArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.getValue( targetArray, offset );\n\n\t}\n\n\t_setValue_unbound( sourceArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.setValue( sourceArray, offset );\n\n\t}\n\n\t// create getter / setter pair for a property in the scene graph\n\tbind() {\n\n\t\tlet targetObject = this.node;\n\t\tconst parsedPath = this.parsedPath;\n\n\t\tconst objectName = parsedPath.objectName;\n\t\tconst propertyName = parsedPath.propertyName;\n\t\tlet propertyIndex = parsedPath.propertyIndex;\n\n\t\tif ( ! targetObject ) {\n\n\t\t\ttargetObject = PropertyBinding.findNode( this.rootNode, parsedPath.nodeName );\n\n\t\t\tthis.node = targetObject;\n\n\t\t}\n\n\t\t// set fail state so we can just 'return' on error\n\t\tthis.getValue = this._getValue_unavailable;\n\t\tthis.setValue = this._setValue_unavailable;\n\n\t\t// ensure there is a value node\n\t\tif ( ! targetObject ) {\n\n\t\t\tconsole.warn( 'THREE.PropertyBinding: No target node found for track: ' + this.path + '.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( objectName ) {\n\n\t\t\tlet objectIndex = parsedPath.objectIndex;\n\n\t\t\t// special cases were we need to reach deeper into the hierarchy to get the face materials....\n\t\t\tswitch ( objectName ) {\n\n\t\t\t\tcase 'materials':\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.materials ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.materials;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'bones':\n\n\t\t\t\t\tif ( ! targetObject.skeleton ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// potential future optimization: skip this if propertyIndex is already an integer\n\t\t\t\t\t// and convert the integer string to a true integer.\n\n\t\t\t\t\ttargetObject = targetObject.skeleton.bones;\n\n\t\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\t\tfor ( let i = 0; i < targetObject.length; i ++ ) {\n\n\t\t\t\t\t\tif ( targetObject[ i ].name === objectIndex ) {\n\n\t\t\t\t\t\t\tobjectIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'map':\n\n\t\t\t\t\tif ( 'map' in targetObject ) {\n\n\t\t\t\t\t\ttargetObject = targetObject.map;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.map ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.map;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tif ( targetObject[ objectName ] === undefined ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to objectName of node undefined.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject[ objectName ];\n\n\t\t\t}\n\n\n\t\t\tif ( objectIndex !== undefined ) {\n\n\t\t\t\tif ( targetObject[ objectIndex ] === undefined ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\ttargetObject = targetObject[ objectIndex ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// resolve property\n\t\tconst nodeProperty = targetObject[ propertyName ];\n\n\t\tif ( nodeProperty === undefined ) {\n\n\t\t\tconst nodeName = parsedPath.nodeName;\n\n\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to update property for track: ' + nodeName +\n\t\t\t\t'.' + propertyName + ' but it wasn\\'t found.', targetObject );\n\t\t\treturn;\n\n\t\t}\n\n\t\t// determine versioning scheme\n\t\tlet versioning = this.Versioning.None;\n\n\t\tthis.targetObject = targetObject;\n\n\t\tif ( targetObject.needsUpdate !== undefined ) { // material\n\n\t\t\tversioning = this.Versioning.NeedsUpdate;\n\n\t\t} else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform\n\n\t\t\tversioning = this.Versioning.MatrixWorldNeedsUpdate;\n\n\t\t}\n\n\t\t// determine how the property gets bound\n\t\tlet bindingType = this.BindingType.Direct;\n\n\t\tif ( propertyIndex !== undefined ) {\n\n\t\t\t// access a sub element of the property array (only primitives are supported right now)\n\n\t\t\tif ( propertyName === 'morphTargetInfluences' ) {\n\n\t\t\t\t// potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\n\n\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\tif ( ! targetObject.geometry ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! targetObject.geometry.morphAttributes ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( targetObject.morphTargetDictionary[ propertyIndex ] !== undefined ) {\n\n\t\t\t\t\tpropertyIndex = targetObject.morphTargetDictionary[ propertyIndex ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tbindingType = this.BindingType.ArrayElement;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\t\t\tthis.propertyIndex = propertyIndex;\n\n\t\t} else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) {\n\n\t\t\t// must use copy for Object3D.Euler/Quaternion\n\n\t\t\tbindingType = this.BindingType.HasFromToArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else if ( Array.isArray( nodeProperty ) ) {\n\n\t\t\tbindingType = this.BindingType.EntireArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else {\n\n\t\t\tthis.propertyName = propertyName;\n\n\t\t}\n\n\t\t// select getter / setter\n\t\tthis.getValue = this.GetterByBindingType[ bindingType ];\n\t\tthis.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ];\n\n\t}\n\n\tunbind() {\n\n\t\tthis.node = null;\n\n\t\t// back to the prototype version of getValue / setValue\n\t\t// note: avoiding to mutate the shape of 'this' via 'delete'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n}\n\nPropertyBinding.Composite = Composite;\n\nPropertyBinding.prototype.BindingType = {\n\tDirect: 0,\n\tEntireArray: 1,\n\tArrayElement: 2,\n\tHasFromToArray: 3\n};\n\nPropertyBinding.prototype.Versioning = {\n\tNone: 0,\n\tNeedsUpdate: 1,\n\tMatrixWorldNeedsUpdate: 2\n};\n\nPropertyBinding.prototype.GetterByBindingType = [\n\n\tPropertyBinding.prototype._getValue_direct,\n\tPropertyBinding.prototype._getValue_array,\n\tPropertyBinding.prototype._getValue_arrayElement,\n\tPropertyBinding.prototype._getValue_toArray,\n\n];\n\nPropertyBinding.prototype.SetterByBindingTypeAndVersioning = [\n\n\t[\n\t\t// Direct\n\t\tPropertyBinding.prototype._setValue_direct,\n\t\tPropertyBinding.prototype._setValue_direct_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// EntireArray\n\n\t\tPropertyBinding.prototype._setValue_array,\n\t\tPropertyBinding.prototype._setValue_array_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// ArrayElement\n\t\tPropertyBinding.prototype._setValue_arrayElement,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// HasToFromArray\n\t\tPropertyBinding.prototype._setValue_fromArray,\n\t\tPropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate,\n\n\t]\n\n];\n\n/**\n *\n * A group of objects that receives a shared animation state.\n *\n * Usage:\n *\n * - Add objects you would otherwise pass as 'root' to the\n * constructor or the .clipAction method of AnimationMixer.\n *\n * - Instead pass this object as 'root'.\n *\n * - You can also add and remove objects later when the mixer\n * is running.\n *\n * Note:\n *\n * Objects of this class appear as one object to the mixer,\n * so cache control of the individual objects must be done\n * on the group.\n *\n * Limitation:\n *\n * - The animated properties must be compatible among the\n * all objects in the group.\n *\n * - A single property can either be controlled through a\n * target group or directly, but not both.\n */\n\nclass AnimationObjectGroup {\n\n\tconstructor() {\n\n\t\tthis.isAnimationObjectGroup = true;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// cached objects followed by the active ones\n\t\tthis._objects = Array.prototype.slice.call( arguments );\n\n\t\tthis.nCachedObjects_ = 0; // threshold\n\t\t// note: read by PropertyBinding.Composite\n\n\t\tconst indices = {};\n\t\tthis._indicesByUUID = indices; // for bookkeeping\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tindices[ arguments[ i ].uuid ] = i;\n\n\t\t}\n\n\t\tthis._paths = []; // inside: string\n\t\tthis._parsedPaths = []; // inside: { we don't care, here }\n\t\tthis._bindings = []; // inside: Array< PropertyBinding >\n\t\tthis._bindingsIndicesByPath = {}; // inside: indices in these arrays\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tobjects: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._objects.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn this.total - scope.nCachedObjects_;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tget bindingsPerObject() {\n\n\t\t\t\treturn scope._bindings.length;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tadd() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tpaths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet knownObject = undefined,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid;\n\t\t\tlet index = indicesByUUID[ uuid ];\n\n\t\t\tif ( index === undefined ) {\n\n\t\t\t\t// unknown object -> add it to the ACTIVE region\n\n\t\t\t\tindex = nObjects ++;\n\t\t\t\tindicesByUUID[ uuid ] = index;\n\t\t\t\tobjects.push( object );\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tbindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) );\n\n\t\t\t\t}\n\n\t\t\t} else if ( index < nCachedObjects ) {\n\n\t\t\t\tknownObject = objects[ index ];\n\n\t\t\t\t// move existing object to the ACTIVE region\n\n\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ];\n\n\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = firstActiveIndex;\n\t\t\t\tobjects[ firstActiveIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ];\n\n\t\t\t\t\tlet binding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\n\t\t\t\t\tif ( binding === undefined ) {\n\n\t\t\t\t\t\t// since we do not bother to create new bindings\n\t\t\t\t\t\t// for objects that are cached, the binding may\n\t\t\t\t\t\t// or may not exist\n\n\t\t\t\t\t\tbinding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t} else if ( objects[ index ] !== knownObject ) {\n\n\t\t\t\tconsole.error( 'THREE.AnimationObjectGroup: Different objects with the same UUID ' +\n\t\t\t\t\t'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );\n\n\t\t\t} // else the object is already where we want it to be\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\tremove() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined && index >= nCachedObjects ) {\n\n\t\t\t\t// move existing object into the CACHED region\n\n\t\t\t\tconst lastCachedIndex = nCachedObjects ++,\n\t\t\t\t\tfirstActiveObject = objects[ lastCachedIndex ];\n\n\t\t\t\tindicesByUUID[ firstActiveObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = firstActiveObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = lastCachedIndex;\n\t\t\t\tobjects[ lastCachedIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tfirstActive = bindingsForPath[ lastCachedIndex ],\n\t\t\t\t\t\tbinding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = firstActive;\n\t\t\t\t\tbindingsForPath[ lastCachedIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// remove & forget\n\tuncache() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_,\n\t\t\tnObjects = objects.length;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined ) {\n\n\t\t\t\tdelete indicesByUUID[ uuid ];\n\n\t\t\t\tif ( index < nCachedObjects ) {\n\n\t\t\t\t\t// object is cached, shrink the CACHED region\n\n\t\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ],\n\t\t\t\t\t\tlastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\t// last cached object takes this object's place\n\t\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\t\t// last object goes to the activated slot and pop\n\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = firstActiveIndex;\n\t\t\t\t\tobjects[ firstActiveIndex ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ],\n\t\t\t\t\t\t\tlast = bindingsForPath[ lastIndex ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\t\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = last;\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// object is active, just swap with the last and pop\n\n\t\t\t\t\tconst lastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\tif ( lastIndex > 0 ) {\n\n\t\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = index;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tobjects[ index ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = bindingsForPath[ lastIndex ];\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} // cached or active\n\n\t\t\t} // if object is known\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// Internal interface used by befriended PropertyBinding.Composite:\n\n\tsubscribe_( path, parsedPath ) {\n\n\t\t// returns an array of bindings for the given path that is changed\n\t\t// according to the contained objects in the group\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath;\n\t\tlet index = indicesByPath[ path ];\n\t\tconst bindings = this._bindings;\n\n\t\tif ( index !== undefined ) return bindings[ index ];\n\n\t\tconst paths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tobjects = this._objects,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tbindingsForPath = new Array( nObjects );\n\n\t\tindex = bindings.length;\n\n\t\tindicesByPath[ path ] = index;\n\n\t\tpaths.push( path );\n\t\tparsedPaths.push( parsedPath );\n\t\tbindings.push( bindingsForPath );\n\n\t\tfor ( let i = nCachedObjects, n = objects.length; i !== n; ++ i ) {\n\n\t\t\tconst object = objects[ i ];\n\t\t\tbindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath );\n\n\t\t}\n\n\t\treturn bindingsForPath;\n\n\t}\n\n\tunsubscribe_( path ) {\n\n\t\t// tells the group to forget about a property path and no longer\n\t\t// update the array previously obtained with 'subscribe_'\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath,\n\t\t\tindex = indicesByPath[ path ];\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst paths = this._paths,\n\t\t\t\tparsedPaths = this._parsedPaths,\n\t\t\t\tbindings = this._bindings,\n\t\t\t\tlastBindingsIndex = bindings.length - 1,\n\t\t\t\tlastBindings = bindings[ lastBindingsIndex ],\n\t\t\t\tlastBindingsPath = path[ lastBindingsIndex ];\n\n\t\t\tindicesByPath[ lastBindingsPath ] = index;\n\n\t\t\tbindings[ index ] = lastBindings;\n\t\t\tbindings.pop();\n\n\t\t\tparsedPaths[ index ] = parsedPaths[ lastBindingsIndex ];\n\t\t\tparsedPaths.pop();\n\n\t\t\tpaths[ index ] = paths[ lastBindingsIndex ];\n\t\t\tpaths.pop();\n\n\t\t}\n\n\t}\n\n}\n\nclass AnimationAction {\n\n\tconstructor( mixer, clip, localRoot = null, blendMode = clip.blendMode ) {\n\n\t\tthis._mixer = mixer;\n\t\tthis._clip = clip;\n\t\tthis._localRoot = localRoot;\n\t\tthis.blendMode = blendMode;\n\n\t\tconst tracks = clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tinterpolants = new Array( nTracks );\n\n\t\tconst interpolantSettings = {\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\t\t};\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst interpolant = tracks[ i ].createInterpolant( null );\n\t\t\tinterpolants[ i ] = interpolant;\n\t\t\tinterpolant.settings = interpolantSettings;\n\n\t\t}\n\n\t\tthis._interpolantSettings = interpolantSettings;\n\n\t\tthis._interpolants = interpolants; // bound by the mixer\n\n\t\t// inside: PropertyMixer (managed by the mixer)\n\t\tthis._propertyBindings = new Array( nTracks );\n\n\t\tthis._cacheIndex = null; // for the memory manager\n\t\tthis._byClipCacheIndex = null; // for the memory manager\n\n\t\tthis._timeScaleInterpolant = null;\n\t\tthis._weightInterpolant = null;\n\n\t\tthis.loop = LoopRepeat;\n\t\tthis._loopCount = - 1;\n\n\t\t// global mixer time when the action is to be started\n\t\t// it's set back to 'null' upon start of the action\n\t\tthis._startTime = null;\n\n\t\t// scaled local time of the action\n\t\t// gets clamped or wrapped to 0..clip.duration according to loop\n\t\tthis.time = 0;\n\n\t\tthis.timeScale = 1;\n\t\tthis._effectiveTimeScale = 1;\n\n\t\tthis.weight = 1;\n\t\tthis._effectiveWeight = 1;\n\n\t\tthis.repetitions = Infinity; // no. of repetitions when looping\n\n\t\tthis.paused = false; // true -> zero effective time scale\n\t\tthis.enabled = true; // false -> zero effective weight\n\n\t\tthis.clampWhenFinished = false;// keep feeding the last frame?\n\n\t\tthis.zeroSlopeAtStart = true;// for smooth interpolation w/o separate\n\t\tthis.zeroSlopeAtEnd = true;// clips for start, loop and end\n\n\t}\n\n\t// State & Scheduling\n\n\tplay() {\n\n\t\tthis._mixer._activateAction( this );\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tthis._mixer._deactivateAction( this );\n\n\t\treturn this.reset();\n\n\t}\n\n\treset() {\n\n\t\tthis.paused = false;\n\t\tthis.enabled = true;\n\n\t\tthis.time = 0; // restart clip\n\t\tthis._loopCount = - 1;// forget previous loops\n\t\tthis._startTime = null;// forget scheduling\n\n\t\treturn this.stopFading().stopWarping();\n\n\t}\n\n\tisRunning() {\n\n\t\treturn this.enabled && ! this.paused && this.timeScale !== 0 &&\n\t\t\tthis._startTime === null && this._mixer._isActiveAction( this );\n\n\t}\n\n\t// return true when play has been called\n\tisScheduled() {\n\n\t\treturn this._mixer._isActiveAction( this );\n\n\t}\n\n\tstartAt( time ) {\n\n\t\tthis._startTime = time;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoop( mode, repetitions ) {\n\n\t\tthis.loop = mode;\n\t\tthis.repetitions = repetitions;\n\n\t\treturn this;\n\n\t}\n\n\t// Weight\n\n\t// set the weight stopping any scheduled fading\n\t// although .enabled = false yields an effective weight of zero, this\n\t// method does *not* change .enabled, because it would be confusing\n\tsetEffectiveWeight( weight ) {\n\n\t\tthis.weight = weight;\n\n\t\t// note: same logic as when updated at runtime\n\t\tthis._effectiveWeight = this.enabled ? weight : 0;\n\n\t\treturn this.stopFading();\n\n\t}\n\n\t// return the weight considering fading and .enabled\n\tgetEffectiveWeight() {\n\n\t\treturn this._effectiveWeight;\n\n\t}\n\n\tfadeIn( duration ) {\n\n\t\treturn this._scheduleFading( duration, 0, 1 );\n\n\t}\n\n\tfadeOut( duration ) {\n\n\t\treturn this._scheduleFading( duration, 1, 0 );\n\n\t}\n\n\tcrossFadeFrom( fadeOutAction, duration, warp ) {\n\n\t\tfadeOutAction.fadeOut( duration );\n\t\tthis.fadeIn( duration );\n\n\t\tif ( warp ) {\n\n\t\t\tconst fadeInDuration = this._clip.duration,\n\t\t\t\tfadeOutDuration = fadeOutAction._clip.duration,\n\n\t\t\t\tstartEndRatio = fadeOutDuration / fadeInDuration,\n\t\t\t\tendStartRatio = fadeInDuration / fadeOutDuration;\n\n\t\t\tfadeOutAction.warp( 1.0, startEndRatio, duration );\n\t\t\tthis.warp( endStartRatio, 1.0, duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcrossFadeTo( fadeInAction, duration, warp ) {\n\n\t\treturn fadeInAction.crossFadeFrom( this, duration, warp );\n\n\t}\n\n\tstopFading() {\n\n\t\tconst weightInterpolant = this._weightInterpolant;\n\n\t\tif ( weightInterpolant !== null ) {\n\n\t\t\tthis._weightInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( weightInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Time Scale Control\n\n\t// set the time scale stopping any scheduled warping\n\t// although .paused = true yields an effective time scale of zero, this\n\t// method does *not* change .paused, because it would be confusing\n\tsetEffectiveTimeScale( timeScale ) {\n\n\t\tthis.timeScale = timeScale;\n\t\tthis._effectiveTimeScale = this.paused ? 0 : timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\t// return the time scale considering warping and .paused\n\tgetEffectiveTimeScale() {\n\n\t\treturn this._effectiveTimeScale;\n\n\t}\n\n\tsetDuration( duration ) {\n\n\t\tthis.timeScale = this._clip.duration / duration;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\tsyncWith( action ) {\n\n\t\tthis.time = action.time;\n\t\tthis.timeScale = action.timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\thalt( duration ) {\n\n\t\treturn this.warp( this._effectiveTimeScale, 0, duration );\n\n\t}\n\n\twarp( startTimeScale, endTimeScale, duration ) {\n\n\t\tconst mixer = this._mixer,\n\t\t\tnow = mixer.time,\n\t\t\ttimeScale = this.timeScale;\n\n\t\tlet interpolant = this._timeScaleInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._timeScaleInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\ttimes[ 1 ] = now + duration;\n\n\t\tvalues[ 0 ] = startTimeScale / timeScale;\n\t\tvalues[ 1 ] = endTimeScale / timeScale;\n\n\t\treturn this;\n\n\t}\n\n\tstopWarping() {\n\n\t\tconst timeScaleInterpolant = this._timeScaleInterpolant;\n\n\t\tif ( timeScaleInterpolant !== null ) {\n\n\t\t\tthis._timeScaleInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( timeScaleInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Object Accessors\n\n\tgetMixer() {\n\n\t\treturn this._mixer;\n\n\t}\n\n\tgetClip() {\n\n\t\treturn this._clip;\n\n\t}\n\n\tgetRoot() {\n\n\t\treturn this._localRoot || this._mixer._root;\n\n\t}\n\n\t// Interna\n\n\t_update( time, deltaTime, timeDirection, accuIndex ) {\n\n\t\t// called by the mixer\n\n\t\tif ( ! this.enabled ) {\n\n\t\t\t// call ._updateWeight() to update ._effectiveWeight\n\n\t\t\tthis._updateWeight( time );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst startTime = this._startTime;\n\n\t\tif ( startTime !== null ) {\n\n\t\t\t// check for scheduled start of action\n\n\t\t\tconst timeRunning = ( time - startTime ) * timeDirection;\n\t\t\tif ( timeRunning < 0 || timeDirection === 0 ) {\n\n\t\t\t\tdeltaTime = 0;\n\n\t\t\t} else {\n\n\n\t\t\t\tthis._startTime = null; // unschedule\n\t\t\t\tdeltaTime = timeDirection * timeRunning;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// apply time scale and advance time\n\n\t\tdeltaTime *= this._updateTimeScale( time );\n\t\tconst clipTime = this._updateTime( deltaTime );\n\n\t\t// note: _updateTime may disable the action resulting in\n\t\t// an effective weight of 0\n\n\t\tconst weight = this._updateWeight( time );\n\n\t\tif ( weight > 0 ) {\n\n\t\t\tconst interpolants = this._interpolants;\n\t\t\tconst propertyMixers = this._propertyBindings;\n\n\t\t\tswitch ( this.blendMode ) {\n\n\t\t\t\tcase AdditiveAnimationBlendMode:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulateAdditive( weight );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase NormalAnimationBlendMode:\n\t\t\t\tdefault:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulate( accuIndex, weight );\n\n\t\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_updateWeight( time ) {\n\n\t\tlet weight = 0;\n\n\t\tif ( this.enabled ) {\n\n\t\t\tweight = this.weight;\n\t\t\tconst interpolant = this._weightInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\tweight *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopFading();\n\n\t\t\t\t\tif ( interpolantValue === 0 ) {\n\n\t\t\t\t\t\t// faded out, disable\n\t\t\t\t\t\tthis.enabled = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveWeight = weight;\n\t\treturn weight;\n\n\t}\n\n\t_updateTimeScale( time ) {\n\n\t\tlet timeScale = 0;\n\n\t\tif ( ! this.paused ) {\n\n\t\t\ttimeScale = this.timeScale;\n\n\t\t\tconst interpolant = this._timeScaleInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\ttimeScale *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopWarping();\n\n\t\t\t\t\tif ( timeScale === 0 ) {\n\n\t\t\t\t\t\t// motion has halted, pause\n\t\t\t\t\t\tthis.paused = true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// warp done - apply final time scale\n\t\t\t\t\t\tthis.timeScale = timeScale;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveTimeScale = timeScale;\n\t\treturn timeScale;\n\n\t}\n\n\t_updateTime( deltaTime ) {\n\n\t\tconst duration = this._clip.duration;\n\t\tconst loop = this.loop;\n\n\t\tlet time = this.time + deltaTime;\n\t\tlet loopCount = this._loopCount;\n\n\t\tconst pingPong = ( loop === LoopPingPong );\n\n\t\tif ( deltaTime === 0 ) {\n\n\t\t\tif ( loopCount === - 1 ) return time;\n\n\t\t\treturn ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time;\n\n\t\t}\n\n\t\tif ( loop === LoopOnce ) {\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tthis._loopCount = 0;\n\t\t\t\tthis._setEndings( true, true, false );\n\n\t\t\t}\n\n\t\t\thandle_stop: {\n\n\t\t\t\tif ( time >= duration ) {\n\n\t\t\t\t\ttime = duration;\n\n\t\t\t\t} else if ( time < 0 ) {\n\n\t\t\t\t\ttime = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tbreak handle_stop;\n\n\t\t\t\t}\n\n\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\telse this.enabled = false;\n\n\t\t\t\tthis.time = time;\n\n\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\tdirection: deltaTime < 0 ? - 1 : 1\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else { // repetitive Repeat or PingPong\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tif ( deltaTime >= 0 ) {\n\n\t\t\t\t\tloopCount = 0;\n\n\t\t\t\t\tthis._setEndings( true, this.repetitions === 0, pingPong );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// when looping in reverse direction, the initial\n\t\t\t\t\t// transition through zero counts as a repetition,\n\t\t\t\t\t// so leave loopCount at -1\n\n\t\t\t\t\tthis._setEndings( this.repetitions === 0, true, pingPong );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( time >= duration || time < 0 ) {\n\n\t\t\t\t// wrap around\n\n\t\t\t\tconst loopDelta = Math.floor( time / duration ); // signed\n\t\t\t\ttime -= duration * loopDelta;\n\n\t\t\t\tloopCount += Math.abs( loopDelta );\n\n\t\t\t\tconst pending = this.repetitions - loopCount;\n\n\t\t\t\tif ( pending <= 0 ) {\n\n\t\t\t\t\t// have to stop (switch state, clamp time, fire event)\n\n\t\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\t\telse this.enabled = false;\n\n\t\t\t\t\ttime = deltaTime > 0 ? duration : 0;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\t\tdirection: deltaTime > 0 ? 1 : - 1\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// keep running\n\n\t\t\t\t\tif ( pending === 1 ) {\n\n\t\t\t\t\t\t// entering the last round\n\n\t\t\t\t\t\tconst atStart = deltaTime < 0;\n\t\t\t\t\t\tthis._setEndings( atStart, ! atStart, pingPong );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis._setEndings( false, false, pingPong );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._loopCount = loopCount;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'loop', action: this, loopDelta: loopDelta\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tthis.time = time;\n\n\t\t\t}\n\n\t\t\tif ( pingPong && ( loopCount & 1 ) === 1 ) {\n\n\t\t\t\t// invert time for the \"pong round\"\n\n\t\t\t\treturn duration - time;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn time;\n\n\t}\n\n\t_setEndings( atStart, atEnd, pingPong ) {\n\n\t\tconst settings = this._interpolantSettings;\n\n\t\tif ( pingPong ) {\n\n\t\t\tsettings.endingStart = ZeroSlopeEnding;\n\t\t\tsettings.endingEnd = ZeroSlopeEnding;\n\n\t\t} else {\n\n\t\t\t// assuming for LoopOnce atStart == atEnd == true\n\n\t\t\tif ( atStart ) {\n\n\t\t\t\tsettings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingStart = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t\tif ( atEnd ) {\n\n\t\t\t\tsettings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingEnd \t = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_scheduleFading( duration, weightNow, weightThen ) {\n\n\t\tconst mixer = this._mixer, now = mixer.time;\n\t\tlet interpolant = this._weightInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._weightInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\tvalues[ 0 ] = weightNow;\n\t\ttimes[ 1 ] = now + duration;\n\t\tvalues[ 1 ] = weightThen;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _controlInterpolantsResultBuffer = new Float32Array( 1 );\n\n\nclass AnimationMixer extends EventDispatcher {\n\n\tconstructor( root ) {\n\n\t\tsuper();\n\n\t\tthis._root = root;\n\t\tthis._initMemoryManager();\n\t\tthis._accuIndex = 0;\n\t\tthis.time = 0;\n\t\tthis.timeScale = 1.0;\n\n\t}\n\n\t_bindAction( action, prototypeAction ) {\n\n\t\tconst root = action._localRoot || this._root,\n\t\t\ttracks = action._clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tbindings = action._propertyBindings,\n\t\t\tinterpolants = action._interpolants,\n\t\t\trootUuid = root.uuid,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName;\n\n\t\tlet bindingsByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingsByName === undefined ) {\n\n\t\t\tbindingsByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingsByName;\n\n\t\t}\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst track = tracks[ i ],\n\t\t\t\ttrackName = track.name;\n\n\t\t\tlet binding = bindingsByName[ trackName ];\n\n\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t} else {\n\n\t\t\t\tbinding = bindings[ i ];\n\n\t\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t\t// existing binding, make sure the cache knows\n\n\t\t\t\t\tif ( binding._cacheIndex === null ) {\n\n\t\t\t\t\t\t++ binding.referenceCount;\n\t\t\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\tconst path = prototypeAction && prototypeAction.\n\t\t\t\t\t_propertyBindings[ i ].binding.parsedPath;\n\n\t\t\t\tbinding = new PropertyMixer(\n\t\t\t\t\tPropertyBinding.create( root, trackName, path ),\n\t\t\t\t\ttrack.ValueTypeName, track.getValueSize() );\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t}\n\n\t\t\tinterpolants[ i ].resultBuffer = binding.buffer;\n\n\t\t}\n\n\t}\n\n\t_activateAction( action ) {\n\n\t\tif ( ! this._isActiveAction( action ) ) {\n\n\t\t\tif ( action._cacheIndex === null ) {\n\n\t\t\t\t// this action has been forgotten by the cache, but the user\n\t\t\t\t// appears to be still using it -> rebind\n\n\t\t\t\tconst rootUuid = ( action._localRoot || this._root ).uuid,\n\t\t\t\t\tclipUuid = action._clip.uuid,\n\t\t\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\t\t\tthis._bindAction( action,\n\t\t\t\t\tactionsForClip && actionsForClip.knownActions[ 0 ] );\n\n\t\t\t\tthis._addInactiveAction( action, clipUuid, rootUuid );\n\n\t\t\t}\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// increment reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( binding.useCount ++ === 0 ) {\n\n\t\t\t\t\tthis._lendBinding( binding );\n\t\t\t\t\tbinding.saveOriginalState();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._lendAction( action );\n\n\t\t}\n\n\t}\n\n\t_deactivateAction( action ) {\n\n\t\tif ( this._isActiveAction( action ) ) {\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// decrement reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( -- binding.useCount === 0 ) {\n\n\t\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\t\tthis._takeBackBinding( binding );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._takeBackAction( action );\n\n\t\t}\n\n\t}\n\n\t// Memory manager\n\n\t_initMemoryManager() {\n\n\t\tthis._actions = []; // 'nActiveActions' followed by inactive ones\n\t\tthis._nActiveActions = 0;\n\n\t\tthis._actionsByClip = {};\n\t\t// inside:\n\t\t// {\n\t\t// \tknownActions: Array< AnimationAction > - used as prototypes\n\t\t// \tactionByRoot: AnimationAction - lookup\n\t\t// }\n\n\n\t\tthis._bindings = []; // 'nActiveBindings' followed by inactive ones\n\t\tthis._nActiveBindings = 0;\n\n\t\tthis._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\n\n\n\t\tthis._controlInterpolants = []; // same game as above\n\t\tthis._nActiveControlInterpolants = 0;\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tactions: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._actions.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveActions;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tbindings: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._bindings.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveBindings;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tcontrolInterpolants: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._controlInterpolants.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveControlInterpolants;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t// Memory management for AnimationAction objects\n\n\t_isActiveAction( action ) {\n\n\t\tconst index = action._cacheIndex;\n\t\treturn index !== null && index < this._nActiveActions;\n\n\t}\n\n\t_addInactiveAction( action, clipUuid, rootUuid ) {\n\n\t\tconst actions = this._actions,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tlet actionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip === undefined ) {\n\n\t\t\tactionsForClip = {\n\n\t\t\t\tknownActions: [ action ],\n\t\t\t\tactionByRoot: {}\n\n\t\t\t};\n\n\t\t\taction._byClipCacheIndex = 0;\n\n\t\t\tactionsByClip[ clipUuid ] = actionsForClip;\n\n\t\t} else {\n\n\t\t\tconst knownActions = actionsForClip.knownActions;\n\n\t\t\taction._byClipCacheIndex = knownActions.length;\n\t\t\tknownActions.push( action );\n\n\t\t}\n\n\t\taction._cacheIndex = actions.length;\n\t\tactions.push( action );\n\n\t\tactionsForClip.actionByRoot[ rootUuid ] = action;\n\n\t}\n\n\t_removeInactiveAction( action ) {\n\n\t\tconst actions = this._actions,\n\t\t\tlastInactiveAction = actions[ actions.length - 1 ],\n\t\t\tcacheIndex = action._cacheIndex;\n\n\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\tactions.pop();\n\n\t\taction._cacheIndex = null;\n\n\n\t\tconst clipUuid = action._clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ],\n\t\t\tknownActionsForClip = actionsForClip.knownActions,\n\n\t\t\tlastKnownAction =\n\t\t\t\tknownActionsForClip[ knownActionsForClip.length - 1 ],\n\n\t\t\tbyClipCacheIndex = action._byClipCacheIndex;\n\n\t\tlastKnownAction._byClipCacheIndex = byClipCacheIndex;\n\t\tknownActionsForClip[ byClipCacheIndex ] = lastKnownAction;\n\t\tknownActionsForClip.pop();\n\n\t\taction._byClipCacheIndex = null;\n\n\n\t\tconst actionByRoot = actionsForClip.actionByRoot,\n\t\t\trootUuid = ( action._localRoot || this._root ).uuid;\n\n\t\tdelete actionByRoot[ rootUuid ];\n\n\t\tif ( knownActionsForClip.length === 0 ) {\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t\tthis._removeInactiveBindingsForAction( action );\n\n\t}\n\n\t_removeInactiveBindingsForAction( action ) {\n\n\t\tconst bindings = action._propertyBindings;\n\n\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tconst binding = bindings[ i ];\n\n\t\t\tif ( -- binding.referenceCount === 0 ) {\n\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_lendAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions >| inactive actions ]\n\t\t// s a\n\t\t// <-swap->\n\t\t// a s\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveActions ++,\n\n\t\t\tfirstInactiveAction = actions[ lastActiveIndex ];\n\n\t\taction._cacheIndex = lastActiveIndex;\n\t\tactions[ lastActiveIndex ] = action;\n\n\t\tfirstInactiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = firstInactiveAction;\n\n\t}\n\n\t_takeBackAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions |< inactive actions ]\n\t\t// a s\n\t\t// <-swap->\n\t\t// s a\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveActions,\n\n\t\t\tlastActiveAction = actions[ firstInactiveIndex ];\n\n\t\taction._cacheIndex = firstInactiveIndex;\n\t\tactions[ firstInactiveIndex ] = action;\n\n\t\tlastActiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = lastActiveAction;\n\n\t}\n\n\t// Memory management for PropertyMixer objects\n\n\t_addInactiveBinding( binding, rootUuid, trackName ) {\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindings = this._bindings;\n\n\t\tlet bindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName === undefined ) {\n\n\t\t\tbindingByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingByName;\n\n\t\t}\n\n\t\tbindingByName[ trackName ] = binding;\n\n\t\tbinding._cacheIndex = bindings.length;\n\t\tbindings.push( binding );\n\n\t}\n\n\t_removeInactiveBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tpropBinding = binding.binding,\n\t\t\trootUuid = propBinding.rootNode.uuid,\n\t\t\ttrackName = propBinding.path,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ],\n\n\t\t\tlastInactiveBinding = bindings[ bindings.length - 1 ],\n\t\t\tcacheIndex = binding._cacheIndex;\n\n\t\tlastInactiveBinding._cacheIndex = cacheIndex;\n\t\tbindings[ cacheIndex ] = lastInactiveBinding;\n\t\tbindings.pop();\n\n\t\tdelete bindingByName[ trackName ];\n\n\t\tif ( Object.keys( bindingByName ).length === 0 ) {\n\n\t\t\tdelete bindingsByRoot[ rootUuid ];\n\n\t\t}\n\n\t}\n\n\t_lendBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveBindings ++,\n\n\t\t\tfirstInactiveBinding = bindings[ lastActiveIndex ];\n\n\t\tbinding._cacheIndex = lastActiveIndex;\n\t\tbindings[ lastActiveIndex ] = binding;\n\n\t\tfirstInactiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = firstInactiveBinding;\n\n\t}\n\n\t_takeBackBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveBindings,\n\n\t\t\tlastActiveBinding = bindings[ firstInactiveIndex ];\n\n\t\tbinding._cacheIndex = firstInactiveIndex;\n\t\tbindings[ firstInactiveIndex ] = binding;\n\n\t\tlastActiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = lastActiveBinding;\n\n\t}\n\n\n\t// Memory management of Interpolants for weight and time scale\n\n\t_lendControlInterpolant() {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tlastActiveIndex = this._nActiveControlInterpolants ++;\n\n\t\tlet interpolant = interpolants[ lastActiveIndex ];\n\n\t\tif ( interpolant === undefined ) {\n\n\t\t\tinterpolant = new LinearInterpolant(\n\t\t\t\tnew Float32Array( 2 ), new Float32Array( 2 ),\n\t\t\t\t1, _controlInterpolantsResultBuffer );\n\n\t\t\tinterpolant.__cacheIndex = lastActiveIndex;\n\t\t\tinterpolants[ lastActiveIndex ] = interpolant;\n\n\t\t}\n\n\t\treturn interpolant;\n\n\t}\n\n\t_takeBackControlInterpolant( interpolant ) {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tprevIndex = interpolant.__cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveControlInterpolants,\n\n\t\t\tlastActiveInterpolant = interpolants[ firstInactiveIndex ];\n\n\t\tinterpolant.__cacheIndex = firstInactiveIndex;\n\t\tinterpolants[ firstInactiveIndex ] = interpolant;\n\n\t\tlastActiveInterpolant.__cacheIndex = prevIndex;\n\t\tinterpolants[ prevIndex ] = lastActiveInterpolant;\n\n\t}\n\n\t// return an action for a clip optionally using a custom root target\n\t// object (this method allocates a lot of dynamic memory in case a\n\t// previously unknown clip/root combination is specified)\n\tclipAction( clip, optionalRoot, blendMode ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid;\n\n\t\tlet clipObject = typeof clip === 'string' ? AnimationClip.findByName( root, clip ) : clip;\n\n\t\tconst clipUuid = clipObject !== null ? clipObject.uuid : clip;\n\n\t\tconst actionsForClip = this._actionsByClip[ clipUuid ];\n\t\tlet prototypeAction = null;\n\n\t\tif ( blendMode === undefined ) {\n\n\t\t\tif ( clipObject !== null ) {\n\n\t\t\t\tblendMode = clipObject.blendMode;\n\n\t\t\t} else {\n\n\t\t\t\tblendMode = NormalAnimationBlendMode;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\tconst existingAction = actionsForClip.actionByRoot[ rootUuid ];\n\n\t\t\tif ( existingAction !== undefined && existingAction.blendMode === blendMode ) {\n\n\t\t\t\treturn existingAction;\n\n\t\t\t}\n\n\t\t\t// we know the clip, so we don't have to parse all\n\t\t\t// the bindings again but can just copy\n\t\t\tprototypeAction = actionsForClip.knownActions[ 0 ];\n\n\t\t\t// also, take the clip from the prototype action\n\t\t\tif ( clipObject === null )\n\t\t\t\tclipObject = prototypeAction._clip;\n\n\t\t}\n\n\t\t// clip must be known when specified via string\n\t\tif ( clipObject === null ) return null;\n\n\t\t// allocate all resources required to run it\n\t\tconst newAction = new AnimationAction( this, clipObject, optionalRoot, blendMode );\n\n\t\tthis._bindAction( newAction, prototypeAction );\n\n\t\t// and make the action known to the memory manager\n\t\tthis._addInactiveAction( newAction, clipUuid, rootUuid );\n\n\t\treturn newAction;\n\n\t}\n\n\t// get an existing action\n\texistingAction( clip, optionalRoot ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid,\n\n\t\t\tclipObject = typeof clip === 'string' ?\n\t\t\t\tAnimationClip.findByName( root, clip ) : clip,\n\n\t\t\tclipUuid = clipObject ? clipObject.uuid : clip,\n\n\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\treturn actionsForClip.actionByRoot[ rootUuid ] || null;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// deactivates all previously scheduled actions\n\tstopAllAction() {\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions;\n\n\t\tfor ( let i = nActions - 1; i >= 0; -- i ) {\n\n\t\t\tactions[ i ].stop();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// advance the time and update apply the animation\n\tupdate( deltaTime ) {\n\n\t\tdeltaTime *= this.timeScale;\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions,\n\n\t\t\ttime = this.time += deltaTime,\n\t\t\ttimeDirection = Math.sign( deltaTime ),\n\n\t\t\taccuIndex = this._accuIndex ^= 1;\n\n\t\t// run active actions\n\n\t\tfor ( let i = 0; i !== nActions; ++ i ) {\n\n\t\t\tconst action = actions[ i ];\n\n\t\t\taction._update( time, deltaTime, timeDirection, accuIndex );\n\n\t\t}\n\n\t\t// update scene graph\n\n\t\tconst bindings = this._bindings,\n\t\t\tnBindings = this._nActiveBindings;\n\n\t\tfor ( let i = 0; i !== nBindings; ++ i ) {\n\n\t\t\tbindings[ i ].apply( accuIndex );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Allows you to seek to a specific time in an animation.\n\tsetTime( timeInSeconds ) {\n\n\t\tthis.time = 0; // Zero out time attribute for AnimationMixer object;\n\t\tfor ( let i = 0; i < this._actions.length; i ++ ) {\n\n\t\t\tthis._actions[ i ].time = 0; // Zero out time attribute for all associated AnimationAction objects.\n\n\t\t}\n\n\t\treturn this.update( timeInSeconds ); // Update used to set exact time. Returns \"this\" AnimationMixer object.\n\n\t}\n\n\t// return this mixer's root target object\n\tgetRoot() {\n\n\t\treturn this._root;\n\n\t}\n\n\t// free all resources specific to a particular clip\n\tuncacheClip( clip ) {\n\n\t\tconst actions = this._actions,\n\t\t\tclipUuid = clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\t// note: just calling _removeInactiveAction would mess up the\n\t\t\t// iteration state and also require updating the state we can\n\t\t\t// just throw away\n\n\t\t\tconst actionsToRemove = actionsForClip.knownActions;\n\n\t\t\tfor ( let i = 0, n = actionsToRemove.length; i !== n; ++ i ) {\n\n\t\t\t\tconst action = actionsToRemove[ i ];\n\n\t\t\t\tthis._deactivateAction( action );\n\n\t\t\t\tconst cacheIndex = action._cacheIndex,\n\t\t\t\t\tlastInactiveAction = actions[ actions.length - 1 ];\n\n\t\t\t\taction._cacheIndex = null;\n\t\t\t\taction._byClipCacheIndex = null;\n\n\t\t\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\t\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\t\t\tactions.pop();\n\n\t\t\t\tthis._removeInactiveBindingsForAction( action );\n\n\t\t\t}\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t}\n\n\t// free all resources specific to a particular root target object\n\tuncacheRoot( root ) {\n\n\t\tconst rootUuid = root.uuid,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tfor ( const clipUuid in actionsByClip ) {\n\n\t\t\tconst actionByRoot = actionsByClip[ clipUuid ].actionByRoot,\n\t\t\t\taction = actionByRoot[ rootUuid ];\n\n\t\t\tif ( action !== undefined ) {\n\n\t\t\t\tthis._deactivateAction( action );\n\t\t\t\tthis._removeInactiveAction( action );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName !== undefined ) {\n\n\t\t\tfor ( const trackName in bindingByName ) {\n\n\t\t\t\tconst binding = bindingByName[ trackName ];\n\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remove a targeted clip from the cache\n\tuncacheAction( clip, optionalRoot ) {\n\n\t\tconst action = this.existingAction( clip, optionalRoot );\n\n\t\tif ( action !== null ) {\n\n\t\t\tthis._deactivateAction( action );\n\t\t\tthis._removeInactiveAction( action );\n\n\t\t}\n\n\t}\n\n}\n\nclass Uniform {\n\n\tconstructor( value ) {\n\n\t\tthis.value = value;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Uniform( this.value.clone === undefined ? this.value : this.value.clone() );\n\n\t}\n\n}\n\nlet _id = 0;\n\nclass UniformsGroup extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isUniformsGroup = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _id ++ } );\n\n\t\tthis.name = '';\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.uniforms = [];\n\n\t}\n\n\tadd( uniform ) {\n\n\t\tthis.uniforms.push( uniform );\n\n\t\treturn this;\n\n\t}\n\n\tremove( uniform ) {\n\n\t\tconst index = this.uniforms.indexOf( uniform );\n\n\t\tif ( index !== - 1 ) this.uniforms.splice( index, 1 );\n\n\t\treturn this;\n\n\t}\n\n\tsetName( name ) {\n\n\t\tthis.name = name;\n\n\t\treturn this;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.usage = source.usage;\n\n\t\tconst uniformsSource = source.uniforms;\n\n\t\tthis.uniforms.length = 0;\n\n\t\tfor ( let i = 0, l = uniformsSource.length; i < l; i ++ ) {\n\n\t\t\tconst uniforms = Array.isArray( uniformsSource[ i ] ) ? uniformsSource[ i ] : [ uniformsSource[ i ] ];\n\n\t\t\tfor ( let j = 0; j < uniforms.length; j ++ ) {\n\n\t\t\t\tthis.uniforms.push( uniforms[ j ].clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass InstancedInterleavedBuffer extends InterleavedBuffer {\n\n\tconstructor( array, stride, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, stride );\n\n\t\tthis.isInstancedInterleavedBuffer = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tconst ib = super.clone( data );\n\n\t\tib.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn ib;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tconst json = super.toJSON( data );\n\n\t\tjson.isInstancedInterleavedBuffer = true;\n\t\tjson.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn json;\n\n\t}\n\n}\n\nclass GLBufferAttribute {\n\n\tconstructor( buffer, type, itemSize, elementSize, count ) {\n\n\t\tthis.isGLBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.buffer = buffer;\n\t\tthis.type = type;\n\t\tthis.itemSize = itemSize;\n\t\tthis.elementSize = elementSize;\n\t\tthis.count = count;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetBuffer( buffer ) {\n\n\t\tthis.buffer = buffer;\n\n\t\treturn this;\n\n\t}\n\n\tsetType( type, elementSize ) {\n\n\t\tthis.type = type;\n\t\tthis.elementSize = elementSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetItemSize( itemSize ) {\n\n\t\tthis.itemSize = itemSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetCount( count ) {\n\n\t\tthis.count = count;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _matrix = /*@__PURE__*/ new Matrix4();\n\nclass Raycaster {\n\n\tconstructor( origin, direction, near = 0, far = Infinity ) {\n\n\t\tthis.ray = new Ray( origin, direction );\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.camera = null;\n\t\tthis.layers = new Layers();\n\n\t\tthis.params = {\n\t\t\tMesh: {},\n\t\t\tLine: { threshold: 1 },\n\t\t\tLOD: {},\n\t\t\tPoints: { threshold: 1 },\n\t\t\tSprite: {}\n\t\t};\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.ray.set( origin, direction );\n\n\t}\n\n\tsetFromCamera( coords, camera ) {\n\n\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\tthis.ray.origin.setFromMatrixPosition( camera.matrixWorld );\n\t\t\tthis.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();\n\t\t\tthis.camera = camera;\n\n\t\t} else if ( camera.isOrthographicCamera ) {\n\n\t\t\tthis.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera\n\t\t\tthis.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );\n\t\t\tthis.camera = camera;\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Raycaster: Unsupported camera type: ' + camera.type );\n\n\t\t}\n\n\t}\n\n\tsetFromXRController( controller ) {\n\n\t\t_matrix.identity().extractRotation( controller.matrixWorld );\n\n\t\tthis.ray.origin.setFromMatrixPosition( controller.matrixWorld );\n\t\tthis.ray.direction.set( 0, 0, - 1 ).applyMatrix4( _matrix );\n\n\t\treturn this;\n\n\t}\n\n\tintersectObject( object, recursive = true, intersects = [] ) {\n\n\t\tintersect( object, this, intersects, recursive );\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n\tintersectObjects( objects, recursive = true, intersects = [] ) {\n\n\t\tfor ( let i = 0, l = objects.length; i < l; i ++ ) {\n\n\t\t\tintersect( objects[ i ], this, intersects, recursive );\n\n\t\t}\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n}\n\nfunction ascSort( a, b ) {\n\n\treturn a.distance - b.distance;\n\n}\n\nfunction intersect( object, raycaster, intersects, recursive ) {\n\n\tif ( object.layers.test( raycaster.layers ) ) {\n\n\t\tobject.raycast( raycaster, intersects );\n\n\t}\n\n\tif ( recursive === true ) {\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tintersect( children[ i ], raycaster, intersects, true );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system\n *\n * phi (the polar angle) is measured from the positive y-axis. The positive y-axis is up.\n * theta (the azimuthal angle) is measured from the positive z-axis.\n */\nclass Spherical {\n\n\tconstructor( radius = 1, phi = 0, theta = 0 ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi; // polar angle\n\t\tthis.theta = theta; // azimuthal angle\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, phi, theta ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi;\n\t\tthis.theta = theta;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.phi = other.phi;\n\t\tthis.theta = other.theta;\n\n\t\treturn this;\n\n\t}\n\n\t// restrict phi to be between EPS and PI-EPS\n\tmakeSafe() {\n\n\t\tconst EPS = 0.000001;\n\t\tthis.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + y * y + z * z );\n\n\t\tif ( this.radius === 0 ) {\n\n\t\t\tthis.theta = 0;\n\t\t\tthis.phi = 0;\n\n\t\t} else {\n\n\t\t\tthis.theta = Math.atan2( x, z );\n\t\t\tthis.phi = Math.acos( clamp( y / this.radius, - 1, 1 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system\n */\n\nclass Cylindrical {\n\n\tconstructor( radius = 1, theta = 0, y = 0 ) {\n\n\t\tthis.radius = radius; // distance from the origin to a point in the x-z plane\n\t\tthis.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n\t\tthis.y = y; // height above the x-z plane\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, theta, y ) {\n\n\t\tthis.radius = radius;\n\t\tthis.theta = theta;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.theta = other.theta;\n\t\tthis.y = other.y;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + z * z );\n\t\tthis.theta = Math.atan2( x, z );\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$4 = /*@__PURE__*/ new Vector2();\n\nclass Box2 {\n\n\tconstructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox2 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$4.copy( size ).multiplyScalar( 0.5 );\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = + Infinity;\n\t\tthis.max.x = this.max.y = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 4 splitting planes to rule out intersections\n\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ? false : true;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$4 ).distanceTo( point );\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _startP = /*@__PURE__*/ new Vector3();\nconst _startEnd = /*@__PURE__*/ new Vector3();\n\nclass Line3 {\n\n\tconstructor( start = new Vector3(), end = new Vector3() ) {\n\n\t\tthis.start = start;\n\t\tthis.end = end;\n\n\t}\n\n\tset( start, end ) {\n\n\t\tthis.start.copy( start );\n\t\tthis.end.copy( end );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( line ) {\n\n\t\tthis.start.copy( line.start );\n\t\tthis.end.copy( line.end );\n\n\t\treturn this;\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );\n\n\t}\n\n\tdelta( target ) {\n\n\t\treturn target.subVectors( this.end, this.start );\n\n\t}\n\n\tdistanceSq() {\n\n\t\treturn this.start.distanceToSquared( this.end );\n\n\t}\n\n\tdistance() {\n\n\t\treturn this.start.distanceTo( this.end );\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tclosestPointToPointParameter( point, clampToLine ) {\n\n\t\t_startP.subVectors( point, this.start );\n\t\t_startEnd.subVectors( this.end, this.start );\n\n\t\tconst startEnd2 = _startEnd.dot( _startEnd );\n\t\tconst startEnd_startP = _startEnd.dot( _startP );\n\n\t\tlet t = startEnd_startP / startEnd2;\n\n\t\tif ( clampToLine ) {\n\n\t\t\tt = clamp( t, 0, 1 );\n\n\t\t}\n\n\t\treturn t;\n\n\t}\n\n\tclosestPointToPoint( point, clampToLine, target ) {\n\n\t\tconst t = this.closestPointToPointParameter( point, clampToLine );\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.start.applyMatrix4( matrix );\n\t\tthis.end.applyMatrix4( matrix );\n\n\t\treturn this;\n\n\t}\n\n\tequals( line ) {\n\n\t\treturn line.start.equals( this.start ) && line.end.equals( this.end );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$3 = /*@__PURE__*/ new Vector3();\n\nclass SpotLightHelper extends Object3D {\n\n\tconstructor( light, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'SpotLightHelper';\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst positions = [\n\t\t\t0, 0, 0, \t0, 0, 1,\n\t\t\t0, 0, 0, \t1, 0, 1,\n\t\t\t0, 0, 0,\t- 1, 0, 1,\n\t\t\t0, 0, 0, \t0, 1, 1,\n\t\t\t0, 0, 0, \t0, - 1, 1\n\t\t];\n\n\t\tfor ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {\n\n\t\t\tconst p1 = ( i / l ) * Math.PI * 2;\n\t\t\tconst p2 = ( j / l ) * Math.PI * 2;\n\n\t\t\tpositions.push(\n\t\t\t\tMath.cos( p1 ), Math.sin( p1 ), 1,\n\t\t\t\tMath.cos( p2 ), Math.sin( p2 ), 1\n\t\t\t);\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.cone = new LineSegments( geometry, material );\n\t\tthis.add( this.cone );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\t// update the local matrix based on the parent and light target transforms\n\t\tif ( this.parent ) {\n\n\t\t\tthis.parent.updateWorldMatrix( true );\n\n\t\t\tthis.matrix\n\t\t\t\t.copy( this.parent.matrixWorld )\n\t\t\t\t.invert()\n\t\t\t\t.multiply( this.light.matrixWorld );\n\n\t\t} else {\n\n\t\t\tthis.matrix.copy( this.light.matrixWorld );\n\n\t\t}\n\n\t\tthis.matrixWorld.copy( this.light.matrixWorld );\n\n\t\tconst coneLength = this.light.distance ? this.light.distance : 1000;\n\t\tconst coneWidth = coneLength * Math.tan( this.light.angle );\n\n\t\tthis.cone.scale.set( coneWidth, coneWidth, coneLength );\n\n\t\t_vector$3.setFromMatrixPosition( this.light.target.matrixWorld );\n\n\t\tthis.cone.lookAt( _vector$3 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.cone.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.cone.material.color.copy( this.light.color );\n\n\t\t}\n\n\t}\n\n}\n\nconst _vector$2 = /*@__PURE__*/ new Vector3();\nconst _boneMatrix = /*@__PURE__*/ new Matrix4();\nconst _matrixWorldInv = /*@__PURE__*/ new Matrix4();\n\n\nclass SkeletonHelper extends LineSegments {\n\n\tconstructor( object ) {\n\n\t\tconst bones = getBoneList( object );\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst color1 = new Color( 0, 0, 1 );\n\t\tconst color2 = new Color( 0, 1, 0 );\n\n\t\tfor ( let i = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tcolors.push( color1.r, color1.g, color1.b );\n\t\t\t\tcolors.push( color2.r, color2.g, color2.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isSkeletonHelper = true;\n\n\t\tthis.type = 'SkeletonHelper';\n\n\t\tthis.root = object;\n\t\tthis.bones = bones;\n\n\t\tthis.matrix = object.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst bones = this.bones;\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\t_matrixWorldInv.copy( this.root.matrixWorld ).invert();\n\n\t\tfor ( let i = 0, j = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j + 1, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\tj += 2;\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction getBoneList( object ) {\n\n\tconst boneList = [];\n\n\tif ( object.isBone === true ) {\n\n\t\tboneList.push( object );\n\n\t}\n\n\tfor ( let i = 0; i < object.children.length; i ++ ) {\n\n\t\tboneList.push.apply( boneList, getBoneList( object.children[ i ] ) );\n\n\t}\n\n\treturn boneList;\n\n}\n\nclass PointLightHelper extends Mesh {\n\n\tconstructor( light, sphereSize, color ) {\n\n\t\tconst geometry = new SphereGeometry( sphereSize, 4, 2 );\n\t\tconst material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.light = light;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'PointLightHelper';\n\n\t\tthis.matrix = this.light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\n\t\t/*\n\t// TODO: delete this comment?\n\tconst distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );\n\tconst distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\n\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\n\n\tconst d = light.distance;\n\n\tif ( d === 0.0 ) {\n\n\t\tthis.lightDistance.visible = false;\n\n\t} else {\n\n\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t}\n\n\tthis.add( this.lightDistance );\n\t*/\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\t/*\n\t\tconst d = this.light.distance;\n\n\t\tif ( d === 0.0 ) {\n\n\t\t\tthis.lightDistance.visible = false;\n\n\t\t} else {\n\n\t\t\tthis.lightDistance.visible = true;\n\t\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t\t}\n\t\t*/\n\n\t}\n\n}\n\nconst _vector$1 = /*@__PURE__*/ new Vector3();\nconst _color1 = /*@__PURE__*/ new Color();\nconst _color2 = /*@__PURE__*/ new Color();\n\nclass HemisphereLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'HemisphereLightHelper';\n\n\t\tconst geometry = new OctahedronGeometry( size );\n\t\tgeometry.rotateY( Math.PI * 0.5 );\n\n\t\tthis.material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\t\tif ( this.color === undefined ) this.material.vertexColors = true;\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\t\tconst colors = new Float32Array( position.count * 3 );\n\n\t\tgeometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );\n\n\t\tthis.add( new Mesh( geometry, this.material ) );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tconst mesh = this.children[ 0 ];\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tconst colors = mesh.geometry.getAttribute( 'color' );\n\n\t\t\t_color1.copy( this.light.color );\n\t\t\t_color2.copy( this.light.groundColor );\n\n\t\t\tfor ( let i = 0, l = colors.count; i < l; i ++ ) {\n\n\t\t\t\tconst color = ( i < ( l / 2 ) ) ? _color1 : _color2;\n\n\t\t\t\tcolors.setXYZ( i, color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t\tcolors.needsUpdate = true;\n\n\t\t}\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tmesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );\n\n\t}\n\n}\n\nclass GridHelper extends LineSegments {\n\n\tconstructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst center = divisions / 2;\n\t\tconst step = size / divisions;\n\t\tconst halfSize = size / 2;\n\n\t\tconst vertices = [], colors = [];\n\n\t\tfor ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {\n\n\t\t\tvertices.push( - halfSize, 0, k, halfSize, 0, k );\n\t\t\tvertices.push( k, 0, - halfSize, k, 0, halfSize );\n\n\t\t\tconst color = i === center ? color1 : color2;\n\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'GridHelper';\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass PolarGridHelper extends LineSegments {\n\n\tconstructor( radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\t// create the sectors\n\n\t\tif ( sectors > 1 ) {\n\n\t\t\tfor ( let i = 0; i < sectors; i ++ ) {\n\n\t\t\t\tconst v = ( i / sectors ) * ( Math.PI * 2 );\n\n\t\t\t\tconst x = Math.sin( v ) * radius;\n\t\t\t\tconst z = Math.cos( v ) * radius;\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( x, 0, z );\n\n\t\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// create the rings\n\n\t\tfor ( let i = 0; i < rings; i ++ ) {\n\n\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\tconst r = radius - ( radius / rings * i );\n\n\t\t\tfor ( let j = 0; j < divisions; j ++ ) {\n\n\t\t\t\t// first vertex\n\n\t\t\t\tlet v = ( j / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tlet x = Math.sin( v ) * r;\n\t\t\t\tlet z = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t\t// second vertex\n\n\t\t\t\tv = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tx = Math.sin( v ) * r;\n\t\t\t\tz = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'PolarGridHelper';\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _v2 = /*@__PURE__*/ new Vector3();\nconst _v3 = /*@__PURE__*/ new Vector3();\n\nclass DirectionalLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'DirectionalLightHelper';\n\n\t\tif ( size === undefined ) size = 1;\n\n\t\tlet geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [\n\t\t\t- size, size, 0,\n\t\t\tsize, size, 0,\n\t\t\tsize, - size, 0,\n\t\t\t- size, - size, 0,\n\t\t\t- size, size, 0\n\t\t], 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.lightPlane = new Line( geometry, material );\n\t\tthis.add( this.lightPlane );\n\n\t\tgeometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) );\n\n\t\tthis.targetLine = new Line( geometry, material );\n\t\tthis.add( this.targetLine );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.lightPlane.geometry.dispose();\n\t\tthis.lightPlane.material.dispose();\n\t\tthis.targetLine.geometry.dispose();\n\t\tthis.targetLine.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\t_v1.setFromMatrixPosition( this.light.matrixWorld );\n\t\t_v2.setFromMatrixPosition( this.light.target.matrixWorld );\n\t\t_v3.subVectors( _v2, _v1 );\n\n\t\tthis.lightPlane.lookAt( _v2 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.lightPlane.material.color.set( this.color );\n\t\t\tthis.targetLine.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.lightPlane.material.color.copy( this.light.color );\n\t\t\tthis.targetLine.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\tthis.targetLine.lookAt( _v2 );\n\t\tthis.targetLine.scale.z = _v3.length();\n\n\t}\n\n}\n\nconst _vector = /*@__PURE__*/ new Vector3();\nconst _camera = /*@__PURE__*/ new Camera();\n\n/**\n *\t- shows frustum, line of sight and up of the camera\n *\t- suitable for fast updates\n * \t- based on frustum visualization in lightgl.js shadowmap example\n *\t\thttps://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html\n */\n\nclass CameraHelper extends LineSegments {\n\n\tconstructor( camera ) {\n\n\t\tconst geometry = new BufferGeometry();\n\t\tconst material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst pointMap = {};\n\n\t\t// near\n\n\t\taddLine( 'n1', 'n2' );\n\t\taddLine( 'n2', 'n4' );\n\t\taddLine( 'n4', 'n3' );\n\t\taddLine( 'n3', 'n1' );\n\n\t\t// far\n\n\t\taddLine( 'f1', 'f2' );\n\t\taddLine( 'f2', 'f4' );\n\t\taddLine( 'f4', 'f3' );\n\t\taddLine( 'f3', 'f1' );\n\n\t\t// sides\n\n\t\taddLine( 'n1', 'f1' );\n\t\taddLine( 'n2', 'f2' );\n\t\taddLine( 'n3', 'f3' );\n\t\taddLine( 'n4', 'f4' );\n\n\t\t// cone\n\n\t\taddLine( 'p', 'n1' );\n\t\taddLine( 'p', 'n2' );\n\t\taddLine( 'p', 'n3' );\n\t\taddLine( 'p', 'n4' );\n\n\t\t// up\n\n\t\taddLine( 'u1', 'u2' );\n\t\taddLine( 'u2', 'u3' );\n\t\taddLine( 'u3', 'u1' );\n\n\t\t// target\n\n\t\taddLine( 'c', 't' );\n\t\taddLine( 'p', 'c' );\n\n\t\t// cross\n\n\t\taddLine( 'cn1', 'cn2' );\n\t\taddLine( 'cn3', 'cn4' );\n\n\t\taddLine( 'cf1', 'cf2' );\n\t\taddLine( 'cf3', 'cf4' );\n\n\t\tfunction addLine( a, b ) {\n\n\t\t\taddPoint( a );\n\t\t\taddPoint( b );\n\n\t\t}\n\n\t\tfunction addPoint( id ) {\n\n\t\t\tvertices.push( 0, 0, 0 );\n\t\t\tcolors.push( 0, 0, 0 );\n\n\t\t\tif ( pointMap[ id ] === undefined ) {\n\n\t\t\t\tpointMap[ id ] = [];\n\n\t\t\t}\n\n\t\t\tpointMap[ id ].push( ( vertices.length / 3 ) - 1 );\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'CameraHelper';\n\n\t\tthis.camera = camera;\n\t\tif ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix();\n\n\t\tthis.matrix = camera.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.pointMap = pointMap;\n\n\t\tthis.update();\n\n\t\t// colors\n\n\t\tconst colorFrustum = new Color( 0xffaa00 );\n\t\tconst colorCone = new Color( 0xff0000 );\n\t\tconst colorUp = new Color( 0x00aaff );\n\t\tconst colorTarget = new Color( 0xffffff );\n\t\tconst colorCross = new Color( 0x333333 );\n\n\t\tthis.setColors( colorFrustum, colorCone, colorUp, colorTarget, colorCross );\n\n\t}\n\n\tsetColors( frustum, cone, up, target, cross ) {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst colorAttribute = geometry.getAttribute( 'color' );\n\n\t\t// near\n\n\t\tcolorAttribute.setXYZ( 0, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 1, frustum.r, frustum.g, frustum.b ); // n1, n2\n\t\tcolorAttribute.setXYZ( 2, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 3, frustum.r, frustum.g, frustum.b ); // n2, n4\n\t\tcolorAttribute.setXYZ( 4, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 5, frustum.r, frustum.g, frustum.b ); // n4, n3\n\t\tcolorAttribute.setXYZ( 6, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 7, frustum.r, frustum.g, frustum.b ); // n3, n1\n\n\t\t// far\n\n\t\tcolorAttribute.setXYZ( 8, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 9, frustum.r, frustum.g, frustum.b ); // f1, f2\n\t\tcolorAttribute.setXYZ( 10, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 11, frustum.r, frustum.g, frustum.b ); // f2, f4\n\t\tcolorAttribute.setXYZ( 12, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 13, frustum.r, frustum.g, frustum.b ); // f4, f3\n\t\tcolorAttribute.setXYZ( 14, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 15, frustum.r, frustum.g, frustum.b ); // f3, f1\n\n\t\t// sides\n\n\t\tcolorAttribute.setXYZ( 16, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 17, frustum.r, frustum.g, frustum.b ); // n1, f1\n\t\tcolorAttribute.setXYZ( 18, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 19, frustum.r, frustum.g, frustum.b ); // n2, f2\n\t\tcolorAttribute.setXYZ( 20, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 21, frustum.r, frustum.g, frustum.b ); // n3, f3\n\t\tcolorAttribute.setXYZ( 22, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 23, frustum.r, frustum.g, frustum.b ); // n4, f4\n\n\t\t// cone\n\n\t\tcolorAttribute.setXYZ( 24, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 25, cone.r, cone.g, cone.b ); // p, n1\n\t\tcolorAttribute.setXYZ( 26, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 27, cone.r, cone.g, cone.b ); // p, n2\n\t\tcolorAttribute.setXYZ( 28, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 29, cone.r, cone.g, cone.b ); // p, n3\n\t\tcolorAttribute.setXYZ( 30, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 31, cone.r, cone.g, cone.b ); // p, n4\n\n\t\t// up\n\n\t\tcolorAttribute.setXYZ( 32, up.r, up.g, up.b ); colorAttribute.setXYZ( 33, up.r, up.g, up.b ); // u1, u2\n\t\tcolorAttribute.setXYZ( 34, up.r, up.g, up.b ); colorAttribute.setXYZ( 35, up.r, up.g, up.b ); // u2, u3\n\t\tcolorAttribute.setXYZ( 36, up.r, up.g, up.b ); colorAttribute.setXYZ( 37, up.r, up.g, up.b ); // u3, u1\n\n\t\t// target\n\n\t\tcolorAttribute.setXYZ( 38, target.r, target.g, target.b ); colorAttribute.setXYZ( 39, target.r, target.g, target.b ); // c, t\n\t\tcolorAttribute.setXYZ( 40, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 41, cross.r, cross.g, cross.b ); // p, c\n\n\t\t// cross\n\n\t\tcolorAttribute.setXYZ( 42, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 43, cross.r, cross.g, cross.b ); // cn1, cn2\n\t\tcolorAttribute.setXYZ( 44, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 45, cross.r, cross.g, cross.b ); // cn3, cn4\n\n\t\tcolorAttribute.setXYZ( 46, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 47, cross.r, cross.g, cross.b ); // cf1, cf2\n\t\tcolorAttribute.setXYZ( 48, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 49, cross.r, cross.g, cross.b ); // cf3, cf4\n\n\t\tcolorAttribute.needsUpdate = true;\n\n\t}\n\n\tupdate() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst pointMap = this.pointMap;\n\n\t\tconst w = 1, h = 1;\n\n\t\t// we need just camera projection matrix inverse\n\t\t// world matrix must be identity\n\n\t\t_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );\n\n\t\t// center / target\n\n\t\tsetPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 );\n\t\tsetPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );\n\n\t\t// near\n\n\t\tsetPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 );\n\t\tsetPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 );\n\t\tsetPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 );\n\t\tsetPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 );\n\n\t\t// far\n\n\t\tsetPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );\n\t\tsetPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );\n\t\tsetPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );\n\t\tsetPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );\n\n\t\t// up\n\n\t\tsetPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, - 1 );\n\n\t\t// cross\n\n\t\tsetPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );\n\t\tsetPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );\n\t\tsetPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );\n\t\tsetPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );\n\n\t\tsetPoint( 'cn1', pointMap, geometry, _camera, - w, 0, - 1 );\n\t\tsetPoint( 'cn2', pointMap, geometry, _camera, w, 0, - 1 );\n\t\tsetPoint( 'cn3', pointMap, geometry, _camera, 0, - h, - 1 );\n\t\tsetPoint( 'cn4', pointMap, geometry, _camera, 0, h, - 1 );\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction setPoint( point, pointMap, geometry, camera, x, y, z ) {\n\n\t_vector.set( x, y, z ).unproject( camera );\n\n\tconst points = pointMap[ point ];\n\n\tif ( points !== undefined ) {\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tposition.setXYZ( points[ i ], _vector.x, _vector.y, _vector.z );\n\n\t\t}\n\n\t}\n\n}\n\nconst _box = /*@__PURE__*/ new Box3();\n\nclass BoxHelper extends LineSegments {\n\n\tconstructor( object, color = 0xffff00 ) {\n\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\t\tconst positions = new Float32Array( 8 * 3 );\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\t\tgeometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.object = object;\n\t\tthis.type = 'BoxHelper';\n\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\t}\n\n\tupdate( object ) {\n\n\t\tif ( object !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );\n\n\t\t}\n\n\t\tif ( this.object !== undefined ) {\n\n\t\t\t_box.setFromObject( this.object );\n\n\t\t}\n\n\t\tif ( _box.isEmpty() ) return;\n\n\t\tconst min = _box.min;\n\t\tconst max = _box.max;\n\n\t\t/*\n\t\t\t5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/\n\n\t\tconst position = this.geometry.attributes.position;\n\t\tconst array = position.array;\n\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\t\tposition.needsUpdate = true;\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tsetFromObject( object ) {\n\n\t\tthis.object = object;\n\t\tthis.update();\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.object = source.object;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass Box3Helper extends LineSegments {\n\n\tconstructor( box, color = 0xffff00 ) {\n\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\n\t\tconst positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ];\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.box = box;\n\n\t\tthis.type = 'Box3Helper';\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst box = this.box;\n\n\t\tif ( box.isEmpty() ) return;\n\n\t\tbox.getCenter( this.position );\n\n\t\tbox.getSize( this.scale );\n\n\t\tthis.scale.multiplyScalar( 0.5 );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass PlaneHelper extends Line {\n\n\tconstructor( plane, size = 1, hex = 0xffff00 ) {\n\n\t\tconst color = hex;\n\n\t\tconst positions = [ 1, - 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\t\tgeometry.computeBoundingSphere();\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.type = 'PlaneHelper';\n\n\t\tthis.plane = plane;\n\n\t\tthis.size = size;\n\n\t\tconst positions2 = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ];\n\n\t\tconst geometry2 = new BufferGeometry();\n\t\tgeometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );\n\t\tgeometry2.computeBoundingSphere();\n\n\t\tthis.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false } ) ) );\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tthis.position.set( 0, 0, 0 );\n\n\t\tthis.scale.set( 0.5 * this.size, 0.5 * this.size, 1 );\n\n\t\tthis.lookAt( this.plane.normal );\n\n\t\tthis.translateZ( - this.plane.constant );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n}\n\nconst _axis = /*@__PURE__*/ new Vector3();\nlet _lineGeometry, _coneGeometry;\n\nclass ArrowHelper extends Object3D {\n\n\t// dir is assumed to be normalized\n\n\tconstructor( dir = new Vector3( 0, 0, 1 ), origin = new Vector3( 0, 0, 0 ), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ArrowHelper';\n\n\t\tif ( _lineGeometry === undefined ) {\n\n\t\t\t_lineGeometry = new BufferGeometry();\n\t\t\t_lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );\n\n\t\t\t_coneGeometry = new CylinderGeometry( 0, 0.5, 1, 5, 1 );\n\t\t\t_coneGeometry.translate( 0, - 0.5, 0 );\n\n\t\t}\n\n\t\tthis.position.copy( origin );\n\n\t\tthis.line = new Line( _lineGeometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.line.matrixAutoUpdate = false;\n\t\tthis.add( this.line );\n\n\t\tthis.cone = new Mesh( _coneGeometry, new MeshBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.cone.matrixAutoUpdate = false;\n\t\tthis.add( this.cone );\n\n\t\tthis.setDirection( dir );\n\t\tthis.setLength( length, headLength, headWidth );\n\n\t}\n\n\tsetDirection( dir ) {\n\n\t\t// dir is assumed to be normalized\n\n\t\tif ( dir.y > 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 0, 0, 0, 1 );\n\n\t\t} else if ( dir.y < - 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 1, 0, 0, 0 );\n\n\t\t} else {\n\n\t\t\t_axis.set( dir.z, 0, - dir.x ).normalize();\n\n\t\t\tconst radians = Math.acos( dir.y );\n\n\t\t\tthis.quaternion.setFromAxisAngle( _axis, radians );\n\n\t\t}\n\n\t}\n\n\tsetLength( length, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tthis.line.scale.set( 1, Math.max( 0.0001, length - headLength ), 1 ); // see #17458\n\t\tthis.line.updateMatrix();\n\n\t\tthis.cone.scale.set( headWidth, headLength, headWidth );\n\t\tthis.cone.position.y = length;\n\t\tthis.cone.updateMatrix();\n\n\t}\n\n\tsetColor( color ) {\n\n\t\tthis.line.material.color.set( color );\n\t\tthis.cone.material.color.set( color );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tthis.line.copy( source.line );\n\t\tthis.cone.copy( source.cone );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.line.geometry.dispose();\n\t\tthis.line.material.dispose();\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n}\n\nclass AxesHelper extends LineSegments {\n\n\tconstructor( size = 1 ) {\n\n\t\tconst vertices = [\n\t\t\t0, 0, 0,\tsize, 0, 0,\n\t\t\t0, 0, 0,\t0, size, 0,\n\t\t\t0, 0, 0,\t0, 0, size\n\t\t];\n\n\t\tconst colors = [\n\t\t\t1, 0, 0,\t1, 0.6, 0,\n\t\t\t0, 1, 0,\t0.6, 1, 0,\n\t\t\t0, 0, 1,\t0, 0.6, 1\n\t\t];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'AxesHelper';\n\n\t}\n\n\tsetColors( xAxisColor, yAxisColor, zAxisColor ) {\n\n\t\tconst color = new Color();\n\t\tconst array = this.geometry.attributes.color.array;\n\n\t\tcolor.set( xAxisColor );\n\t\tcolor.toArray( array, 0 );\n\t\tcolor.toArray( array, 3 );\n\n\t\tcolor.set( yAxisColor );\n\t\tcolor.toArray( array, 6 );\n\t\tcolor.toArray( array, 9 );\n\n\t\tcolor.set( zAxisColor );\n\t\tcolor.toArray( array, 12 );\n\t\tcolor.toArray( array, 15 );\n\n\t\tthis.geometry.attributes.color.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass ShapePath {\n\n\tconstructor() {\n\n\t\tthis.type = 'ShapePath';\n\n\t\tthis.color = new Color();\n\n\t\tthis.subPaths = [];\n\t\tthis.currentPath = null;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPath = new Path();\n\t\tthis.subPaths.push( this.currentPath );\n\t\tthis.currentPath.moveTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tthis.currentPath.lineTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tthis.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tthis.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts ) {\n\n\t\tthis.currentPath.splineThru( pts );\n\n\t\treturn this;\n\n\t}\n\n\ttoShapes( isCCW ) {\n\n\t\tfunction toShapesNoHoles( inSubpaths ) {\n\n\t\t\tconst shapes = [];\n\n\t\t\tfor ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {\n\n\t\t\t\tconst tmpPath = inSubpaths[ i ];\n\n\t\t\t\tconst tmpShape = new Shape();\n\t\t\t\ttmpShape.curves = tmpPath.curves;\n\n\t\t\t\tshapes.push( tmpShape );\n\n\t\t\t}\n\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tfunction isPointInsidePolygon( inPt, inPolygon ) {\n\n\t\t\tconst polyLen = inPolygon.length;\n\n\t\t\t// inPt on polygon contour => immediate success or\n\t\t\t// toggling of inside/outside at every single! intersection point of an edge\n\t\t\t// with the horizontal line through inPt, left of inPt\n\t\t\t// not counting lowerY endpoints of edges and whole edges on that line\n\t\t\tlet inside = false;\n\t\t\tfor ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\n\n\t\t\t\tlet edgeLowPt = inPolygon[ p ];\n\t\t\t\tlet edgeHighPt = inPolygon[ q ];\n\n\t\t\t\tlet edgeDx = edgeHighPt.x - edgeLowPt.x;\n\t\t\t\tlet edgeDy = edgeHighPt.y - edgeLowPt.y;\n\n\t\t\t\tif ( Math.abs( edgeDy ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not parallel\n\t\t\t\t\tif ( edgeDy < 0 ) {\n\n\t\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\n\t\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\n\n\t\t\t\t\tif ( inPt.y === edgeLowPt.y ) {\n\n\t\t\t\t\t\tif ( inPt.x === edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );\n\t\t\t\t\t\tif ( perpEdge === 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\n\t\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// parallel or collinear\n\t\t\t\t\tif ( inPt.y !== edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\n\t\t\t\t\t// edge lies on the same horizontal line as inPt\n\t\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\n\t\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\n\t\t\t\t\t// continue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn\tinside;\n\n\t\t}\n\n\t\tconst isClockWise = ShapeUtils.isClockWise;\n\n\t\tconst subPaths = this.subPaths;\n\t\tif ( subPaths.length === 0 ) return [];\n\n\t\tlet solid, tmpPath, tmpShape;\n\t\tconst shapes = [];\n\n\t\tif ( subPaths.length === 1 ) {\n\n\t\t\ttmpPath = subPaths[ 0 ];\n\t\t\ttmpShape = new Shape();\n\t\t\ttmpShape.curves = tmpPath.curves;\n\t\t\tshapes.push( tmpShape );\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tlet holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );\n\t\tholesFirst = isCCW ? ! holesFirst : holesFirst;\n\n\t\t// console.log(\"Holes first\", holesFirst);\n\n\t\tconst betterShapeHoles = [];\n\t\tconst newShapes = [];\n\t\tlet newShapeHoles = [];\n\t\tlet mainIdx = 0;\n\t\tlet tmpPoints;\n\n\t\tnewShapes[ mainIdx ] = undefined;\n\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\tfor ( let i = 0, l = subPaths.length; i < l; i ++ ) {\n\n\t\t\ttmpPath = subPaths[ i ];\n\t\t\ttmpPoints = tmpPath.getPoints();\n\t\t\tsolid = isClockWise( tmpPoints );\n\t\t\tsolid = isCCW ? ! solid : solid;\n\n\t\t\tif ( solid ) {\n\n\t\t\t\tif ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) )\tmainIdx ++;\n\n\t\t\t\tnewShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };\n\t\t\t\tnewShapes[ mainIdx ].s.curves = tmpPath.curves;\n\n\t\t\t\tif ( holesFirst )\tmainIdx ++;\n\t\t\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\t\t\t//console.log('cw', i);\n\n\t\t\t} else {\n\n\t\t\t\tnewShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );\n\n\t\t\t\t//console.log('ccw', i);\n\n\t\t\t}\n\n\t\t}\n\n\t\t// only Holes? -> probably all Shapes with wrong orientation\n\t\tif ( ! newShapes[ 0 ] )\treturn\ttoShapesNoHoles( subPaths );\n\n\n\t\tif ( newShapes.length > 1 ) {\n\n\t\t\tlet ambiguous = false;\n\t\t\tlet toChange = 0;\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tbetterShapeHoles[ sIdx ] = [];\n\n\t\t\t}\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tconst sho = newShapeHoles[ sIdx ];\n\n\t\t\t\tfor ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {\n\n\t\t\t\t\tconst ho = sho[ hIdx ];\n\t\t\t\t\tlet hole_unassigned = true;\n\n\t\t\t\t\tfor ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\n\n\t\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {\n\n\t\t\t\t\t\t\tif ( sIdx !== s2Idx )\ttoChange ++;\n\n\t\t\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\t\t\thole_unassigned = false;\n\t\t\t\t\t\t\t\tbetterShapeHoles[ s2Idx ].push( ho );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tambiguous = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\tbetterShapeHoles[ sIdx ].push( ho );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( toChange > 0 && ambiguous === false ) {\n\n\t\t\t\tnewShapeHoles = betterShapeHoles;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet tmpHoles;\n\n\t\tfor ( let i = 0, il = newShapes.length; i < il; i ++ ) {\n\n\t\t\ttmpShape = newShapes[ i ].s;\n\t\t\tshapes.push( tmpShape );\n\t\t\ttmpHoles = newShapeHoles[ i ];\n\n\t\t\tfor ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\n\n\t\t\t\ttmpShape.holes.push( tmpHoles[ j ].h );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//console.log(\"shape\", shapes);\n\n\t\treturn shapes;\n\n\t}\n\n}\n\nclass WebGLMultipleRenderTargets extends WebGLRenderTarget { // @deprecated, r162\n\n\tconstructor( width = 1, height = 1, count = 1, options = {} ) {\n\n\t\tconsole.warn( 'THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the \"count\" parameter to enable MRT.' );\n\n\t\tsuper( width, height, { ...options, count } );\n\n\t\tthis.isWebGLMultipleRenderTargets = true;\n\n\t}\n\n\tget texture() {\n\n\t\treturn this.textures;\n\n\t}\n\n}\n\nif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {\n\t\trevision: REVISION,\n\t} } ) );\n\n}\n\nif ( typeof window !== 'undefined' ) {\n\n\tif ( window.__THREE__ ) {\n\n\t\tconsole.warn( 'WARNING: Multiple instances of Three.js being imported.' );\n\n\t} else {\n\n\t\twindow.__THREE__ = REVISION;\n\n\t}\n\n}\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/build/three.module.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/controls/OrbitControls.js": +/*!*******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/controls/OrbitControls.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OrbitControls: () => (/* binding */ OrbitControls)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n// OrbitControls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - left mouse / touch: one-finger move\n// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish\n// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move\n\nconst _changeEvent = { type: 'change' };\nconst _startEvent = { type: 'start' };\nconst _endEvent = { type: 'end' };\nconst _ray = new three__WEBPACK_IMPORTED_MODULE_0__.Ray();\nconst _plane = new three__WEBPACK_IMPORTED_MODULE_0__.Plane();\nconst TILT_LIMIT = Math.cos( 70 * three__WEBPACK_IMPORTED_MODULE_0__.MathUtils.DEG2RAD );\n\nclass OrbitControls extends three__WEBPACK_IMPORTED_MODULE_0__.EventDispatcher {\n\n\tconstructor( object, domElement ) {\n\n\t\tsuper();\n\n\t\tthis.object = object;\n\t\tthis.domElement = domElement;\n\t\tthis.domElement.style.touchAction = 'none'; // disable touch scroll\n\n\t\t// Set to false to disable this control\n\t\tthis.enabled = true;\n\n\t\t// \"target\" sets the location of focus, where the object orbits around\n\t\tthis.target = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n\t\t// Sets the 3D cursor (similar to Blender), from which the maxTargetRadius takes effect\n\t\tthis.cursor = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n\t\t// How far you can dolly in and out ( PerspectiveCamera only )\n\t\tthis.minDistance = 0;\n\t\tthis.maxDistance = Infinity;\n\n\t\t// How far you can zoom in and out ( OrthographicCamera only )\n\t\tthis.minZoom = 0;\n\t\tthis.maxZoom = Infinity;\n\n\t\t// Limit camera target within a spherical area around the cursor\n\t\tthis.minTargetRadius = 0;\n\t\tthis.maxTargetRadius = Infinity;\n\n\t\t// How far you can orbit vertically, upper and lower limits.\n\t\t// Range is 0 to Math.PI radians.\n\t\tthis.minPolarAngle = 0; // radians\n\t\tthis.maxPolarAngle = Math.PI; // radians\n\n\t\t// How far you can orbit horizontally, upper and lower limits.\n\t\t// If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )\n\t\tthis.minAzimuthAngle = - Infinity; // radians\n\t\tthis.maxAzimuthAngle = Infinity; // radians\n\n\t\t// Set to true to enable damping (inertia)\n\t\t// If damping is enabled, you must call controls.update() in your animation loop\n\t\tthis.enableDamping = false;\n\t\tthis.dampingFactor = 0.05;\n\n\t\t// This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n\t\t// Set to false to disable zooming\n\t\tthis.enableZoom = true;\n\t\tthis.zoomSpeed = 1.0;\n\n\t\t// Set to false to disable rotating\n\t\tthis.enableRotate = true;\n\t\tthis.rotateSpeed = 1.0;\n\n\t\t// Set to false to disable panning\n\t\tthis.enablePan = true;\n\t\tthis.panSpeed = 1.0;\n\t\tthis.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up\n\t\tthis.keyPanSpeed = 7.0;\t// pixels moved per arrow key push\n\t\tthis.zoomToCursor = false;\n\n\t\t// Set to true to automatically rotate around the target\n\t\t// If auto-rotate is enabled, you must call controls.update() in your animation loop\n\t\tthis.autoRotate = false;\n\t\tthis.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60\n\n\t\t// The four arrow keys\n\t\tthis.keys = { LEFT: 'ArrowLeft', UP: 'ArrowUp', RIGHT: 'ArrowRight', BOTTOM: 'ArrowDown' };\n\n\t\t// Mouse buttons\n\t\tthis.mouseButtons = { LEFT: three__WEBPACK_IMPORTED_MODULE_0__.MOUSE.ROTATE, MIDDLE: three__WEBPACK_IMPORTED_MODULE_0__.MOUSE.DOLLY, RIGHT: three__WEBPACK_IMPORTED_MODULE_0__.MOUSE.PAN };\n\n\t\t// Touch fingers\n\t\tthis.touches = { ONE: three__WEBPACK_IMPORTED_MODULE_0__.TOUCH.ROTATE, TWO: three__WEBPACK_IMPORTED_MODULE_0__.TOUCH.DOLLY_PAN };\n\n\t\t// for reset\n\t\tthis.target0 = this.target.clone();\n\t\tthis.position0 = this.object.position.clone();\n\t\tthis.zoom0 = this.object.zoom;\n\n\t\t// the target DOM element for key events\n\t\tthis._domElementKeyEvents = null;\n\n\t\t//\n\t\t// public methods\n\t\t//\n\n\t\tthis.getPolarAngle = function () {\n\n\t\t\treturn spherical.phi;\n\n\t\t};\n\n\t\tthis.getAzimuthalAngle = function () {\n\n\t\t\treturn spherical.theta;\n\n\t\t};\n\n\t\tthis.getDistance = function () {\n\n\t\t\treturn this.object.position.distanceTo( this.target );\n\n\t\t};\n\n\t\tthis.listenToKeyEvents = function ( domElement ) {\n\n\t\t\tdomElement.addEventListener( 'keydown', onKeyDown );\n\t\t\tthis._domElementKeyEvents = domElement;\n\n\t\t};\n\n\t\tthis.stopListenToKeyEvents = function () {\n\n\t\t\tthis._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown );\n\t\t\tthis._domElementKeyEvents = null;\n\n\t\t};\n\n\t\tthis.saveState = function () {\n\n\t\t\tscope.target0.copy( scope.target );\n\t\t\tscope.position0.copy( scope.object.position );\n\t\t\tscope.zoom0 = scope.object.zoom;\n\n\t\t};\n\n\t\tthis.reset = function () {\n\n\t\t\tscope.target.copy( scope.target0 );\n\t\t\tscope.object.position.copy( scope.position0 );\n\t\t\tscope.object.zoom = scope.zoom0;\n\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tscope.dispatchEvent( _changeEvent );\n\n\t\t\tscope.update();\n\n\t\t\tstate = STATE.NONE;\n\n\t\t};\n\n\t\t// this method is exposed, but perhaps it would be better if we can make it private...\n\t\tthis.update = function () {\n\n\t\t\tconst offset = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n\t\t\t// so camera.up is the orbit axis\n\t\t\tconst quat = new three__WEBPACK_IMPORTED_MODULE_0__.Quaternion().setFromUnitVectors( object.up, new three__WEBPACK_IMPORTED_MODULE_0__.Vector3( 0, 1, 0 ) );\n\t\t\tconst quatInverse = quat.clone().invert();\n\n\t\t\tconst lastPosition = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\t\t\tconst lastQuaternion = new three__WEBPACK_IMPORTED_MODULE_0__.Quaternion();\n\t\t\tconst lastTargetPosition = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n\t\t\tconst twoPI = 2 * Math.PI;\n\n\t\t\treturn function update( deltaTime = null ) {\n\n\t\t\t\tconst position = scope.object.position;\n\n\t\t\t\toffset.copy( position ).sub( scope.target );\n\n\t\t\t\t// rotate offset to \"y-axis-is-up\" space\n\t\t\t\toffset.applyQuaternion( quat );\n\n\t\t\t\t// angle from z-axis around y-axis\n\t\t\t\tspherical.setFromVector3( offset );\n\n\t\t\t\tif ( scope.autoRotate && state === STATE.NONE ) {\n\n\t\t\t\t\trotateLeft( getAutoRotationAngle( deltaTime ) );\n\n\t\t\t\t}\n\n\t\t\t\tif ( scope.enableDamping ) {\n\n\t\t\t\t\tspherical.theta += sphericalDelta.theta * scope.dampingFactor;\n\t\t\t\t\tspherical.phi += sphericalDelta.phi * scope.dampingFactor;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tspherical.theta += sphericalDelta.theta;\n\t\t\t\t\tspherical.phi += sphericalDelta.phi;\n\n\t\t\t\t}\n\n\t\t\t\t// restrict theta to be between desired limits\n\n\t\t\t\tlet min = scope.minAzimuthAngle;\n\t\t\t\tlet max = scope.maxAzimuthAngle;\n\n\t\t\t\tif ( isFinite( min ) && isFinite( max ) ) {\n\n\t\t\t\t\tif ( min < - Math.PI ) min += twoPI; else if ( min > Math.PI ) min -= twoPI;\n\n\t\t\t\t\tif ( max < - Math.PI ) max += twoPI; else if ( max > Math.PI ) max -= twoPI;\n\n\t\t\t\t\tif ( min <= max ) {\n\n\t\t\t\t\t\tspherical.theta = Math.max( min, Math.min( max, spherical.theta ) );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tspherical.theta = ( spherical.theta > ( min + max ) / 2 ) ?\n\t\t\t\t\t\t\tMath.max( min, spherical.theta ) :\n\t\t\t\t\t\t\tMath.min( max, spherical.theta );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// restrict phi to be between desired limits\n\t\t\t\tspherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) );\n\n\t\t\t\tspherical.makeSafe();\n\n\n\t\t\t\t// move target to panned location\n\n\t\t\t\tif ( scope.enableDamping === true ) {\n\n\t\t\t\t\tscope.target.addScaledVector( panOffset, scope.dampingFactor );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tscope.target.add( panOffset );\n\n\t\t\t\t}\n\n\t\t\t\t// Limit the target distance from the cursor to create a sphere around the center of interest\n\t\t\t\tscope.target.sub( scope.cursor );\n\t\t\t\tscope.target.clampLength( scope.minTargetRadius, scope.maxTargetRadius );\n\t\t\t\tscope.target.add( scope.cursor );\n\n\t\t\t\tlet zoomChanged = false;\n\t\t\t\t// adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera\n\t\t\t\t// we adjust zoom later in these cases\n\t\t\t\tif ( scope.zoomToCursor && performCursorZoom || scope.object.isOrthographicCamera ) {\n\n\t\t\t\t\tspherical.radius = clampDistance( spherical.radius );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst prevRadius = spherical.radius;\n\t\t\t\t\tspherical.radius = clampDistance( spherical.radius * scale );\n\t\t\t\t\tzoomChanged = prevRadius != spherical.radius;\n\n\t\t\t\t}\n\n\t\t\t\toffset.setFromSpherical( spherical );\n\n\t\t\t\t// rotate offset back to \"camera-up-vector-is-up\" space\n\t\t\t\toffset.applyQuaternion( quatInverse );\n\n\t\t\t\tposition.copy( scope.target ).add( offset );\n\n\t\t\t\tscope.object.lookAt( scope.target );\n\n\t\t\t\tif ( scope.enableDamping === true ) {\n\n\t\t\t\t\tsphericalDelta.theta *= ( 1 - scope.dampingFactor );\n\t\t\t\t\tsphericalDelta.phi *= ( 1 - scope.dampingFactor );\n\n\t\t\t\t\tpanOffset.multiplyScalar( 1 - scope.dampingFactor );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tsphericalDelta.set( 0, 0, 0 );\n\n\t\t\t\t\tpanOffset.set( 0, 0, 0 );\n\n\t\t\t\t}\n\n\t\t\t\t// adjust camera position\n\t\t\t\tif ( scope.zoomToCursor && performCursorZoom ) {\n\n\t\t\t\t\tlet newRadius = null;\n\t\t\t\t\tif ( scope.object.isPerspectiveCamera ) {\n\n\t\t\t\t\t\t// move the camera down the pointer ray\n\t\t\t\t\t\t// this method avoids floating point error\n\t\t\t\t\t\tconst prevRadius = offset.length();\n\t\t\t\t\t\tnewRadius = clampDistance( prevRadius * scale );\n\n\t\t\t\t\t\tconst radiusDelta = prevRadius - newRadius;\n\t\t\t\t\t\tscope.object.position.addScaledVector( dollyDirection, radiusDelta );\n\t\t\t\t\t\tscope.object.updateMatrixWorld();\n\n\t\t\t\t\t\tzoomChanged = !! radiusDelta;\n\n\t\t\t\t\t} else if ( scope.object.isOrthographicCamera ) {\n\n\t\t\t\t\t\t// adjust the ortho camera position based on zoom changes\n\t\t\t\t\t\tconst mouseBefore = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3( mouse.x, mouse.y, 0 );\n\t\t\t\t\t\tmouseBefore.unproject( scope.object );\n\n\t\t\t\t\t\tconst prevZoom = scope.object.zoom;\n\t\t\t\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );\n\t\t\t\t\t\tscope.object.updateProjectionMatrix();\n\n\t\t\t\t\t\tzoomChanged = prevZoom !== scope.object.zoom;\n\n\t\t\t\t\t\tconst mouseAfter = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3( mouse.x, mouse.y, 0 );\n\t\t\t\t\t\tmouseAfter.unproject( scope.object );\n\n\t\t\t\t\t\tscope.object.position.sub( mouseAfter ).add( mouseBefore );\n\t\t\t\t\t\tscope.object.updateMatrixWorld();\n\n\t\t\t\t\t\tnewRadius = offset.length();\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.' );\n\t\t\t\t\t\tscope.zoomToCursor = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// handle the placement of the target\n\t\t\t\t\tif ( newRadius !== null ) {\n\n\t\t\t\t\t\tif ( this.screenSpacePanning ) {\n\n\t\t\t\t\t\t\t// position the orbit target in front of the new camera position\n\t\t\t\t\t\t\tscope.target.set( 0, 0, - 1 )\n\t\t\t\t\t\t\t\t.transformDirection( scope.object.matrix )\n\t\t\t\t\t\t\t\t.multiplyScalar( newRadius )\n\t\t\t\t\t\t\t\t.add( scope.object.position );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// get the ray and translation plane to compute target\n\t\t\t\t\t\t\t_ray.origin.copy( scope.object.position );\n\t\t\t\t\t\t\t_ray.direction.set( 0, 0, - 1 ).transformDirection( scope.object.matrix );\n\n\t\t\t\t\t\t\t// if the camera is 20 degrees above the horizon then don't adjust the focus target to avoid\n\t\t\t\t\t\t\t// extremely large values\n\t\t\t\t\t\t\tif ( Math.abs( scope.object.up.dot( _ray.direction ) ) < TILT_LIMIT ) {\n\n\t\t\t\t\t\t\t\tobject.lookAt( scope.target );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t_plane.setFromNormalAndCoplanarPoint( scope.object.up, scope.target );\n\t\t\t\t\t\t\t\t_ray.intersectPlane( _plane, scope.target );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( scope.object.isOrthographicCamera ) {\n\n\t\t\t\t\tconst prevZoom = scope.object.zoom;\n\t\t\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) );\n\n\t\t\t\t\tif ( prevZoom !== scope.object.zoom ) {\n\n\t\t\t\t\t\tscope.object.updateProjectionMatrix();\n\t\t\t\t\t\tzoomChanged = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tscale = 1;\n\t\t\t\tperformCursorZoom = false;\n\n\t\t\t\t// update condition is:\n\t\t\t\t// min(camera displacement, camera rotation in radians)^2 > EPS\n\t\t\t\t// using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\n\t\t\t\tif ( zoomChanged ||\n\t\t\t\t\tlastPosition.distanceToSquared( scope.object.position ) > EPS ||\n\t\t\t\t\t8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ||\n\t\t\t\t\tlastTargetPosition.distanceToSquared( scope.target ) > EPS ) {\n\n\t\t\t\t\tscope.dispatchEvent( _changeEvent );\n\n\t\t\t\t\tlastPosition.copy( scope.object.position );\n\t\t\t\t\tlastQuaternion.copy( scope.object.quaternion );\n\t\t\t\t\tlastTargetPosition.copy( scope.target );\n\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\t};\n\n\t\t}();\n\n\t\tthis.dispose = function () {\n\n\t\t\tscope.domElement.removeEventListener( 'contextmenu', onContextMenu );\n\n\t\t\tscope.domElement.removeEventListener( 'pointerdown', onPointerDown );\n\t\t\tscope.domElement.removeEventListener( 'pointercancel', onPointerUp );\n\t\t\tscope.domElement.removeEventListener( 'wheel', onMouseWheel );\n\n\t\t\tscope.domElement.removeEventListener( 'pointermove', onPointerMove );\n\t\t\tscope.domElement.removeEventListener( 'pointerup', onPointerUp );\n\n\t\t\tconst document = scope.domElement.getRootNode(); // offscreen canvas compatibility\n\n\t\t\tdocument.removeEventListener( 'keydown', interceptControlDown, { capture: true } );\n\n\t\t\tif ( scope._domElementKeyEvents !== null ) {\n\n\t\t\t\tscope._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown );\n\t\t\t\tscope._domElementKeyEvents = null;\n\n\t\t\t}\n\n\t\t\t//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n\n\t\t};\n\n\t\t//\n\t\t// internals\n\t\t//\n\n\t\tconst scope = this;\n\n\t\tconst STATE = {\n\t\t\tNONE: - 1,\n\t\t\tROTATE: 0,\n\t\t\tDOLLY: 1,\n\t\t\tPAN: 2,\n\t\t\tTOUCH_ROTATE: 3,\n\t\t\tTOUCH_PAN: 4,\n\t\t\tTOUCH_DOLLY_PAN: 5,\n\t\t\tTOUCH_DOLLY_ROTATE: 6\n\t\t};\n\n\t\tlet state = STATE.NONE;\n\n\t\tconst EPS = 0.000001;\n\n\t\t// current position in spherical coordinates\n\t\tconst spherical = new three__WEBPACK_IMPORTED_MODULE_0__.Spherical();\n\t\tconst sphericalDelta = new three__WEBPACK_IMPORTED_MODULE_0__.Spherical();\n\n\t\tlet scale = 1;\n\t\tconst panOffset = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n\t\tconst rotateStart = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\t\tconst rotateEnd = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\t\tconst rotateDelta = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\n\t\tconst panStart = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\t\tconst panEnd = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\t\tconst panDelta = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\n\t\tconst dollyStart = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\t\tconst dollyEnd = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\t\tconst dollyDelta = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\n\t\tconst dollyDirection = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\t\tconst mouse = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\t\tlet performCursorZoom = false;\n\n\t\tconst pointers = [];\n\t\tconst pointerPositions = {};\n\n\t\tlet controlActive = false;\n\n\t\tfunction getAutoRotationAngle( deltaTime ) {\n\n\t\t\tif ( deltaTime !== null ) {\n\n\t\t\t\treturn ( 2 * Math.PI / 60 * scope.autoRotateSpeed ) * deltaTime;\n\n\t\t\t} else {\n\n\t\t\t\treturn 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction getZoomScale( delta ) {\n\n\t\t\tconst normalizedDelta = Math.abs( delta * 0.01 );\n\t\t\treturn Math.pow( 0.95, scope.zoomSpeed * normalizedDelta );\n\n\t\t}\n\n\t\tfunction rotateLeft( angle ) {\n\n\t\t\tsphericalDelta.theta -= angle;\n\n\t\t}\n\n\t\tfunction rotateUp( angle ) {\n\n\t\t\tsphericalDelta.phi -= angle;\n\n\t\t}\n\n\t\tconst panLeft = function () {\n\n\t\t\tconst v = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n\t\t\treturn function panLeft( distance, objectMatrix ) {\n\n\t\t\t\tv.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix\n\t\t\t\tv.multiplyScalar( - distance );\n\n\t\t\t\tpanOffset.add( v );\n\n\t\t\t};\n\n\t\t}();\n\n\t\tconst panUp = function () {\n\n\t\t\tconst v = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n\t\t\treturn function panUp( distance, objectMatrix ) {\n\n\t\t\t\tif ( scope.screenSpacePanning === true ) {\n\n\t\t\t\t\tv.setFromMatrixColumn( objectMatrix, 1 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tv.setFromMatrixColumn( objectMatrix, 0 );\n\t\t\t\t\tv.crossVectors( scope.object.up, v );\n\n\t\t\t\t}\n\n\t\t\t\tv.multiplyScalar( distance );\n\n\t\t\t\tpanOffset.add( v );\n\n\t\t\t};\n\n\t\t}();\n\n\t\t// deltaX and deltaY are in pixels; right and down are positive\n\t\tconst pan = function () {\n\n\t\t\tconst offset = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n\t\t\treturn function pan( deltaX, deltaY ) {\n\n\t\t\t\tconst element = scope.domElement;\n\n\t\t\t\tif ( scope.object.isPerspectiveCamera ) {\n\n\t\t\t\t\t// perspective\n\t\t\t\t\tconst position = scope.object.position;\n\t\t\t\t\toffset.copy( position ).sub( scope.target );\n\t\t\t\t\tlet targetDistance = offset.length();\n\n\t\t\t\t\t// half of the fov is center to top of screen\n\t\t\t\t\ttargetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );\n\n\t\t\t\t\t// we use only clientHeight here so aspect ratio does not distort speed\n\t\t\t\t\tpanLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix );\n\t\t\t\t\tpanUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix );\n\n\t\t\t\t} else if ( scope.object.isOrthographicCamera ) {\n\n\t\t\t\t\t// orthographic\n\t\t\t\t\tpanLeft( deltaX * ( scope.object.right - scope.object.left ) / scope.object.zoom / element.clientWidth, scope.object.matrix );\n\t\t\t\t\tpanUp( deltaY * ( scope.object.top - scope.object.bottom ) / scope.object.zoom / element.clientHeight, scope.object.matrix );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// camera neither orthographic nor perspective\n\t\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );\n\t\t\t\t\tscope.enablePan = false;\n\n\t\t\t\t}\n\n\t\t\t};\n\n\t\t}();\n\n\t\tfunction dollyOut( dollyScale ) {\n\n\t\t\tif ( scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera ) {\n\n\t\t\t\tscale /= dollyScale;\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\t\tscope.enableZoom = false;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction dollyIn( dollyScale ) {\n\n\t\t\tif ( scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera ) {\n\n\t\t\t\tscale *= dollyScale;\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\t\tscope.enableZoom = false;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction updateZoomParameters( x, y ) {\n\n\t\t\tif ( ! scope.zoomToCursor ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tperformCursorZoom = true;\n\n\t\t\tconst rect = scope.domElement.getBoundingClientRect();\n\t\t\tconst dx = x - rect.left;\n\t\t\tconst dy = y - rect.top;\n\t\t\tconst w = rect.width;\n\t\t\tconst h = rect.height;\n\n\t\t\tmouse.x = ( dx / w ) * 2 - 1;\n\t\t\tmouse.y = - ( dy / h ) * 2 + 1;\n\n\t\t\tdollyDirection.set( mouse.x, mouse.y, 1 ).unproject( scope.object ).sub( scope.object.position ).normalize();\n\n\t\t}\n\n\t\tfunction clampDistance( dist ) {\n\n\t\t\treturn Math.max( scope.minDistance, Math.min( scope.maxDistance, dist ) );\n\n\t\t}\n\n\t\t//\n\t\t// event callbacks - update the object state\n\t\t//\n\n\t\tfunction handleMouseDownRotate( event ) {\n\n\t\t\trotateStart.set( event.clientX, event.clientY );\n\n\t\t}\n\n\t\tfunction handleMouseDownDolly( event ) {\n\n\t\t\tupdateZoomParameters( event.clientX, event.clientX );\n\t\t\tdollyStart.set( event.clientX, event.clientY );\n\n\t\t}\n\n\t\tfunction handleMouseDownPan( event ) {\n\n\t\t\tpanStart.set( event.clientX, event.clientY );\n\n\t\t}\n\n\t\tfunction handleMouseMoveRotate( event ) {\n\n\t\t\trotateEnd.set( event.clientX, event.clientY );\n\n\t\t\trotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );\n\n\t\t\tconst element = scope.domElement;\n\n\t\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height\n\n\t\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );\n\n\t\t\trotateStart.copy( rotateEnd );\n\n\t\t\tscope.update();\n\n\t\t}\n\n\t\tfunction handleMouseMoveDolly( event ) {\n\n\t\t\tdollyEnd.set( event.clientX, event.clientY );\n\n\t\t\tdollyDelta.subVectors( dollyEnd, dollyStart );\n\n\t\t\tif ( dollyDelta.y > 0 ) {\n\n\t\t\t\tdollyOut( getZoomScale( dollyDelta.y ) );\n\n\t\t\t} else if ( dollyDelta.y < 0 ) {\n\n\t\t\t\tdollyIn( getZoomScale( dollyDelta.y ) );\n\n\t\t\t}\n\n\t\t\tdollyStart.copy( dollyEnd );\n\n\t\t\tscope.update();\n\n\t\t}\n\n\t\tfunction handleMouseMovePan( event ) {\n\n\t\t\tpanEnd.set( event.clientX, event.clientY );\n\n\t\t\tpanDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );\n\n\t\t\tpan( panDelta.x, panDelta.y );\n\n\t\t\tpanStart.copy( panEnd );\n\n\t\t\tscope.update();\n\n\t\t}\n\n\t\tfunction handleMouseWheel( event ) {\n\n\t\t\tupdateZoomParameters( event.clientX, event.clientY );\n\n\t\t\tif ( event.deltaY < 0 ) {\n\n\t\t\t\tdollyIn( getZoomScale( event.deltaY ) );\n\n\t\t\t} else if ( event.deltaY > 0 ) {\n\n\t\t\t\tdollyOut( getZoomScale( event.deltaY ) );\n\n\t\t\t}\n\n\t\t\tscope.update();\n\n\t\t}\n\n\t\tfunction handleKeyDown( event ) {\n\n\t\t\tlet needsUpdate = false;\n\n\t\t\tswitch ( event.code ) {\n\n\t\t\t\tcase scope.keys.UP:\n\n\t\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\t\trotateUp( 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpan( 0, scope.keyPanSpeed );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tneedsUpdate = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase scope.keys.BOTTOM:\n\n\t\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\t\trotateUp( - 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpan( 0, - scope.keyPanSpeed );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tneedsUpdate = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase scope.keys.LEFT:\n\n\t\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\t\trotateLeft( 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpan( scope.keyPanSpeed, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tneedsUpdate = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase scope.keys.RIGHT:\n\n\t\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\t\trotateLeft( - 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpan( - scope.keyPanSpeed, 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tneedsUpdate = true;\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( needsUpdate ) {\n\n\t\t\t\t// prevent the browser from scrolling on cursor keys\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tscope.update();\n\n\t\t\t}\n\n\n\t\t}\n\n\t\tfunction handleTouchStartRotate( event ) {\n\n\t\t\tif ( pointers.length === 1 ) {\n\n\t\t\t\trotateStart.set( event.pageX, event.pageY );\n\n\t\t\t} else {\n\n\t\t\t\tconst position = getSecondPointerPosition( event );\n\n\t\t\t\tconst x = 0.5 * ( event.pageX + position.x );\n\t\t\t\tconst y = 0.5 * ( event.pageY + position.y );\n\n\t\t\t\trotateStart.set( x, y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction handleTouchStartPan( event ) {\n\n\t\t\tif ( pointers.length === 1 ) {\n\n\t\t\t\tpanStart.set( event.pageX, event.pageY );\n\n\t\t\t} else {\n\n\t\t\t\tconst position = getSecondPointerPosition( event );\n\n\t\t\t\tconst x = 0.5 * ( event.pageX + position.x );\n\t\t\t\tconst y = 0.5 * ( event.pageY + position.y );\n\n\t\t\t\tpanStart.set( x, y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction handleTouchStartDolly( event ) {\n\n\t\t\tconst position = getSecondPointerPosition( event );\n\n\t\t\tconst dx = event.pageX - position.x;\n\t\t\tconst dy = event.pageY - position.y;\n\n\t\t\tconst distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\t\tdollyStart.set( 0, distance );\n\n\t\t}\n\n\t\tfunction handleTouchStartDollyPan( event ) {\n\n\t\t\tif ( scope.enableZoom ) handleTouchStartDolly( event );\n\n\t\t\tif ( scope.enablePan ) handleTouchStartPan( event );\n\n\t\t}\n\n\t\tfunction handleTouchStartDollyRotate( event ) {\n\n\t\t\tif ( scope.enableZoom ) handleTouchStartDolly( event );\n\n\t\t\tif ( scope.enableRotate ) handleTouchStartRotate( event );\n\n\t\t}\n\n\t\tfunction handleTouchMoveRotate( event ) {\n\n\t\t\tif ( pointers.length == 1 ) {\n\n\t\t\t\trotateEnd.set( event.pageX, event.pageY );\n\n\t\t\t} else {\n\n\t\t\t\tconst position = getSecondPointerPosition( event );\n\n\t\t\t\tconst x = 0.5 * ( event.pageX + position.x );\n\t\t\t\tconst y = 0.5 * ( event.pageY + position.y );\n\n\t\t\t\trotateEnd.set( x, y );\n\n\t\t\t}\n\n\t\t\trotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed );\n\n\t\t\tconst element = scope.domElement;\n\n\t\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height\n\n\t\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );\n\n\t\t\trotateStart.copy( rotateEnd );\n\n\t\t}\n\n\t\tfunction handleTouchMovePan( event ) {\n\n\t\t\tif ( pointers.length === 1 ) {\n\n\t\t\t\tpanEnd.set( event.pageX, event.pageY );\n\n\t\t\t} else {\n\n\t\t\t\tconst position = getSecondPointerPosition( event );\n\n\t\t\t\tconst x = 0.5 * ( event.pageX + position.x );\n\t\t\t\tconst y = 0.5 * ( event.pageY + position.y );\n\n\t\t\t\tpanEnd.set( x, y );\n\n\t\t\t}\n\n\t\t\tpanDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed );\n\n\t\t\tpan( panDelta.x, panDelta.y );\n\n\t\t\tpanStart.copy( panEnd );\n\n\t\t}\n\n\t\tfunction handleTouchMoveDolly( event ) {\n\n\t\t\tconst position = getSecondPointerPosition( event );\n\n\t\t\tconst dx = event.pageX - position.x;\n\t\t\tconst dy = event.pageY - position.y;\n\n\t\t\tconst distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\t\tdollyEnd.set( 0, distance );\n\n\t\t\tdollyDelta.set( 0, Math.pow( dollyEnd.y / dollyStart.y, scope.zoomSpeed ) );\n\n\t\t\tdollyOut( dollyDelta.y );\n\n\t\t\tdollyStart.copy( dollyEnd );\n\n\t\t\tconst centerX = ( event.pageX + position.x ) * 0.5;\n\t\t\tconst centerY = ( event.pageY + position.y ) * 0.5;\n\n\t\t\tupdateZoomParameters( centerX, centerY );\n\n\t\t}\n\n\t\tfunction handleTouchMoveDollyPan( event ) {\n\n\t\t\tif ( scope.enableZoom ) handleTouchMoveDolly( event );\n\n\t\t\tif ( scope.enablePan ) handleTouchMovePan( event );\n\n\t\t}\n\n\t\tfunction handleTouchMoveDollyRotate( event ) {\n\n\t\t\tif ( scope.enableZoom ) handleTouchMoveDolly( event );\n\n\t\t\tif ( scope.enableRotate ) handleTouchMoveRotate( event );\n\n\t\t}\n\n\t\t//\n\t\t// event handlers - FSM: listen for events and reset state\n\t\t//\n\n\t\tfunction onPointerDown( event ) {\n\n\t\t\tif ( scope.enabled === false ) return;\n\n\t\t\tif ( pointers.length === 0 ) {\n\n\t\t\t\tscope.domElement.setPointerCapture( event.pointerId );\n\n\t\t\t\tscope.domElement.addEventListener( 'pointermove', onPointerMove );\n\t\t\t\tscope.domElement.addEventListener( 'pointerup', onPointerUp );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( isTrackingPointer( event ) ) return;\n\n\t\t\t//\n\n\t\t\taddPointer( event );\n\n\t\t\tif ( event.pointerType === 'touch' ) {\n\n\t\t\t\tonTouchStart( event );\n\n\t\t\t} else {\n\n\t\t\t\tonMouseDown( event );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onPointerMove( event ) {\n\n\t\t\tif ( scope.enabled === false ) return;\n\n\t\t\tif ( event.pointerType === 'touch' ) {\n\n\t\t\t\tonTouchMove( event );\n\n\t\t\t} else {\n\n\t\t\t\tonMouseMove( event );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onPointerUp( event ) {\n\n\t\t\tremovePointer( event );\n\n\t\t\tswitch ( pointers.length ) {\n\n\t\t\t\tcase 0:\n\n\t\t\t\t\tscope.domElement.releasePointerCapture( event.pointerId );\n\n\t\t\t\t\tscope.domElement.removeEventListener( 'pointermove', onPointerMove );\n\t\t\t\t\tscope.domElement.removeEventListener( 'pointerup', onPointerUp );\n\n\t\t\t\t\tscope.dispatchEvent( _endEvent );\n\n\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 1:\n\n\t\t\t\t\tconst pointerId = pointers[ 0 ];\n\t\t\t\t\tconst position = pointerPositions[ pointerId ];\n\n\t\t\t\t\t// minimal placeholder event - allows state correction on pointer-up\n\t\t\t\t\tonTouchStart( { pointerId: pointerId, pageX: position.x, pageY: position.y } );\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onMouseDown( event ) {\n\n\t\t\tlet mouseAction;\n\n\t\t\tswitch ( event.button ) {\n\n\t\t\t\tcase 0:\n\n\t\t\t\t\tmouseAction = scope.mouseButtons.LEFT;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 1:\n\n\t\t\t\t\tmouseAction = scope.mouseButtons.MIDDLE;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2:\n\n\t\t\t\t\tmouseAction = scope.mouseButtons.RIGHT;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tmouseAction = - 1;\n\n\t\t\t}\n\n\t\t\tswitch ( mouseAction ) {\n\n\t\t\t\tcase three__WEBPACK_IMPORTED_MODULE_0__.MOUSE.DOLLY:\n\n\t\t\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\t\t\thandleMouseDownDolly( event );\n\n\t\t\t\t\tstate = STATE.DOLLY;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase three__WEBPACK_IMPORTED_MODULE_0__.MOUSE.ROTATE:\n\n\t\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\t\thandleMouseDownPan( event );\n\n\t\t\t\t\t\tstate = STATE.PAN;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\t\thandleMouseDownRotate( event );\n\n\t\t\t\t\t\tstate = STATE.ROTATE;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase three__WEBPACK_IMPORTED_MODULE_0__.MOUSE.PAN:\n\n\t\t\t\t\tif ( event.ctrlKey || event.metaKey || event.shiftKey ) {\n\n\t\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\t\thandleMouseDownRotate( event );\n\n\t\t\t\t\t\tstate = STATE.ROTATE;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\t\thandleMouseDownPan( event );\n\n\t\t\t\t\t\tstate = STATE.PAN;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t}\n\n\t\t\tif ( state !== STATE.NONE ) {\n\n\t\t\t\tscope.dispatchEvent( _startEvent );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onMouseMove( event ) {\n\n\t\t\tswitch ( state ) {\n\n\t\t\t\tcase STATE.ROTATE:\n\n\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\thandleMouseMoveRotate( event );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase STATE.DOLLY:\n\n\t\t\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\t\t\thandleMouseMoveDolly( event );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase STATE.PAN:\n\n\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\thandleMouseMovePan( event );\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onMouseWheel( event ) {\n\n\t\t\tif ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;\n\n\t\t\tevent.preventDefault();\n\n\t\t\tscope.dispatchEvent( _startEvent );\n\n\t\t\thandleMouseWheel( customWheelEvent( event ) );\n\n\t\t\tscope.dispatchEvent( _endEvent );\n\n\t\t}\n\n\t\tfunction customWheelEvent( event ) {\n\n\t\t\tconst mode = event.deltaMode;\n\n\t\t\t// minimal wheel event altered to meet delta-zoom demand\n\t\t\tconst newEvent = {\n\t\t\t\tclientX: event.clientX,\n\t\t\t\tclientY: event.clientY,\n\t\t\t\tdeltaY: event.deltaY,\n\t\t\t};\n\n\t\t\tswitch ( mode ) {\n\n\t\t\t\tcase 1: // LINE_MODE\n\t\t\t\t\tnewEvent.deltaY *= 16;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2: // PAGE_MODE\n\t\t\t\t\tnewEvent.deltaY *= 100;\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\t// detect if event was triggered by pinching\n\t\t\tif ( event.ctrlKey && ! controlActive ) {\n\n\t\t\t\tnewEvent.deltaY *= 10;\n\n\t\t\t}\n\n\t\t\treturn newEvent;\n\n\t\t}\n\n\t\tfunction interceptControlDown( event ) {\n\n\t\t\tif ( event.key === 'Control' ) {\n\n\t\t\t\tcontrolActive = true;\n\n\n\t\t\t\tconst document = scope.domElement.getRootNode(); // offscreen canvas compatibility\n\n\t\t\t\tdocument.addEventListener( 'keyup', interceptControlUp, { passive: true, capture: true } );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction interceptControlUp( event ) {\n\n\t\t\tif ( event.key === 'Control' ) {\n\n\t\t\t\tcontrolActive = false;\n\n\n\t\t\t\tconst document = scope.domElement.getRootNode(); // offscreen canvas compatibility\n\n\t\t\t\tdocument.removeEventListener( 'keyup', interceptControlUp, { passive: true, capture: true } );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onKeyDown( event ) {\n\n\t\t\tif ( scope.enabled === false || scope.enablePan === false ) return;\n\n\t\t\thandleKeyDown( event );\n\n\t\t}\n\n\t\tfunction onTouchStart( event ) {\n\n\t\t\ttrackPointer( event );\n\n\t\t\tswitch ( pointers.length ) {\n\n\t\t\t\tcase 1:\n\n\t\t\t\t\tswitch ( scope.touches.ONE ) {\n\n\t\t\t\t\t\tcase three__WEBPACK_IMPORTED_MODULE_0__.TOUCH.ROTATE:\n\n\t\t\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\t\t\thandleTouchStartRotate( event );\n\n\t\t\t\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase three__WEBPACK_IMPORTED_MODULE_0__.TOUCH.PAN:\n\n\t\t\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\t\t\thandleTouchStartPan( event );\n\n\t\t\t\t\t\t\tstate = STATE.TOUCH_PAN;\n\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2:\n\n\t\t\t\t\tswitch ( scope.touches.TWO ) {\n\n\t\t\t\t\t\tcase three__WEBPACK_IMPORTED_MODULE_0__.TOUCH.DOLLY_PAN:\n\n\t\t\t\t\t\t\tif ( scope.enableZoom === false && scope.enablePan === false ) return;\n\n\t\t\t\t\t\t\thandleTouchStartDollyPan( event );\n\n\t\t\t\t\t\t\tstate = STATE.TOUCH_DOLLY_PAN;\n\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase three__WEBPACK_IMPORTED_MODULE_0__.TOUCH.DOLLY_ROTATE:\n\n\t\t\t\t\t\t\tif ( scope.enableZoom === false && scope.enableRotate === false ) return;\n\n\t\t\t\t\t\t\thandleTouchStartDollyRotate( event );\n\n\t\t\t\t\t\t\tstate = STATE.TOUCH_DOLLY_ROTATE;\n\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t}\n\n\t\t\tif ( state !== STATE.NONE ) {\n\n\t\t\t\tscope.dispatchEvent( _startEvent );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onTouchMove( event ) {\n\n\t\t\ttrackPointer( event );\n\n\t\t\tswitch ( state ) {\n\n\t\t\t\tcase STATE.TOUCH_ROTATE:\n\n\t\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\t\thandleTouchMoveRotate( event );\n\n\t\t\t\t\tscope.update();\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase STATE.TOUCH_PAN:\n\n\t\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\t\thandleTouchMovePan( event );\n\n\t\t\t\t\tscope.update();\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase STATE.TOUCH_DOLLY_PAN:\n\n\t\t\t\t\tif ( scope.enableZoom === false && scope.enablePan === false ) return;\n\n\t\t\t\t\thandleTouchMoveDollyPan( event );\n\n\t\t\t\t\tscope.update();\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase STATE.TOUCH_DOLLY_ROTATE:\n\n\t\t\t\t\tif ( scope.enableZoom === false && scope.enableRotate === false ) return;\n\n\t\t\t\t\thandleTouchMoveDollyRotate( event );\n\n\t\t\t\t\tscope.update();\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tstate = STATE.NONE;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onContextMenu( event ) {\n\n\t\t\tif ( scope.enabled === false ) return;\n\n\t\t\tevent.preventDefault();\n\n\t\t}\n\n\t\tfunction addPointer( event ) {\n\n\t\t\tpointers.push( event.pointerId );\n\n\t\t}\n\n\t\tfunction removePointer( event ) {\n\n\t\t\tdelete pointerPositions[ event.pointerId ];\n\n\t\t\tfor ( let i = 0; i < pointers.length; i ++ ) {\n\n\t\t\t\tif ( pointers[ i ] == event.pointerId ) {\n\n\t\t\t\t\tpointers.splice( i, 1 );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction isTrackingPointer( event ) {\n\n\t\t\tfor ( let i = 0; i < pointers.length; i ++ ) {\n\n\t\t\t\tif ( pointers[ i ] == event.pointerId ) return true;\n\n\t\t\t}\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\tfunction trackPointer( event ) {\n\n\t\t\tlet position = pointerPositions[ event.pointerId ];\n\n\t\t\tif ( position === undefined ) {\n\n\t\t\t\tposition = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\t\t\t\tpointerPositions[ event.pointerId ] = position;\n\n\t\t\t}\n\n\t\t\tposition.set( event.pageX, event.pageY );\n\n\t\t}\n\n\t\tfunction getSecondPointerPosition( event ) {\n\n\t\t\tconst pointerId = ( event.pointerId === pointers[ 0 ] ) ? pointers[ 1 ] : pointers[ 0 ];\n\n\t\t\treturn pointerPositions[ pointerId ];\n\n\t\t}\n\n\t\t//\n\n\t\tscope.domElement.addEventListener( 'contextmenu', onContextMenu );\n\n\t\tscope.domElement.addEventListener( 'pointerdown', onPointerDown );\n\t\tscope.domElement.addEventListener( 'pointercancel', onPointerUp );\n\t\tscope.domElement.addEventListener( 'wheel', onMouseWheel, { passive: false } );\n\n\t\tconst document = scope.domElement.getRootNode(); // offscreen canvas compatibility\n\n\t\tdocument.addEventListener( 'keydown', interceptControlDown, { passive: true, capture: true } );\n\n\t\t// force an update at start\n\n\t\tthis.update();\n\n\t}\n\n}\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/controls/OrbitControls.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/lights/IESSpotLight.js": +/*!****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/lights/IESSpotLight.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\nclass IESSpotLight extends three__WEBPACK_IMPORTED_MODULE_0__.SpotLight {\n\n\tconstructor( color, intensity, distance, angle, penumbra, decay ) {\n\n\t\tsuper( color, intensity, distance, angle, penumbra, decay );\n\n\t\tthis.iesMap = null;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.iesMap = source.iesMap;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (IESSpotLight);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/lights/IESSpotLight.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/Nodes.js": +/*!********************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/Nodes.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AONode: () => (/* reexport safe */ _lighting_AONode_js__WEBPACK_IMPORTED_MODULE_128__[\"default\"]),\n/* harmony export */ AfterImageNode: () => (/* reexport safe */ _display_AfterImageNode_js__WEBPACK_IMPORTED_MODULE_103__[\"default\"]),\n/* harmony export */ AmbientLightNode: () => (/* reexport safe */ _lighting_AmbientLightNode_js__WEBPACK_IMPORTED_MODULE_122__[\"default\"]),\n/* harmony export */ AnalyticLightNode: () => (/* reexport safe */ _lighting_AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_129__[\"default\"]),\n/* harmony export */ AnamorphicNode: () => (/* reexport safe */ _display_AnamorphicNode_js__WEBPACK_IMPORTED_MODULE_104__[\"default\"]),\n/* harmony export */ ArrayElementNode: () => (/* reexport safe */ _utils_ArrayElementNode_js__WEBPACK_IMPORTED_MODULE_36__[\"default\"]),\n/* harmony export */ AssignNode: () => (/* reexport safe */ _core_AssignNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]),\n/* harmony export */ AttributeNode: () => (/* reexport safe */ _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]),\n/* harmony export */ BRDF_GGX: () => (/* reexport safe */ _functions_BSDF_BRDF_GGX_js__WEBPACK_IMPORTED_MODULE_139__[\"default\"]),\n/* harmony export */ BRDF_Lambert: () => (/* reexport safe */ _functions_BSDF_BRDF_Lambert_js__WEBPACK_IMPORTED_MODULE_140__[\"default\"]),\n/* harmony export */ BatchNode: () => (/* reexport safe */ _accessors_BatchNode_js__WEBPACK_IMPORTED_MODULE_67__[\"default\"]),\n/* harmony export */ BitangentNode: () => (/* reexport safe */ _accessors_BitangentNode_js__WEBPACK_IMPORTED_MODULE_60__[\"default\"]),\n/* harmony export */ BlendModeNode: () => (/* reexport safe */ _display_BlendModeNode_js__WEBPACK_IMPORTED_MODULE_89__[\"default\"]),\n/* harmony export */ Break: () => (/* reexport safe */ _utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_42__.Break),\n/* harmony export */ BufferAttributeNode: () => (/* reexport safe */ _accessors_BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_61__[\"default\"]),\n/* harmony export */ BufferNode: () => (/* reexport safe */ _accessors_BufferNode_js__WEBPACK_IMPORTED_MODULE_62__[\"default\"]),\n/* harmony export */ BumpMapNode: () => (/* reexport safe */ _display_BumpMapNode_js__WEBPACK_IMPORTED_MODULE_90__[\"default\"]),\n/* harmony export */ BypassNode: () => (/* reexport safe */ _core_BypassNode_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]),\n/* harmony export */ CacheNode: () => (/* reexport safe */ _core_CacheNode_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]),\n/* harmony export */ CameraNode: () => (/* reexport safe */ _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_63__[\"default\"]),\n/* harmony export */ CheckerNode: () => (/* reexport safe */ _procedural_CheckerNode_js__WEBPACK_IMPORTED_MODULE_132__[\"default\"]),\n/* harmony export */ CodeNode: () => (/* reexport safe */ _code_CodeNode_js__WEBPACK_IMPORTED_MODULE_107__[\"default\"]),\n/* harmony export */ ColorAdjustmentNode: () => (/* reexport safe */ _display_ColorAdjustmentNode_js__WEBPACK_IMPORTED_MODULE_91__[\"default\"]),\n/* harmony export */ ColorSpaceNode: () => (/* reexport safe */ _display_ColorSpaceNode_js__WEBPACK_IMPORTED_MODULE_92__[\"default\"]),\n/* harmony export */ ComputeNode: () => (/* reexport safe */ _gpgpu_ComputeNode_js__WEBPACK_IMPORTED_MODULE_116__[\"default\"]),\n/* harmony export */ CondNode: () => (/* reexport safe */ _math_CondNode_js__WEBPACK_IMPORTED_MODULE_32__[\"default\"]),\n/* harmony export */ ConstNode: () => (/* reexport safe */ _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]),\n/* harmony export */ ContextNode: () => (/* reexport safe */ _core_ContextNode_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]),\n/* harmony export */ Continue: () => (/* reexport safe */ _utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_42__.Continue),\n/* harmony export */ ConvertNode: () => (/* reexport safe */ _utils_ConvertNode_js__WEBPACK_IMPORTED_MODULE_37__[\"default\"]),\n/* harmony export */ CubeTextureNode: () => (/* reexport safe */ _accessors_CubeTextureNode_js__WEBPACK_IMPORTED_MODULE_65__[\"default\"]),\n/* harmony export */ DFGApprox: () => (/* reexport safe */ _functions_BSDF_DFGApprox_js__WEBPACK_IMPORTED_MODULE_142__[\"default\"]),\n/* harmony export */ D_GGX: () => (/* reexport safe */ _functions_BSDF_D_GGX_js__WEBPACK_IMPORTED_MODULE_141__[\"default\"]),\n/* harmony export */ DirectionalLightNode: () => (/* reexport safe */ _lighting_DirectionalLightNode_js__WEBPACK_IMPORTED_MODULE_119__[\"default\"]),\n/* harmony export */ DiscardNode: () => (/* reexport safe */ _utils_DiscardNode_js__WEBPACK_IMPORTED_MODULE_38__[\"default\"]),\n/* harmony export */ EPSILON: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.EPSILON),\n/* harmony export */ EnvironmentNode: () => (/* reexport safe */ _lighting_EnvironmentNode_js__WEBPACK_IMPORTED_MODULE_127__[\"default\"]),\n/* harmony export */ EquirectUVNode: () => (/* reexport safe */ _utils_EquirectUVNode_js__WEBPACK_IMPORTED_MODULE_39__[\"default\"]),\n/* harmony export */ ExpressionNode: () => (/* reexport safe */ _code_ExpressionNode_js__WEBPACK_IMPORTED_MODULE_106__[\"default\"]),\n/* harmony export */ F_Schlick: () => (/* reexport safe */ _functions_BSDF_F_Schlick_js__WEBPACK_IMPORTED_MODULE_143__[\"default\"]),\n/* harmony export */ FogExp2Node: () => (/* reexport safe */ _fog_FogExp2Node_js__WEBPACK_IMPORTED_MODULE_114__[\"default\"]),\n/* harmony export */ FogNode: () => (/* reexport safe */ _fog_FogNode_js__WEBPACK_IMPORTED_MODULE_112__[\"default\"]),\n/* harmony export */ FogRangeNode: () => (/* reexport safe */ _fog_FogRangeNode_js__WEBPACK_IMPORTED_MODULE_113__[\"default\"]),\n/* harmony export */ FrontFacingNode: () => (/* reexport safe */ _display_FrontFacingNode_js__WEBPACK_IMPORTED_MODULE_93__[\"default\"]),\n/* harmony export */ FunctionCallNode: () => (/* reexport safe */ _code_FunctionCallNode_js__WEBPACK_IMPORTED_MODULE_108__[\"default\"]),\n/* harmony export */ FunctionNode: () => (/* reexport safe */ _code_FunctionNode_js__WEBPACK_IMPORTED_MODULE_109__[\"default\"]),\n/* harmony export */ FunctionOverloadingNode: () => (/* reexport safe */ _utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_40__[\"default\"]),\n/* harmony export */ GLSLNodeParser: () => (/* reexport safe */ _parsers_GLSLNodeParser_js__WEBPACK_IMPORTED_MODULE_136__[\"default\"]),\n/* harmony export */ GaussianBlurNode: () => (/* reexport safe */ _display_GaussianBlurNode_js__WEBPACK_IMPORTED_MODULE_102__[\"default\"]),\n/* harmony export */ HashNode: () => (/* reexport safe */ _math_HashNode_js__WEBPACK_IMPORTED_MODULE_33__[\"default\"]),\n/* harmony export */ HemisphereLightNode: () => (/* reexport safe */ _lighting_HemisphereLightNode_js__WEBPACK_IMPORTED_MODULE_126__[\"default\"]),\n/* harmony export */ IESSpotLightNode: () => (/* reexport safe */ _lighting_IESSpotLightNode_js__WEBPACK_IMPORTED_MODULE_121__[\"default\"]),\n/* harmony export */ INFINITY: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.INFINITY),\n/* harmony export */ If: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.If),\n/* harmony export */ IndexNode: () => (/* reexport safe */ _core_IndexNode_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]),\n/* harmony export */ InstanceNode: () => (/* reexport safe */ _accessors_InstanceNode_js__WEBPACK_IMPORTED_MODULE_66__[\"default\"]),\n/* harmony export */ InstancedPointsNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.InstancedPointsNodeMaterial),\n/* harmony export */ JoinNode: () => (/* reexport safe */ _utils_JoinNode_js__WEBPACK_IMPORTED_MODULE_41__[\"default\"]),\n/* harmony export */ LightNode: () => (/* reexport safe */ _lighting_LightNode_js__WEBPACK_IMPORTED_MODULE_117__[\"default\"]),\n/* harmony export */ LightingContextNode: () => (/* reexport safe */ _lighting_LightingContextNode_js__WEBPACK_IMPORTED_MODULE_125__[\"default\"]),\n/* harmony export */ LightingModel: () => (/* reexport safe */ _core_LightingModel_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]),\n/* harmony export */ LightingNode: () => (/* reexport safe */ _lighting_LightingNode_js__WEBPACK_IMPORTED_MODULE_124__[\"default\"]),\n/* harmony export */ LightsNode: () => (/* reexport safe */ _lighting_LightsNode_js__WEBPACK_IMPORTED_MODULE_123__[\"default\"]),\n/* harmony export */ Line2NodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.Line2NodeMaterial),\n/* harmony export */ LineBasicNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.LineBasicNodeMaterial),\n/* harmony export */ LineDashedNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.LineDashedNodeMaterial),\n/* harmony export */ LoopNode: () => (/* reexport safe */ _utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_42__[\"default\"]),\n/* harmony export */ MatcapUVNode: () => (/* reexport safe */ _utils_MatcapUVNode_js__WEBPACK_IMPORTED_MODULE_43__[\"default\"]),\n/* harmony export */ MaterialNode: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__[\"default\"]),\n/* harmony export */ MaterialReferenceNode: () => (/* reexport safe */ _accessors_MaterialReferenceNode_js__WEBPACK_IMPORTED_MODULE_69__[\"default\"]),\n/* harmony export */ MathNode: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__[\"default\"]),\n/* harmony export */ MaxMipLevelNode: () => (/* reexport safe */ _utils_MaxMipLevelNode_js__WEBPACK_IMPORTED_MODULE_44__[\"default\"]),\n/* harmony export */ MeshBasicNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.MeshBasicNodeMaterial),\n/* harmony export */ MeshLambertNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.MeshLambertNodeMaterial),\n/* harmony export */ MeshNormalNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.MeshNormalNodeMaterial),\n/* harmony export */ MeshPhongNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.MeshPhongNodeMaterial),\n/* harmony export */ MeshPhysicalNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.MeshPhysicalNodeMaterial),\n/* harmony export */ MeshSSSNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.MeshSSSNodeMaterial),\n/* harmony export */ MeshStandardNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.MeshStandardNodeMaterial),\n/* harmony export */ ModelNode: () => (/* reexport safe */ _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_73__[\"default\"]),\n/* harmony export */ ModelViewProjectionNode: () => (/* reexport safe */ _accessors_ModelViewProjectionNode_js__WEBPACK_IMPORTED_MODULE_74__[\"default\"]),\n/* harmony export */ MorphNode: () => (/* reexport safe */ _accessors_MorphNode_js__WEBPACK_IMPORTED_MODULE_71__[\"default\"]),\n/* harmony export */ Node: () => (/* reexport safe */ _core_Node_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"]),\n/* harmony export */ NodeAttribute: () => (/* reexport safe */ _core_NodeAttribute_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]),\n/* harmony export */ NodeBuilder: () => (/* reexport safe */ _core_NodeBuilder_js__WEBPACK_IMPORTED_MODULE_12__[\"default\"]),\n/* harmony export */ NodeCache: () => (/* reexport safe */ _core_NodeCache_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"]),\n/* harmony export */ NodeCode: () => (/* reexport safe */ _core_NodeCode_js__WEBPACK_IMPORTED_MODULE_14__[\"default\"]),\n/* harmony export */ NodeFrame: () => (/* reexport safe */ _core_NodeFrame_js__WEBPACK_IMPORTED_MODULE_15__[\"default\"]),\n/* harmony export */ NodeFunctionInput: () => (/* reexport safe */ _core_NodeFunctionInput_js__WEBPACK_IMPORTED_MODULE_16__[\"default\"]),\n/* harmony export */ NodeKeywords: () => (/* reexport safe */ _core_NodeKeywords_js__WEBPACK_IMPORTED_MODULE_17__[\"default\"]),\n/* harmony export */ NodeLoader: () => (/* reexport safe */ _loaders_NodeLoader_js__WEBPACK_IMPORTED_MODULE_133__[\"default\"]),\n/* harmony export */ NodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.NodeMaterial),\n/* harmony export */ NodeMaterialLoader: () => (/* reexport safe */ _loaders_NodeMaterialLoader_js__WEBPACK_IMPORTED_MODULE_135__[\"default\"]),\n/* harmony export */ NodeObjectLoader: () => (/* reexport safe */ _loaders_NodeObjectLoader_js__WEBPACK_IMPORTED_MODULE_134__[\"default\"]),\n/* harmony export */ NodeShaderStage: () => (/* reexport safe */ _core_constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeShaderStage),\n/* harmony export */ NodeType: () => (/* reexport safe */ _core_constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeType),\n/* harmony export */ NodeUniform: () => (/* reexport safe */ _core_NodeUniform_js__WEBPACK_IMPORTED_MODULE_18__[\"default\"]),\n/* harmony export */ NodeUpdateType: () => (/* reexport safe */ _core_constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeUpdateType),\n/* harmony export */ NodeUtils: () => (/* reexport module object */ _core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_29__),\n/* harmony export */ NodeVar: () => (/* reexport safe */ _core_NodeVar_js__WEBPACK_IMPORTED_MODULE_19__[\"default\"]),\n/* harmony export */ NodeVarying: () => (/* reexport safe */ _core_NodeVarying_js__WEBPACK_IMPORTED_MODULE_20__[\"default\"]),\n/* harmony export */ NormalMapNode: () => (/* reexport safe */ _display_NormalMapNode_js__WEBPACK_IMPORTED_MODULE_94__[\"default\"]),\n/* harmony export */ NormalNode: () => (/* reexport safe */ _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_75__[\"default\"]),\n/* harmony export */ Object3DNode: () => (/* reexport safe */ _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_76__[\"default\"]),\n/* harmony export */ OperatorNode: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__[\"default\"]),\n/* harmony export */ OscNode: () => (/* reexport safe */ _utils_OscNode_js__WEBPACK_IMPORTED_MODULE_45__[\"default\"]),\n/* harmony export */ OutputStructNode: () => (/* reexport safe */ _core_OutputStructNode_js__WEBPACK_IMPORTED_MODULE_28__[\"default\"]),\n/* harmony export */ PI: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.PI),\n/* harmony export */ PI2: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.PI2),\n/* harmony export */ PMREMNode: () => (/* reexport safe */ _pmrem_PMREMNode_js__WEBPACK_IMPORTED_MODULE_130__[\"default\"]),\n/* harmony export */ PMREMUtils: () => (/* reexport module object */ _pmrem_PMREMUtils_js__WEBPACK_IMPORTED_MODULE_131__),\n/* harmony export */ PackingNode: () => (/* reexport safe */ _utils_PackingNode_js__WEBPACK_IMPORTED_MODULE_46__[\"default\"]),\n/* harmony export */ ParameterNode: () => (/* reexport safe */ _core_ParameterNode_js__WEBPACK_IMPORTED_MODULE_21__[\"default\"]),\n/* harmony export */ PassNode: () => (/* reexport safe */ _display_PassNode_js__WEBPACK_IMPORTED_MODULE_105__[\"default\"]),\n/* harmony export */ PhongLightingModel: () => (/* reexport safe */ _functions_PhongLightingModel_js__WEBPACK_IMPORTED_MODULE_149__[\"default\"]),\n/* harmony export */ PhysicalLightingModel: () => (/* reexport safe */ _functions_PhysicalLightingModel_js__WEBPACK_IMPORTED_MODULE_150__[\"default\"]),\n/* harmony export */ PointLightNode: () => (/* reexport safe */ _lighting_PointLightNode_js__WEBPACK_IMPORTED_MODULE_118__[\"default\"]),\n/* harmony export */ PointUVNode: () => (/* reexport safe */ _accessors_PointUVNode_js__WEBPACK_IMPORTED_MODULE_77__[\"default\"]),\n/* harmony export */ PointsNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.PointsNodeMaterial),\n/* harmony export */ PositionNode: () => (/* reexport safe */ _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_78__[\"default\"]),\n/* harmony export */ PosterizeNode: () => (/* reexport safe */ _display_PosterizeNode_js__WEBPACK_IMPORTED_MODULE_95__[\"default\"]),\n/* harmony export */ PropertyNode: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__[\"default\"]),\n/* harmony export */ RangeNode: () => (/* reexport safe */ _geometry_RangeNode_js__WEBPACK_IMPORTED_MODULE_115__[\"default\"]),\n/* harmony export */ ReferenceNode: () => (/* reexport safe */ _accessors_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_79__[\"default\"]),\n/* harmony export */ ReflectVectorNode: () => (/* reexport safe */ _accessors_ReflectVectorNode_js__WEBPACK_IMPORTED_MODULE_80__[\"default\"]),\n/* harmony export */ ReflectorNode: () => (/* reexport safe */ _utils_ReflectorNode_js__WEBPACK_IMPORTED_MODULE_56__[\"default\"]),\n/* harmony export */ RemapNode: () => (/* reexport safe */ _utils_RemapNode_js__WEBPACK_IMPORTED_MODULE_47__[\"default\"]),\n/* harmony export */ RendererReferenceNode: () => (/* reexport safe */ _accessors_RendererReferenceNode_js__WEBPACK_IMPORTED_MODULE_70__[\"default\"]),\n/* harmony export */ RotateNode: () => (/* reexport safe */ _utils_RotateNode_js__WEBPACK_IMPORTED_MODULE_49__[\"default\"]),\n/* harmony export */ RotateUVNode: () => (/* reexport safe */ _utils_RotateUVNode_js__WEBPACK_IMPORTED_MODULE_48__[\"default\"]),\n/* harmony export */ SceneNode: () => (/* reexport safe */ _accessors_SceneNode_js__WEBPACK_IMPORTED_MODULE_82__[\"default\"]),\n/* harmony export */ Schlick_to_F0: () => (/* reexport safe */ _functions_BSDF_Schlick_to_F0_js__WEBPACK_IMPORTED_MODULE_144__[\"default\"]),\n/* harmony export */ ScriptableNode: () => (/* reexport safe */ _code_ScriptableNode_js__WEBPACK_IMPORTED_MODULE_110__[\"default\"]),\n/* harmony export */ ScriptableValueNode: () => (/* reexport safe */ _code_ScriptableValueNode_js__WEBPACK_IMPORTED_MODULE_111__[\"default\"]),\n/* harmony export */ SetNode: () => (/* reexport safe */ _utils_SetNode_js__WEBPACK_IMPORTED_MODULE_50__[\"default\"]),\n/* harmony export */ ShaderNode: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.ShaderNode),\n/* harmony export */ SkinningNode: () => (/* reexport safe */ _accessors_SkinningNode_js__WEBPACK_IMPORTED_MODULE_81__[\"default\"]),\n/* harmony export */ SplitNode: () => (/* reexport safe */ _utils_SplitNode_js__WEBPACK_IMPORTED_MODULE_51__[\"default\"]),\n/* harmony export */ SpotLightNode: () => (/* reexport safe */ _lighting_SpotLightNode_js__WEBPACK_IMPORTED_MODULE_120__[\"default\"]),\n/* harmony export */ SpriteNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.SpriteNodeMaterial),\n/* harmony export */ SpriteSheetUVNode: () => (/* reexport safe */ _utils_SpriteSheetUVNode_js__WEBPACK_IMPORTED_MODULE_52__[\"default\"]),\n/* harmony export */ StackNode: () => (/* reexport safe */ _core_StackNode_js__WEBPACK_IMPORTED_MODULE_23__[\"default\"]),\n/* harmony export */ StorageArrayElementNode: () => (/* reexport safe */ _utils_StorageArrayElementNode_js__WEBPACK_IMPORTED_MODULE_53__[\"default\"]),\n/* harmony export */ StorageBufferNode: () => (/* reexport safe */ _accessors_StorageBufferNode_js__WEBPACK_IMPORTED_MODULE_83__[\"default\"]),\n/* harmony export */ TBNViewMatrix: () => (/* reexport safe */ _accessors_AccessorsUtils_js__WEBPACK_IMPORTED_MODULE_58__.TBNViewMatrix),\n/* harmony export */ TangentNode: () => (/* reexport safe */ _accessors_TangentNode_js__WEBPACK_IMPORTED_MODULE_84__[\"default\"]),\n/* harmony export */ TempNode: () => (/* reexport safe */ _core_TempNode_js__WEBPACK_IMPORTED_MODULE_24__[\"default\"]),\n/* harmony export */ TextureBicubicNode: () => (/* reexport safe */ _accessors_TextureBicubicNode_js__WEBPACK_IMPORTED_MODULE_72__[\"default\"]),\n/* harmony export */ TextureNode: () => (/* reexport safe */ _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_85__[\"default\"]),\n/* harmony export */ TextureStoreNode: () => (/* reexport safe */ _accessors_TextureStoreNode_js__WEBPACK_IMPORTED_MODULE_86__[\"default\"]),\n/* harmony export */ TimerNode: () => (/* reexport safe */ _utils_TimerNode_js__WEBPACK_IMPORTED_MODULE_54__[\"default\"]),\n/* harmony export */ ToneMappingNode: () => (/* reexport safe */ _display_ToneMappingNode_js__WEBPACK_IMPORTED_MODULE_96__[\"default\"]),\n/* harmony export */ TriplanarTexturesNode: () => (/* reexport safe */ _utils_TriplanarTexturesNode_js__WEBPACK_IMPORTED_MODULE_55__[\"default\"]),\n/* harmony export */ UVNode: () => (/* reexport safe */ _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_87__[\"default\"]),\n/* harmony export */ UniformGroupNode: () => (/* reexport safe */ _core_UniformGroupNode_js__WEBPACK_IMPORTED_MODULE_25__[\"default\"]),\n/* harmony export */ UniformNode: () => (/* reexport safe */ _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_26__[\"default\"]),\n/* harmony export */ UniformsNode: () => (/* reexport safe */ _accessors_UniformsNode_js__WEBPACK_IMPORTED_MODULE_59__[\"default\"]),\n/* harmony export */ UserDataNode: () => (/* reexport safe */ _accessors_UserDataNode_js__WEBPACK_IMPORTED_MODULE_88__[\"default\"]),\n/* harmony export */ V_GGX_SmithCorrelated: () => (/* reexport safe */ _functions_BSDF_V_GGX_SmithCorrelated_js__WEBPACK_IMPORTED_MODULE_145__[\"default\"]),\n/* harmony export */ VarNode: () => (/* reexport safe */ _core_VarNode_js__WEBPACK_IMPORTED_MODULE_10__[\"default\"]),\n/* harmony export */ VaryingNode: () => (/* reexport safe */ _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_27__[\"default\"]),\n/* harmony export */ VertexColorNode: () => (/* reexport safe */ _accessors_VertexColorNode_js__WEBPACK_IMPORTED_MODULE_64__[\"default\"]),\n/* harmony export */ ViewportDepthNode: () => (/* reexport safe */ _display_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_101__[\"default\"]),\n/* harmony export */ ViewportDepthTextureNode: () => (/* reexport safe */ _display_ViewportDepthTextureNode_js__WEBPACK_IMPORTED_MODULE_100__[\"default\"]),\n/* harmony export */ ViewportNode: () => (/* reexport safe */ _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_97__[\"default\"]),\n/* harmony export */ ViewportSharedTextureNode: () => (/* reexport safe */ _display_ViewportSharedTextureNode_js__WEBPACK_IMPORTED_MODULE_99__[\"default\"]),\n/* harmony export */ ViewportTextureNode: () => (/* reexport safe */ _display_ViewportTextureNode_js__WEBPACK_IMPORTED_MODULE_98__[\"default\"]),\n/* harmony export */ abs: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.abs),\n/* harmony export */ acos: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.acos),\n/* harmony export */ add: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.add),\n/* harmony export */ addLightNode: () => (/* reexport safe */ _lighting_LightsNode_js__WEBPACK_IMPORTED_MODULE_123__.addLightNode),\n/* harmony export */ addNodeClass: () => (/* reexport safe */ _core_Node_js__WEBPACK_IMPORTED_MODULE_9__.addNodeClass),\n/* harmony export */ addNodeElement: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.addNodeElement),\n/* harmony export */ addNodeMaterial: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.addNodeMaterial),\n/* harmony export */ afterImage: () => (/* reexport safe */ _display_AfterImageNode_js__WEBPACK_IMPORTED_MODULE_103__.afterImage),\n/* harmony export */ all: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.all),\n/* harmony export */ anamorphic: () => (/* reexport safe */ _display_AnamorphicNode_js__WEBPACK_IMPORTED_MODULE_104__.anamorphic),\n/* harmony export */ and: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.and),\n/* harmony export */ any: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.any),\n/* harmony export */ append: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.append),\n/* harmony export */ arrayBuffer: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.arrayBuffer),\n/* harmony export */ asin: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.asin),\n/* harmony export */ assign: () => (/* reexport safe */ _core_AssignNode_js__WEBPACK_IMPORTED_MODULE_1__.assign),\n/* harmony export */ atan: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.atan),\n/* harmony export */ atan2: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.atan2),\n/* harmony export */ attribute: () => (/* reexport safe */ _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_2__.attribute),\n/* harmony export */ backgroundBlurriness: () => (/* reexport safe */ _accessors_SceneNode_js__WEBPACK_IMPORTED_MODULE_82__.backgroundBlurriness),\n/* harmony export */ backgroundIntensity: () => (/* reexport safe */ _accessors_SceneNode_js__WEBPACK_IMPORTED_MODULE_82__.backgroundIntensity),\n/* harmony export */ batch: () => (/* reexport safe */ _accessors_BatchNode_js__WEBPACK_IMPORTED_MODULE_67__.batch),\n/* harmony export */ bitAnd: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.bitAnd),\n/* harmony export */ bitNot: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.bitNot),\n/* harmony export */ bitOr: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.bitOr),\n/* harmony export */ bitXor: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.bitXor),\n/* harmony export */ bitangentGeometry: () => (/* reexport safe */ _accessors_BitangentNode_js__WEBPACK_IMPORTED_MODULE_60__.bitangentGeometry),\n/* harmony export */ bitangentLocal: () => (/* reexport safe */ _accessors_BitangentNode_js__WEBPACK_IMPORTED_MODULE_60__.bitangentLocal),\n/* harmony export */ bitangentView: () => (/* reexport safe */ _accessors_BitangentNode_js__WEBPACK_IMPORTED_MODULE_60__.bitangentView),\n/* harmony export */ bitangentWorld: () => (/* reexport safe */ _accessors_BitangentNode_js__WEBPACK_IMPORTED_MODULE_60__.bitangentWorld),\n/* harmony export */ bitcast: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.bitcast),\n/* harmony export */ bmat2: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.bmat2),\n/* harmony export */ bmat3: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.bmat3),\n/* harmony export */ bmat4: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.bmat4),\n/* harmony export */ bool: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.bool),\n/* harmony export */ buffer: () => (/* reexport safe */ _accessors_BufferNode_js__WEBPACK_IMPORTED_MODULE_62__.buffer),\n/* harmony export */ bufferAttribute: () => (/* reexport safe */ _accessors_BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_61__.bufferAttribute),\n/* harmony export */ bumpMap: () => (/* reexport safe */ _display_BumpMapNode_js__WEBPACK_IMPORTED_MODULE_90__.bumpMap),\n/* harmony export */ burn: () => (/* reexport safe */ _display_BlendModeNode_js__WEBPACK_IMPORTED_MODULE_89__.burn),\n/* harmony export */ bvec2: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.bvec2),\n/* harmony export */ bvec3: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.bvec3),\n/* harmony export */ bvec4: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.bvec4),\n/* harmony export */ bypass: () => (/* reexport safe */ _core_BypassNode_js__WEBPACK_IMPORTED_MODULE_3__.bypass),\n/* harmony export */ cache: () => (/* reexport safe */ _core_CacheNode_js__WEBPACK_IMPORTED_MODULE_4__.cache),\n/* harmony export */ call: () => (/* reexport safe */ _code_FunctionCallNode_js__WEBPACK_IMPORTED_MODULE_108__.call),\n/* harmony export */ cameraFar: () => (/* reexport safe */ _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_63__.cameraFar),\n/* harmony export */ cameraLogDepth: () => (/* reexport safe */ _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_63__.cameraLogDepth),\n/* harmony export */ cameraNear: () => (/* reexport safe */ _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_63__.cameraNear),\n/* harmony export */ cameraNormalMatrix: () => (/* reexport safe */ _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_63__.cameraNormalMatrix),\n/* harmony export */ cameraPosition: () => (/* reexport safe */ _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_63__.cameraPosition),\n/* harmony export */ cameraProjectionMatrix: () => (/* reexport safe */ _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_63__.cameraProjectionMatrix),\n/* harmony export */ cameraProjectionMatrixInverse: () => (/* reexport safe */ _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_63__.cameraProjectionMatrixInverse),\n/* harmony export */ cameraViewMatrix: () => (/* reexport safe */ _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_63__.cameraViewMatrix),\n/* harmony export */ cameraWorldMatrix: () => (/* reexport safe */ _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_63__.cameraWorldMatrix),\n/* harmony export */ cbrt: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.cbrt),\n/* harmony export */ ceil: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.ceil),\n/* harmony export */ checker: () => (/* reexport safe */ _procedural_CheckerNode_js__WEBPACK_IMPORTED_MODULE_132__.checker),\n/* harmony export */ clamp: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.clamp),\n/* harmony export */ clearcoat: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.clearcoat),\n/* harmony export */ clearcoatRoughness: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.clearcoatRoughness),\n/* harmony export */ code: () => (/* reexport safe */ _code_CodeNode_js__WEBPACK_IMPORTED_MODULE_107__.code),\n/* harmony export */ color: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.color),\n/* harmony export */ colorSpaceToLinear: () => (/* reexport safe */ _display_ColorSpaceNode_js__WEBPACK_IMPORTED_MODULE_92__.colorSpaceToLinear),\n/* harmony export */ colorToDirection: () => (/* reexport safe */ _utils_PackingNode_js__WEBPACK_IMPORTED_MODULE_46__.colorToDirection),\n/* harmony export */ compute: () => (/* reexport safe */ _gpgpu_ComputeNode_js__WEBPACK_IMPORTED_MODULE_116__.compute),\n/* harmony export */ cond: () => (/* reexport safe */ _math_CondNode_js__WEBPACK_IMPORTED_MODULE_32__.cond),\n/* harmony export */ context: () => (/* reexport safe */ _core_ContextNode_js__WEBPACK_IMPORTED_MODULE_6__.context),\n/* harmony export */ convert: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.convert),\n/* harmony export */ cos: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.cos),\n/* harmony export */ createNodeFromType: () => (/* reexport safe */ _core_Node_js__WEBPACK_IMPORTED_MODULE_9__.createNodeFromType),\n/* harmony export */ createNodeMaterialFromType: () => (/* reexport safe */ _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__.createNodeMaterialFromType),\n/* harmony export */ cross: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.cross),\n/* harmony export */ cubeTexture: () => (/* reexport safe */ _accessors_CubeTextureNode_js__WEBPACK_IMPORTED_MODULE_65__.cubeTexture),\n/* harmony export */ dFdx: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.dFdx),\n/* harmony export */ dFdy: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.dFdy),\n/* harmony export */ dashSize: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.dashSize),\n/* harmony export */ defaultBuildStages: () => (/* reexport safe */ _core_constants_js__WEBPACK_IMPORTED_MODULE_0__.defaultBuildStages),\n/* harmony export */ defaultShaderStages: () => (/* reexport safe */ _core_constants_js__WEBPACK_IMPORTED_MODULE_0__.defaultShaderStages),\n/* harmony export */ degrees: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.degrees),\n/* harmony export */ densityFog: () => (/* reexport safe */ _fog_FogExp2Node_js__WEBPACK_IMPORTED_MODULE_114__.densityFog),\n/* harmony export */ depth: () => (/* reexport safe */ _display_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_101__.depth),\n/* harmony export */ depthPass: () => (/* reexport safe */ _display_PassNode_js__WEBPACK_IMPORTED_MODULE_105__.depthPass),\n/* harmony export */ depthPixel: () => (/* reexport safe */ _display_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_101__.depthPixel),\n/* harmony export */ depthTexture: () => (/* reexport safe */ _display_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_101__.depthTexture),\n/* harmony export */ difference: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.difference),\n/* harmony export */ diffuseColor: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.diffuseColor),\n/* harmony export */ directionToColor: () => (/* reexport safe */ _utils_PackingNode_js__WEBPACK_IMPORTED_MODULE_46__.directionToColor),\n/* harmony export */ discard: () => (/* reexport safe */ _utils_DiscardNode_js__WEBPACK_IMPORTED_MODULE_38__.discard),\n/* harmony export */ distance: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.distance),\n/* harmony export */ div: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.div),\n/* harmony export */ dodge: () => (/* reexport safe */ _display_BlendModeNode_js__WEBPACK_IMPORTED_MODULE_89__.dodge),\n/* harmony export */ dot: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.dot),\n/* harmony export */ dynamicBufferAttribute: () => (/* reexport safe */ _accessors_BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_61__.dynamicBufferAttribute),\n/* harmony export */ element: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.element),\n/* harmony export */ equal: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.equal),\n/* harmony export */ equals: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.equals),\n/* harmony export */ equirectUV: () => (/* reexport safe */ _utils_EquirectUVNode_js__WEBPACK_IMPORTED_MODULE_39__.equirectUV),\n/* harmony export */ exp: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.exp),\n/* harmony export */ exp2: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.exp2),\n/* harmony export */ expression: () => (/* reexport safe */ _code_ExpressionNode_js__WEBPACK_IMPORTED_MODULE_106__.expression),\n/* harmony export */ faceDirection: () => (/* reexport safe */ _display_FrontFacingNode_js__WEBPACK_IMPORTED_MODULE_93__.faceDirection),\n/* harmony export */ faceForward: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.faceForward),\n/* harmony export */ float: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.float),\n/* harmony export */ floor: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.floor),\n/* harmony export */ fog: () => (/* reexport safe */ _fog_FogNode_js__WEBPACK_IMPORTED_MODULE_112__.fog),\n/* harmony export */ fract: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.fract),\n/* harmony export */ frameGroup: () => (/* reexport safe */ _core_UniformGroupNode_js__WEBPACK_IMPORTED_MODULE_25__.frameGroup),\n/* harmony export */ frameId: () => (/* reexport safe */ _utils_TimerNode_js__WEBPACK_IMPORTED_MODULE_54__.frameId),\n/* harmony export */ frontFacing: () => (/* reexport safe */ _display_FrontFacingNode_js__WEBPACK_IMPORTED_MODULE_93__.frontFacing),\n/* harmony export */ fwidth: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.fwidth),\n/* harmony export */ gain: () => (/* reexport safe */ _math_MathUtils_js__WEBPACK_IMPORTED_MODULE_34__.gain),\n/* harmony export */ gapSize: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.gapSize),\n/* harmony export */ gaussianBlur: () => (/* reexport safe */ _display_GaussianBlurNode_js__WEBPACK_IMPORTED_MODULE_102__.gaussianBlur),\n/* harmony export */ getConstNodeType: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.getConstNodeType),\n/* harmony export */ getCurrentStack: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.getCurrentStack),\n/* harmony export */ getDistanceAttenuation: () => (/* reexport safe */ _lighting_LightUtils_js__WEBPACK_IMPORTED_MODULE_146__.getDistanceAttenuation),\n/* harmony export */ getGeometryRoughness: () => (/* reexport safe */ _functions_material_getGeometryRoughness_js__WEBPACK_IMPORTED_MODULE_147__[\"default\"]),\n/* harmony export */ getRoughness: () => (/* reexport safe */ _functions_material_getRoughness_js__WEBPACK_IMPORTED_MODULE_148__[\"default\"]),\n/* harmony export */ global: () => (/* reexport safe */ _code_ScriptableNode_js__WEBPACK_IMPORTED_MODULE_110__.global),\n/* harmony export */ glsl: () => (/* reexport safe */ _code_CodeNode_js__WEBPACK_IMPORTED_MODULE_107__.glsl),\n/* harmony export */ glslFn: () => (/* reexport safe */ _code_FunctionNode_js__WEBPACK_IMPORTED_MODULE_109__.glslFn),\n/* harmony export */ greaterThan: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.greaterThan),\n/* harmony export */ greaterThanEqual: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.greaterThanEqual),\n/* harmony export */ hash: () => (/* reexport safe */ _math_HashNode_js__WEBPACK_IMPORTED_MODULE_33__.hash),\n/* harmony export */ hue: () => (/* reexport safe */ _display_ColorAdjustmentNode_js__WEBPACK_IMPORTED_MODULE_91__.hue),\n/* harmony export */ imat2: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.imat2),\n/* harmony export */ imat3: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.imat3),\n/* harmony export */ imat4: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.imat4),\n/* harmony export */ instance: () => (/* reexport safe */ _accessors_InstanceNode_js__WEBPACK_IMPORTED_MODULE_66__.instance),\n/* harmony export */ instanceIndex: () => (/* reexport safe */ _core_IndexNode_js__WEBPACK_IMPORTED_MODULE_7__.instanceIndex),\n/* harmony export */ instancedBufferAttribute: () => (/* reexport safe */ _accessors_BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_61__.instancedBufferAttribute),\n/* harmony export */ instancedDynamicBufferAttribute: () => (/* reexport safe */ _accessors_BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_61__.instancedDynamicBufferAttribute),\n/* harmony export */ int: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.int),\n/* harmony export */ inverseSqrt: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.inverseSqrt),\n/* harmony export */ iridescence: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.iridescence),\n/* harmony export */ iridescenceIOR: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.iridescenceIOR),\n/* harmony export */ iridescenceThickness: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.iridescenceThickness),\n/* harmony export */ ivec2: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.ivec2),\n/* harmony export */ ivec3: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.ivec3),\n/* harmony export */ ivec4: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.ivec4),\n/* harmony export */ js: () => (/* reexport safe */ _code_CodeNode_js__WEBPACK_IMPORTED_MODULE_107__.js),\n/* harmony export */ label: () => (/* reexport safe */ _core_ContextNode_js__WEBPACK_IMPORTED_MODULE_6__.label),\n/* harmony export */ length: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.length),\n/* harmony export */ lengthSq: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.lengthSq),\n/* harmony export */ lessThan: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.lessThan),\n/* harmony export */ lessThanEqual: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.lessThanEqual),\n/* harmony export */ lightTargetDirection: () => (/* reexport safe */ _lighting_LightNode_js__WEBPACK_IMPORTED_MODULE_117__.lightTargetDirection),\n/* harmony export */ lightingContext: () => (/* reexport safe */ _lighting_LightingContextNode_js__WEBPACK_IMPORTED_MODULE_125__.lightingContext),\n/* harmony export */ lights: () => (/* reexport safe */ _lighting_LightsNode_js__WEBPACK_IMPORTED_MODULE_123__.lights),\n/* harmony export */ lightsNode: () => (/* reexport safe */ _lighting_LightsNode_js__WEBPACK_IMPORTED_MODULE_123__.lightsNode),\n/* harmony export */ linearToColorSpace: () => (/* reexport safe */ _display_ColorSpaceNode_js__WEBPACK_IMPORTED_MODULE_92__.linearToColorSpace),\n/* harmony export */ linearTosRGB: () => (/* reexport safe */ _display_ColorSpaceNode_js__WEBPACK_IMPORTED_MODULE_92__.linearTosRGB),\n/* harmony export */ log: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.log),\n/* harmony export */ log2: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.log2),\n/* harmony export */ loop: () => (/* reexport safe */ _utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_42__.loop),\n/* harmony export */ lumaCoeffs: () => (/* reexport safe */ _display_ColorAdjustmentNode_js__WEBPACK_IMPORTED_MODULE_91__.lumaCoeffs),\n/* harmony export */ luminance: () => (/* reexport safe */ _display_ColorAdjustmentNode_js__WEBPACK_IMPORTED_MODULE_91__.luminance),\n/* harmony export */ mat2: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.mat2),\n/* harmony export */ mat3: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.mat3),\n/* harmony export */ mat4: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.mat4),\n/* harmony export */ matcapUV: () => (/* reexport safe */ _utils_MatcapUVNode_js__WEBPACK_IMPORTED_MODULE_43__.matcapUV),\n/* harmony export */ materialAlphaTest: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialAlphaTest),\n/* harmony export */ materialClearcoat: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialClearcoat),\n/* harmony export */ materialClearcoatNormal: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialClearcoatNormal),\n/* harmony export */ materialClearcoatRoughness: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialClearcoatRoughness),\n/* harmony export */ materialColor: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialColor),\n/* harmony export */ materialEmissive: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialEmissive),\n/* harmony export */ materialIridescence: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialIridescence),\n/* harmony export */ materialIridescenceIOR: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialIridescenceIOR),\n/* harmony export */ materialIridescenceThickness: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialIridescenceThickness),\n/* harmony export */ materialLineDashOffset: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialLineDashOffset),\n/* harmony export */ materialLineDashSize: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialLineDashSize),\n/* harmony export */ materialLineGapSize: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialLineGapSize),\n/* harmony export */ materialLineScale: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialLineScale),\n/* harmony export */ materialLineWidth: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialLineWidth),\n/* harmony export */ materialMetalness: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialMetalness),\n/* harmony export */ materialNormal: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialNormal),\n/* harmony export */ materialOpacity: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialOpacity),\n/* harmony export */ materialPointWidth: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialPointWidth),\n/* harmony export */ materialReference: () => (/* reexport safe */ _accessors_MaterialReferenceNode_js__WEBPACK_IMPORTED_MODULE_69__.materialReference),\n/* harmony export */ materialReflectivity: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialReflectivity),\n/* harmony export */ materialRotation: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialRotation),\n/* harmony export */ materialRoughness: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialRoughness),\n/* harmony export */ materialSheen: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialSheen),\n/* harmony export */ materialSheenRoughness: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialSheenRoughness),\n/* harmony export */ materialShininess: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialShininess),\n/* harmony export */ materialSpecularColor: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialSpecularColor),\n/* harmony export */ materialSpecularStrength: () => (/* reexport safe */ _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__.materialSpecularStrength),\n/* harmony export */ max: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.max),\n/* harmony export */ maxMipLevel: () => (/* reexport safe */ _utils_MaxMipLevelNode_js__WEBPACK_IMPORTED_MODULE_44__.maxMipLevel),\n/* harmony export */ metalness: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.metalness),\n/* harmony export */ min: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.min),\n/* harmony export */ mix: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.mix),\n/* harmony export */ mod: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.mod),\n/* harmony export */ modelDirection: () => (/* reexport safe */ _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_73__.modelDirection),\n/* harmony export */ modelNormalMatrix: () => (/* reexport safe */ _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_73__.modelNormalMatrix),\n/* harmony export */ modelPosition: () => (/* reexport safe */ _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_73__.modelPosition),\n/* harmony export */ modelScale: () => (/* reexport safe */ _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_73__.modelScale),\n/* harmony export */ modelViewMatrix: () => (/* reexport safe */ _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_73__.modelViewMatrix),\n/* harmony export */ modelViewPosition: () => (/* reexport safe */ _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_73__.modelViewPosition),\n/* harmony export */ modelViewProjection: () => (/* reexport safe */ _accessors_ModelViewProjectionNode_js__WEBPACK_IMPORTED_MODULE_74__.modelViewProjection),\n/* harmony export */ modelWorldMatrix: () => (/* reexport safe */ _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_73__.modelWorldMatrix),\n/* harmony export */ morphReference: () => (/* reexport safe */ _accessors_MorphNode_js__WEBPACK_IMPORTED_MODULE_71__.morphReference),\n/* harmony export */ mul: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.mul),\n/* harmony export */ mx_aastep: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_aastep),\n/* harmony export */ mx_cell_noise_float: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_cell_noise_float),\n/* harmony export */ mx_contrast: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_contrast),\n/* harmony export */ mx_fractal_noise_float: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_fractal_noise_float),\n/* harmony export */ mx_fractal_noise_vec2: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_fractal_noise_vec2),\n/* harmony export */ mx_fractal_noise_vec3: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_fractal_noise_vec3),\n/* harmony export */ mx_fractal_noise_vec4: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_fractal_noise_vec4),\n/* harmony export */ mx_hsvtorgb: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_hsvtorgb),\n/* harmony export */ mx_noise_float: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_noise_float),\n/* harmony export */ mx_noise_vec3: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_noise_vec3),\n/* harmony export */ mx_noise_vec4: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_noise_vec4),\n/* harmony export */ mx_ramplr: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_ramplr),\n/* harmony export */ mx_ramptb: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_ramptb),\n/* harmony export */ mx_rgbtohsv: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_rgbtohsv),\n/* harmony export */ mx_safepower: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_safepower),\n/* harmony export */ mx_splitlr: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_splitlr),\n/* harmony export */ mx_splittb: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_splittb),\n/* harmony export */ mx_srgb_texture_to_lin_rec709: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_srgb_texture_to_lin_rec709),\n/* harmony export */ mx_transform_uv: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_transform_uv),\n/* harmony export */ mx_worley_noise_float: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_worley_noise_float),\n/* harmony export */ mx_worley_noise_vec2: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_worley_noise_vec2),\n/* harmony export */ mx_worley_noise_vec3: () => (/* reexport safe */ _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__.mx_worley_noise_vec3),\n/* harmony export */ negate: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.negate),\n/* harmony export */ nodeArray: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.nodeArray),\n/* harmony export */ nodeImmutable: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.nodeImmutable),\n/* harmony export */ nodeObject: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.nodeObject),\n/* harmony export */ nodeObjects: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.nodeObjects),\n/* harmony export */ nodeProxy: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.nodeProxy),\n/* harmony export */ normalGeometry: () => (/* reexport safe */ _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_75__.normalGeometry),\n/* harmony export */ normalLocal: () => (/* reexport safe */ _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_75__.normalLocal),\n/* harmony export */ normalMap: () => (/* reexport safe */ _display_NormalMapNode_js__WEBPACK_IMPORTED_MODULE_94__.normalMap),\n/* harmony export */ normalView: () => (/* reexport safe */ _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_75__.normalView),\n/* harmony export */ normalWorld: () => (/* reexport safe */ _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_75__.normalWorld),\n/* harmony export */ normalize: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.normalize),\n/* harmony export */ not: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.not),\n/* harmony export */ objectDirection: () => (/* reexport safe */ _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_76__.objectDirection),\n/* harmony export */ objectGroup: () => (/* reexport safe */ _core_UniformGroupNode_js__WEBPACK_IMPORTED_MODULE_25__.objectGroup),\n/* harmony export */ objectNormalMatrix: () => (/* reexport safe */ _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_76__.objectNormalMatrix),\n/* harmony export */ objectPosition: () => (/* reexport safe */ _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_76__.objectPosition),\n/* harmony export */ objectScale: () => (/* reexport safe */ _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_76__.objectScale),\n/* harmony export */ objectViewMatrix: () => (/* reexport safe */ _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_76__.objectViewMatrix),\n/* harmony export */ objectViewPosition: () => (/* reexport safe */ _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_76__.objectViewPosition),\n/* harmony export */ objectWorldMatrix: () => (/* reexport safe */ _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_76__.objectWorldMatrix),\n/* harmony export */ oneMinus: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.oneMinus),\n/* harmony export */ or: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.or),\n/* harmony export */ orthographicDepthToViewZ: () => (/* reexport safe */ _display_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_101__.orthographicDepthToViewZ),\n/* harmony export */ oscSawtooth: () => (/* reexport safe */ _utils_OscNode_js__WEBPACK_IMPORTED_MODULE_45__.oscSawtooth),\n/* harmony export */ oscSine: () => (/* reexport safe */ _utils_OscNode_js__WEBPACK_IMPORTED_MODULE_45__.oscSine),\n/* harmony export */ oscSquare: () => (/* reexport safe */ _utils_OscNode_js__WEBPACK_IMPORTED_MODULE_45__.oscSquare),\n/* harmony export */ oscTriangle: () => (/* reexport safe */ _utils_OscNode_js__WEBPACK_IMPORTED_MODULE_45__.oscTriangle),\n/* harmony export */ output: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.output),\n/* harmony export */ outputStruct: () => (/* reexport safe */ _core_OutputStructNode_js__WEBPACK_IMPORTED_MODULE_28__.outputStruct),\n/* harmony export */ overlay: () => (/* reexport safe */ _display_BlendModeNode_js__WEBPACK_IMPORTED_MODULE_89__.overlay),\n/* harmony export */ overloadingFn: () => (/* reexport safe */ _utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_40__.overloadingFn),\n/* harmony export */ parabola: () => (/* reexport safe */ _math_MathUtils_js__WEBPACK_IMPORTED_MODULE_34__.parabola),\n/* harmony export */ parallaxDirection: () => (/* reexport safe */ _accessors_AccessorsUtils_js__WEBPACK_IMPORTED_MODULE_58__.parallaxDirection),\n/* harmony export */ parallaxUV: () => (/* reexport safe */ _accessors_AccessorsUtils_js__WEBPACK_IMPORTED_MODULE_58__.parallaxUV),\n/* harmony export */ parameter: () => (/* reexport safe */ _core_ParameterNode_js__WEBPACK_IMPORTED_MODULE_21__.parameter),\n/* harmony export */ pass: () => (/* reexport safe */ _display_PassNode_js__WEBPACK_IMPORTED_MODULE_105__.pass),\n/* harmony export */ pcurve: () => (/* reexport safe */ _math_MathUtils_js__WEBPACK_IMPORTED_MODULE_34__.pcurve),\n/* harmony export */ perspectiveDepthToViewZ: () => (/* reexport safe */ _display_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_101__.perspectiveDepthToViewZ),\n/* harmony export */ pmremTexture: () => (/* reexport safe */ _pmrem_PMREMNode_js__WEBPACK_IMPORTED_MODULE_130__.pmremTexture),\n/* harmony export */ pointUV: () => (/* reexport safe */ _accessors_PointUVNode_js__WEBPACK_IMPORTED_MODULE_77__.pointUV),\n/* harmony export */ pointWidth: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.pointWidth),\n/* harmony export */ positionGeometry: () => (/* reexport safe */ _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_78__.positionGeometry),\n/* harmony export */ positionLocal: () => (/* reexport safe */ _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_78__.positionLocal),\n/* harmony export */ positionView: () => (/* reexport safe */ _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_78__.positionView),\n/* harmony export */ positionViewDirection: () => (/* reexport safe */ _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_78__.positionViewDirection),\n/* harmony export */ positionWorld: () => (/* reexport safe */ _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_78__.positionWorld),\n/* harmony export */ positionWorldDirection: () => (/* reexport safe */ _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_78__.positionWorldDirection),\n/* harmony export */ posterize: () => (/* reexport safe */ _display_PosterizeNode_js__WEBPACK_IMPORTED_MODULE_95__.posterize),\n/* harmony export */ pow: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.pow),\n/* harmony export */ pow2: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.pow2),\n/* harmony export */ pow3: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.pow3),\n/* harmony export */ pow4: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.pow4),\n/* harmony export */ property: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.property),\n/* harmony export */ radians: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.radians),\n/* harmony export */ range: () => (/* reexport safe */ _geometry_RangeNode_js__WEBPACK_IMPORTED_MODULE_115__.range),\n/* harmony export */ rangeFog: () => (/* reexport safe */ _fog_FogRangeNode_js__WEBPACK_IMPORTED_MODULE_113__.rangeFog),\n/* harmony export */ reciprocal: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.reciprocal),\n/* harmony export */ reference: () => (/* reexport safe */ _accessors_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_79__.reference),\n/* harmony export */ referenceBuffer: () => (/* reexport safe */ _accessors_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_79__.referenceBuffer),\n/* harmony export */ reflect: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.reflect),\n/* harmony export */ reflectVector: () => (/* reexport safe */ _accessors_ReflectVectorNode_js__WEBPACK_IMPORTED_MODULE_80__.reflectVector),\n/* harmony export */ reflector: () => (/* reexport safe */ _utils_ReflectorNode_js__WEBPACK_IMPORTED_MODULE_56__.reflector),\n/* harmony export */ refract: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.refract),\n/* harmony export */ remainder: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.remainder),\n/* harmony export */ remap: () => (/* reexport safe */ _utils_RemapNode_js__WEBPACK_IMPORTED_MODULE_47__.remap),\n/* harmony export */ remapClamp: () => (/* reexport safe */ _utils_RemapNode_js__WEBPACK_IMPORTED_MODULE_47__.remapClamp),\n/* harmony export */ renderGroup: () => (/* reexport safe */ _core_UniformGroupNode_js__WEBPACK_IMPORTED_MODULE_25__.renderGroup),\n/* harmony export */ rendererReference: () => (/* reexport safe */ _accessors_RendererReferenceNode_js__WEBPACK_IMPORTED_MODULE_70__.rendererReference),\n/* harmony export */ rotate: () => (/* reexport safe */ _utils_RotateNode_js__WEBPACK_IMPORTED_MODULE_49__.rotate),\n/* harmony export */ rotateUV: () => (/* reexport safe */ _utils_RotateUVNode_js__WEBPACK_IMPORTED_MODULE_48__.rotateUV),\n/* harmony export */ roughness: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.roughness),\n/* harmony export */ round: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.round),\n/* harmony export */ sRGBToLinear: () => (/* reexport safe */ _display_ColorSpaceNode_js__WEBPACK_IMPORTED_MODULE_92__.sRGBToLinear),\n/* harmony export */ sampler: () => (/* reexport safe */ _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_85__.sampler),\n/* harmony export */ saturate: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.saturate),\n/* harmony export */ saturation: () => (/* reexport safe */ _display_ColorAdjustmentNode_js__WEBPACK_IMPORTED_MODULE_91__.saturation),\n/* harmony export */ screen: () => (/* reexport safe */ _display_BlendModeNode_js__WEBPACK_IMPORTED_MODULE_89__.screen),\n/* harmony export */ scriptable: () => (/* reexport safe */ _code_ScriptableNode_js__WEBPACK_IMPORTED_MODULE_110__.scriptable),\n/* harmony export */ scriptableValue: () => (/* reexport safe */ _code_ScriptableValueNode_js__WEBPACK_IMPORTED_MODULE_111__.scriptableValue),\n/* harmony export */ setCurrentStack: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.setCurrentStack),\n/* harmony export */ shader: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.shader),\n/* harmony export */ shaderStages: () => (/* reexport safe */ _core_constants_js__WEBPACK_IMPORTED_MODULE_0__.shaderStages),\n/* harmony export */ sheen: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.sheen),\n/* harmony export */ sheenRoughness: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.sheenRoughness),\n/* harmony export */ shiftLeft: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.shiftLeft),\n/* harmony export */ shiftRight: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.shiftRight),\n/* harmony export */ shininess: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.shininess),\n/* harmony export */ sign: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.sign),\n/* harmony export */ sin: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.sin),\n/* harmony export */ sinc: () => (/* reexport safe */ _math_MathUtils_js__WEBPACK_IMPORTED_MODULE_34__.sinc),\n/* harmony export */ skinning: () => (/* reexport safe */ _accessors_SkinningNode_js__WEBPACK_IMPORTED_MODULE_81__.skinning),\n/* harmony export */ smoothstep: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.smoothstep),\n/* harmony export */ specularColor: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.specularColor),\n/* harmony export */ split: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.split),\n/* harmony export */ spritesheetUV: () => (/* reexport safe */ _utils_SpriteSheetUVNode_js__WEBPACK_IMPORTED_MODULE_52__.spritesheetUV),\n/* harmony export */ sqrt: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.sqrt),\n/* harmony export */ stack: () => (/* reexport safe */ _core_StackNode_js__WEBPACK_IMPORTED_MODULE_23__.stack),\n/* harmony export */ step: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.step),\n/* harmony export */ storage: () => (/* reexport safe */ _accessors_StorageBufferNode_js__WEBPACK_IMPORTED_MODULE_83__.storage),\n/* harmony export */ storageObject: () => (/* reexport safe */ _accessors_StorageBufferNode_js__WEBPACK_IMPORTED_MODULE_83__.storageObject),\n/* harmony export */ string: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.string),\n/* harmony export */ sub: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.sub),\n/* harmony export */ tan: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.tan),\n/* harmony export */ tangentGeometry: () => (/* reexport safe */ _accessors_TangentNode_js__WEBPACK_IMPORTED_MODULE_84__.tangentGeometry),\n/* harmony export */ tangentLocal: () => (/* reexport safe */ _accessors_TangentNode_js__WEBPACK_IMPORTED_MODULE_84__.tangentLocal),\n/* harmony export */ tangentView: () => (/* reexport safe */ _accessors_TangentNode_js__WEBPACK_IMPORTED_MODULE_84__.tangentView),\n/* harmony export */ tangentWorld: () => (/* reexport safe */ _accessors_TangentNode_js__WEBPACK_IMPORTED_MODULE_84__.tangentWorld),\n/* harmony export */ temp: () => (/* reexport safe */ _core_VarNode_js__WEBPACK_IMPORTED_MODULE_10__.temp),\n/* harmony export */ texture: () => (/* reexport safe */ _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_85__.texture),\n/* harmony export */ textureBicubic: () => (/* reexport safe */ _accessors_TextureBicubicNode_js__WEBPACK_IMPORTED_MODULE_72__.textureBicubic),\n/* harmony export */ textureLoad: () => (/* reexport safe */ _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_85__.textureLoad),\n/* harmony export */ textureStore: () => (/* reexport safe */ _accessors_TextureStoreNode_js__WEBPACK_IMPORTED_MODULE_86__.textureStore),\n/* harmony export */ threshold: () => (/* reexport safe */ _display_ColorAdjustmentNode_js__WEBPACK_IMPORTED_MODULE_91__.threshold),\n/* harmony export */ timerDelta: () => (/* reexport safe */ _utils_TimerNode_js__WEBPACK_IMPORTED_MODULE_54__.timerDelta),\n/* harmony export */ timerGlobal: () => (/* reexport safe */ _utils_TimerNode_js__WEBPACK_IMPORTED_MODULE_54__.timerGlobal),\n/* harmony export */ timerLocal: () => (/* reexport safe */ _utils_TimerNode_js__WEBPACK_IMPORTED_MODULE_54__.timerLocal),\n/* harmony export */ toneMapping: () => (/* reexport safe */ _display_ToneMappingNode_js__WEBPACK_IMPORTED_MODULE_96__.toneMapping),\n/* harmony export */ transformDirection: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.transformDirection),\n/* harmony export */ transformedBitangentView: () => (/* reexport safe */ _accessors_BitangentNode_js__WEBPACK_IMPORTED_MODULE_60__.transformedBitangentView),\n/* harmony export */ transformedBitangentWorld: () => (/* reexport safe */ _accessors_BitangentNode_js__WEBPACK_IMPORTED_MODULE_60__.transformedBitangentWorld),\n/* harmony export */ transformedClearcoatNormalView: () => (/* reexport safe */ _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_75__.transformedClearcoatNormalView),\n/* harmony export */ transformedNormalView: () => (/* reexport safe */ _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_75__.transformedNormalView),\n/* harmony export */ transformedNormalWorld: () => (/* reexport safe */ _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_75__.transformedNormalWorld),\n/* harmony export */ transformedTangentView: () => (/* reexport safe */ _accessors_TangentNode_js__WEBPACK_IMPORTED_MODULE_84__.transformedTangentView),\n/* harmony export */ transformedTangentWorld: () => (/* reexport safe */ _accessors_TangentNode_js__WEBPACK_IMPORTED_MODULE_84__.transformedTangentWorld),\n/* harmony export */ triNoise3D: () => (/* reexport safe */ _math_TriNoise3D_js__WEBPACK_IMPORTED_MODULE_35__.triNoise3D),\n/* harmony export */ triplanarTexture: () => (/* reexport safe */ _utils_TriplanarTexturesNode_js__WEBPACK_IMPORTED_MODULE_55__.triplanarTexture),\n/* harmony export */ triplanarTextures: () => (/* reexport safe */ _utils_TriplanarTexturesNode_js__WEBPACK_IMPORTED_MODULE_55__.triplanarTextures),\n/* harmony export */ trunc: () => (/* reexport safe */ _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__.trunc),\n/* harmony export */ tslFn: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.tslFn),\n/* harmony export */ uint: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.uint),\n/* harmony export */ umat2: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.umat2),\n/* harmony export */ umat3: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.umat3),\n/* harmony export */ umat4: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.umat4),\n/* harmony export */ uniform: () => (/* reexport safe */ _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_26__.uniform),\n/* harmony export */ uniformGroup: () => (/* reexport safe */ _core_UniformGroupNode_js__WEBPACK_IMPORTED_MODULE_25__.uniformGroup),\n/* harmony export */ uniforms: () => (/* reexport safe */ _accessors_UniformsNode_js__WEBPACK_IMPORTED_MODULE_59__.uniforms),\n/* harmony export */ userData: () => (/* reexport safe */ _accessors_UserDataNode_js__WEBPACK_IMPORTED_MODULE_88__.userData),\n/* harmony export */ uv: () => (/* reexport safe */ _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_87__.uv),\n/* harmony export */ uvec2: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.uvec2),\n/* harmony export */ uvec3: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.uvec3),\n/* harmony export */ uvec4: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.uvec4),\n/* harmony export */ varying: () => (/* reexport safe */ _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_27__.varying),\n/* harmony export */ varyingProperty: () => (/* reexport safe */ _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__.varyingProperty),\n/* harmony export */ vec2: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.vec2),\n/* harmony export */ vec3: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.vec3),\n/* harmony export */ vec4: () => (/* reexport safe */ _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__.vec4),\n/* harmony export */ vectorComponents: () => (/* reexport safe */ _core_constants_js__WEBPACK_IMPORTED_MODULE_0__.vectorComponents),\n/* harmony export */ vertexColor: () => (/* reexport safe */ _accessors_VertexColorNode_js__WEBPACK_IMPORTED_MODULE_64__.vertexColor),\n/* harmony export */ vertexIndex: () => (/* reexport safe */ _core_IndexNode_js__WEBPACK_IMPORTED_MODULE_7__.vertexIndex),\n/* harmony export */ vibrance: () => (/* reexport safe */ _display_ColorAdjustmentNode_js__WEBPACK_IMPORTED_MODULE_91__.vibrance),\n/* harmony export */ viewZToOrthographicDepth: () => (/* reexport safe */ _display_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_101__.viewZToOrthographicDepth),\n/* harmony export */ viewZToPerspectiveDepth: () => (/* reexport safe */ _display_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_101__.viewZToPerspectiveDepth),\n/* harmony export */ viewport: () => (/* reexport safe */ _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_97__.viewport),\n/* harmony export */ viewportBottomLeft: () => (/* reexport safe */ _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_97__.viewportBottomLeft),\n/* harmony export */ viewportBottomRight: () => (/* reexport safe */ _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_97__.viewportBottomRight),\n/* harmony export */ viewportCoordinate: () => (/* reexport safe */ _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_97__.viewportCoordinate),\n/* harmony export */ viewportDepthTexture: () => (/* reexport safe */ _display_ViewportDepthTextureNode_js__WEBPACK_IMPORTED_MODULE_100__.viewportDepthTexture),\n/* harmony export */ viewportMipTexture: () => (/* reexport safe */ _display_ViewportTextureNode_js__WEBPACK_IMPORTED_MODULE_98__.viewportMipTexture),\n/* harmony export */ viewportResolution: () => (/* reexport safe */ _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_97__.viewportResolution),\n/* harmony export */ viewportSharedTexture: () => (/* reexport safe */ _display_ViewportSharedTextureNode_js__WEBPACK_IMPORTED_MODULE_99__.viewportSharedTexture),\n/* harmony export */ viewportTexture: () => (/* reexport safe */ _display_ViewportTextureNode_js__WEBPACK_IMPORTED_MODULE_98__.viewportTexture),\n/* harmony export */ viewportTopLeft: () => (/* reexport safe */ _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_97__.viewportTopLeft),\n/* harmony export */ viewportTopRight: () => (/* reexport safe */ _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_97__.viewportTopRight),\n/* harmony export */ wgsl: () => (/* reexport safe */ _code_CodeNode_js__WEBPACK_IMPORTED_MODULE_107__.wgsl),\n/* harmony export */ wgslFn: () => (/* reexport safe */ _code_FunctionNode_js__WEBPACK_IMPORTED_MODULE_109__.wgslFn),\n/* harmony export */ xor: () => (/* reexport safe */ _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__.xor)\n/* harmony export */ });\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _core_AssignNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./core/AssignNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AssignNode.js\");\n/* harmony import */ var _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var _core_BypassNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./core/BypassNode.js */ \"./node_modules/three/examples/jsm/nodes/core/BypassNode.js\");\n/* harmony import */ var _core_CacheNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./core/CacheNode.js */ \"./node_modules/three/examples/jsm/nodes/core/CacheNode.js\");\n/* harmony import */ var _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./core/ConstNode.js */ \"./node_modules/three/examples/jsm/nodes/core/ConstNode.js\");\n/* harmony import */ var _core_ContextNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./core/ContextNode.js */ \"./node_modules/three/examples/jsm/nodes/core/ContextNode.js\");\n/* harmony import */ var _core_IndexNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./core/IndexNode.js */ \"./node_modules/three/examples/jsm/nodes/core/IndexNode.js\");\n/* harmony import */ var _core_LightingModel_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./core/LightingModel.js */ \"./node_modules/three/examples/jsm/nodes/core/LightingModel.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_VarNode_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./core/VarNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VarNode.js\");\n/* harmony import */ var _core_NodeAttribute_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./core/NodeAttribute.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeAttribute.js\");\n/* harmony import */ var _core_NodeBuilder_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./core/NodeBuilder.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeBuilder.js\");\n/* harmony import */ var _core_NodeCache_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./core/NodeCache.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeCache.js\");\n/* harmony import */ var _core_NodeCode_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./core/NodeCode.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeCode.js\");\n/* harmony import */ var _core_NodeFrame_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./core/NodeFrame.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeFrame.js\");\n/* harmony import */ var _core_NodeFunctionInput_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./core/NodeFunctionInput.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeFunctionInput.js\");\n/* harmony import */ var _core_NodeKeywords_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./core/NodeKeywords.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeKeywords.js\");\n/* harmony import */ var _core_NodeUniform_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./core/NodeUniform.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeUniform.js\");\n/* harmony import */ var _core_NodeVar_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./core/NodeVar.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeVar.js\");\n/* harmony import */ var _core_NodeVarying_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./core/NodeVarying.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeVarying.js\");\n/* harmony import */ var _core_ParameterNode_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./core/ParameterNode.js */ \"./node_modules/three/examples/jsm/nodes/core/ParameterNode.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _core_StackNode_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./core/StackNode.js */ \"./node_modules/three/examples/jsm/nodes/core/StackNode.js\");\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _core_UniformGroupNode_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./core/UniformGroupNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformGroupNode.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./core/VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n/* harmony import */ var _core_OutputStructNode_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./core/OutputStructNode.js */ \"./node_modules/three/examples/jsm/nodes/core/OutputStructNode.js\");\n/* harmony import */ var _core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./core/NodeUtils.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeUtils.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _math_CondNode_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./math/CondNode.js */ \"./node_modules/three/examples/jsm/nodes/math/CondNode.js\");\n/* harmony import */ var _math_HashNode_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./math/HashNode.js */ \"./node_modules/three/examples/jsm/nodes/math/HashNode.js\");\n/* harmony import */ var _math_MathUtils_js__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./math/MathUtils.js */ \"./node_modules/three/examples/jsm/nodes/math/MathUtils.js\");\n/* harmony import */ var _math_TriNoise3D_js__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./math/TriNoise3D.js */ \"./node_modules/three/examples/jsm/nodes/math/TriNoise3D.js\");\n/* harmony import */ var _utils_ArrayElementNode_js__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./utils/ArrayElementNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/ArrayElementNode.js\");\n/* harmony import */ var _utils_ConvertNode_js__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./utils/ConvertNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/ConvertNode.js\");\n/* harmony import */ var _utils_DiscardNode_js__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./utils/DiscardNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/DiscardNode.js\");\n/* harmony import */ var _utils_EquirectUVNode_js__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./utils/EquirectUVNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/EquirectUVNode.js\");\n/* harmony import */ var _utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./utils/FunctionOverloadingNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/FunctionOverloadingNode.js\");\n/* harmony import */ var _utils_JoinNode_js__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./utils/JoinNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/JoinNode.js\");\n/* harmony import */ var _utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./utils/LoopNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/LoopNode.js\");\n/* harmony import */ var _utils_MatcapUVNode_js__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./utils/MatcapUVNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/MatcapUVNode.js\");\n/* harmony import */ var _utils_MaxMipLevelNode_js__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./utils/MaxMipLevelNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/MaxMipLevelNode.js\");\n/* harmony import */ var _utils_OscNode_js__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./utils/OscNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/OscNode.js\");\n/* harmony import */ var _utils_PackingNode_js__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./utils/PackingNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/PackingNode.js\");\n/* harmony import */ var _utils_RemapNode_js__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./utils/RemapNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/RemapNode.js\");\n/* harmony import */ var _utils_RotateUVNode_js__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./utils/RotateUVNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/RotateUVNode.js\");\n/* harmony import */ var _utils_RotateNode_js__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./utils/RotateNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/RotateNode.js\");\n/* harmony import */ var _utils_SetNode_js__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./utils/SetNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/SetNode.js\");\n/* harmony import */ var _utils_SplitNode_js__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./utils/SplitNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/SplitNode.js\");\n/* harmony import */ var _utils_SpriteSheetUVNode_js__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./utils/SpriteSheetUVNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/SpriteSheetUVNode.js\");\n/* harmony import */ var _utils_StorageArrayElementNode_js__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./utils/StorageArrayElementNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/StorageArrayElementNode.js\");\n/* harmony import */ var _utils_TimerNode_js__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ./utils/TimerNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/TimerNode.js\");\n/* harmony import */ var _utils_TriplanarTexturesNode_js__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ./utils/TriplanarTexturesNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/TriplanarTexturesNode.js\");\n/* harmony import */ var _utils_ReflectorNode_js__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! ./utils/ReflectorNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/ReflectorNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(/*! ./shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _accessors_AccessorsUtils_js__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(/*! ./accessors/AccessorsUtils.js */ \"./node_modules/three/examples/jsm/nodes/accessors/AccessorsUtils.js\");\n/* harmony import */ var _accessors_UniformsNode_js__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(/*! ./accessors/UniformsNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UniformsNode.js\");\n/* harmony import */ var _accessors_BitangentNode_js__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(/*! ./accessors/BitangentNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BitangentNode.js\");\n/* harmony import */ var _accessors_BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(/*! ./accessors/BufferAttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BufferAttributeNode.js\");\n/* harmony import */ var _accessors_BufferNode_js__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(/*! ./accessors/BufferNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BufferNode.js\");\n/* harmony import */ var _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(/*! ./accessors/CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n/* harmony import */ var _accessors_VertexColorNode_js__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! ./accessors/VertexColorNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/VertexColorNode.js\");\n/* harmony import */ var _accessors_CubeTextureNode_js__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(/*! ./accessors/CubeTextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CubeTextureNode.js\");\n/* harmony import */ var _accessors_InstanceNode_js__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(/*! ./accessors/InstanceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/InstanceNode.js\");\n/* harmony import */ var _accessors_BatchNode_js__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(/*! ./accessors/BatchNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BatchNode.js\");\n/* harmony import */ var _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(/*! ./accessors/MaterialNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js\");\n/* harmony import */ var _accessors_MaterialReferenceNode_js__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(/*! ./accessors/MaterialReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialReferenceNode.js\");\n/* harmony import */ var _accessors_RendererReferenceNode_js__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(/*! ./accessors/RendererReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/RendererReferenceNode.js\");\n/* harmony import */ var _accessors_MorphNode_js__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(/*! ./accessors/MorphNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MorphNode.js\");\n/* harmony import */ var _accessors_TextureBicubicNode_js__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(/*! ./accessors/TextureBicubicNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureBicubicNode.js\");\n/* harmony import */ var _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(/*! ./accessors/ModelNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ModelNode.js\");\n/* harmony import */ var _accessors_ModelViewProjectionNode_js__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(/*! ./accessors/ModelViewProjectionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ModelViewProjectionNode.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(/*! ./accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(/*! ./accessors/Object3DNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/Object3DNode.js\");\n/* harmony import */ var _accessors_PointUVNode_js__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(/*! ./accessors/PointUVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PointUVNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(/*! ./accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _accessors_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(/*! ./accessors/ReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js\");\n/* harmony import */ var _accessors_ReflectVectorNode_js__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(/*! ./accessors/ReflectVectorNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ReflectVectorNode.js\");\n/* harmony import */ var _accessors_SkinningNode_js__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(/*! ./accessors/SkinningNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/SkinningNode.js\");\n/* harmony import */ var _accessors_SceneNode_js__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(/*! ./accessors/SceneNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/SceneNode.js\");\n/* harmony import */ var _accessors_StorageBufferNode_js__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(/*! ./accessors/StorageBufferNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/StorageBufferNode.js\");\n/* harmony import */ var _accessors_TangentNode_js__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(/*! ./accessors/TangentNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TangentNode.js\");\n/* harmony import */ var _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(/*! ./accessors/TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _accessors_TextureStoreNode_js__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__(/*! ./accessors/TextureStoreNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureStoreNode.js\");\n/* harmony import */ var _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__(/*! ./accessors/UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _accessors_UserDataNode_js__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__(/*! ./accessors/UserDataNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UserDataNode.js\");\n/* harmony import */ var _display_BlendModeNode_js__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__(/*! ./display/BlendModeNode.js */ \"./node_modules/three/examples/jsm/nodes/display/BlendModeNode.js\");\n/* harmony import */ var _display_BumpMapNode_js__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__(/*! ./display/BumpMapNode.js */ \"./node_modules/three/examples/jsm/nodes/display/BumpMapNode.js\");\n/* harmony import */ var _display_ColorAdjustmentNode_js__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__(/*! ./display/ColorAdjustmentNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ColorAdjustmentNode.js\");\n/* harmony import */ var _display_ColorSpaceNode_js__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__(/*! ./display/ColorSpaceNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ColorSpaceNode.js\");\n/* harmony import */ var _display_FrontFacingNode_js__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__(/*! ./display/FrontFacingNode.js */ \"./node_modules/three/examples/jsm/nodes/display/FrontFacingNode.js\");\n/* harmony import */ var _display_NormalMapNode_js__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__(/*! ./display/NormalMapNode.js */ \"./node_modules/three/examples/jsm/nodes/display/NormalMapNode.js\");\n/* harmony import */ var _display_PosterizeNode_js__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__(/*! ./display/PosterizeNode.js */ \"./node_modules/three/examples/jsm/nodes/display/PosterizeNode.js\");\n/* harmony import */ var _display_ToneMappingNode_js__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__(/*! ./display/ToneMappingNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ToneMappingNode.js\");\n/* harmony import */ var _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__(/*! ./display/ViewportNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportNode.js\");\n/* harmony import */ var _display_ViewportTextureNode_js__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__(/*! ./display/ViewportTextureNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportTextureNode.js\");\n/* harmony import */ var _display_ViewportSharedTextureNode_js__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__(/*! ./display/ViewportSharedTextureNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportSharedTextureNode.js\");\n/* harmony import */ var _display_ViewportDepthTextureNode_js__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__(/*! ./display/ViewportDepthTextureNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportDepthTextureNode.js\");\n/* harmony import */ var _display_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__(/*! ./display/ViewportDepthNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportDepthNode.js\");\n/* harmony import */ var _display_GaussianBlurNode_js__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__(/*! ./display/GaussianBlurNode.js */ \"./node_modules/three/examples/jsm/nodes/display/GaussianBlurNode.js\");\n/* harmony import */ var _display_AfterImageNode_js__WEBPACK_IMPORTED_MODULE_103__ = __webpack_require__(/*! ./display/AfterImageNode.js */ \"./node_modules/three/examples/jsm/nodes/display/AfterImageNode.js\");\n/* harmony import */ var _display_AnamorphicNode_js__WEBPACK_IMPORTED_MODULE_104__ = __webpack_require__(/*! ./display/AnamorphicNode.js */ \"./node_modules/three/examples/jsm/nodes/display/AnamorphicNode.js\");\n/* harmony import */ var _display_PassNode_js__WEBPACK_IMPORTED_MODULE_105__ = __webpack_require__(/*! ./display/PassNode.js */ \"./node_modules/three/examples/jsm/nodes/display/PassNode.js\");\n/* harmony import */ var _code_ExpressionNode_js__WEBPACK_IMPORTED_MODULE_106__ = __webpack_require__(/*! ./code/ExpressionNode.js */ \"./node_modules/three/examples/jsm/nodes/code/ExpressionNode.js\");\n/* harmony import */ var _code_CodeNode_js__WEBPACK_IMPORTED_MODULE_107__ = __webpack_require__(/*! ./code/CodeNode.js */ \"./node_modules/three/examples/jsm/nodes/code/CodeNode.js\");\n/* harmony import */ var _code_FunctionCallNode_js__WEBPACK_IMPORTED_MODULE_108__ = __webpack_require__(/*! ./code/FunctionCallNode.js */ \"./node_modules/three/examples/jsm/nodes/code/FunctionCallNode.js\");\n/* harmony import */ var _code_FunctionNode_js__WEBPACK_IMPORTED_MODULE_109__ = __webpack_require__(/*! ./code/FunctionNode.js */ \"./node_modules/three/examples/jsm/nodes/code/FunctionNode.js\");\n/* harmony import */ var _code_ScriptableNode_js__WEBPACK_IMPORTED_MODULE_110__ = __webpack_require__(/*! ./code/ScriptableNode.js */ \"./node_modules/three/examples/jsm/nodes/code/ScriptableNode.js\");\n/* harmony import */ var _code_ScriptableValueNode_js__WEBPACK_IMPORTED_MODULE_111__ = __webpack_require__(/*! ./code/ScriptableValueNode.js */ \"./node_modules/three/examples/jsm/nodes/code/ScriptableValueNode.js\");\n/* harmony import */ var _fog_FogNode_js__WEBPACK_IMPORTED_MODULE_112__ = __webpack_require__(/*! ./fog/FogNode.js */ \"./node_modules/three/examples/jsm/nodes/fog/FogNode.js\");\n/* harmony import */ var _fog_FogRangeNode_js__WEBPACK_IMPORTED_MODULE_113__ = __webpack_require__(/*! ./fog/FogRangeNode.js */ \"./node_modules/three/examples/jsm/nodes/fog/FogRangeNode.js\");\n/* harmony import */ var _fog_FogExp2Node_js__WEBPACK_IMPORTED_MODULE_114__ = __webpack_require__(/*! ./fog/FogExp2Node.js */ \"./node_modules/three/examples/jsm/nodes/fog/FogExp2Node.js\");\n/* harmony import */ var _geometry_RangeNode_js__WEBPACK_IMPORTED_MODULE_115__ = __webpack_require__(/*! ./geometry/RangeNode.js */ \"./node_modules/three/examples/jsm/nodes/geometry/RangeNode.js\");\n/* harmony import */ var _gpgpu_ComputeNode_js__WEBPACK_IMPORTED_MODULE_116__ = __webpack_require__(/*! ./gpgpu/ComputeNode.js */ \"./node_modules/three/examples/jsm/nodes/gpgpu/ComputeNode.js\");\n/* harmony import */ var _lighting_LightNode_js__WEBPACK_IMPORTED_MODULE_117__ = __webpack_require__(/*! ./lighting/LightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightNode.js\");\n/* harmony import */ var _lighting_PointLightNode_js__WEBPACK_IMPORTED_MODULE_118__ = __webpack_require__(/*! ./lighting/PointLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/PointLightNode.js\");\n/* harmony import */ var _lighting_DirectionalLightNode_js__WEBPACK_IMPORTED_MODULE_119__ = __webpack_require__(/*! ./lighting/DirectionalLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/DirectionalLightNode.js\");\n/* harmony import */ var _lighting_SpotLightNode_js__WEBPACK_IMPORTED_MODULE_120__ = __webpack_require__(/*! ./lighting/SpotLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/SpotLightNode.js\");\n/* harmony import */ var _lighting_IESSpotLightNode_js__WEBPACK_IMPORTED_MODULE_121__ = __webpack_require__(/*! ./lighting/IESSpotLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/IESSpotLightNode.js\");\n/* harmony import */ var _lighting_AmbientLightNode_js__WEBPACK_IMPORTED_MODULE_122__ = __webpack_require__(/*! ./lighting/AmbientLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/AmbientLightNode.js\");\n/* harmony import */ var _lighting_LightsNode_js__WEBPACK_IMPORTED_MODULE_123__ = __webpack_require__(/*! ./lighting/LightsNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightsNode.js\");\n/* harmony import */ var _lighting_LightingNode_js__WEBPACK_IMPORTED_MODULE_124__ = __webpack_require__(/*! ./lighting/LightingNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightingNode.js\");\n/* harmony import */ var _lighting_LightingContextNode_js__WEBPACK_IMPORTED_MODULE_125__ = __webpack_require__(/*! ./lighting/LightingContextNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightingContextNode.js\");\n/* harmony import */ var _lighting_HemisphereLightNode_js__WEBPACK_IMPORTED_MODULE_126__ = __webpack_require__(/*! ./lighting/HemisphereLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/HemisphereLightNode.js\");\n/* harmony import */ var _lighting_EnvironmentNode_js__WEBPACK_IMPORTED_MODULE_127__ = __webpack_require__(/*! ./lighting/EnvironmentNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/EnvironmentNode.js\");\n/* harmony import */ var _lighting_AONode_js__WEBPACK_IMPORTED_MODULE_128__ = __webpack_require__(/*! ./lighting/AONode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/AONode.js\");\n/* harmony import */ var _lighting_AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_129__ = __webpack_require__(/*! ./lighting/AnalyticLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/AnalyticLightNode.js\");\n/* harmony import */ var _pmrem_PMREMNode_js__WEBPACK_IMPORTED_MODULE_130__ = __webpack_require__(/*! ./pmrem/PMREMNode.js */ \"./node_modules/three/examples/jsm/nodes/pmrem/PMREMNode.js\");\n/* harmony import */ var _pmrem_PMREMUtils_js__WEBPACK_IMPORTED_MODULE_131__ = __webpack_require__(/*! ./pmrem/PMREMUtils.js */ \"./node_modules/three/examples/jsm/nodes/pmrem/PMREMUtils.js\");\n/* harmony import */ var _procedural_CheckerNode_js__WEBPACK_IMPORTED_MODULE_132__ = __webpack_require__(/*! ./procedural/CheckerNode.js */ \"./node_modules/three/examples/jsm/nodes/procedural/CheckerNode.js\");\n/* harmony import */ var _loaders_NodeLoader_js__WEBPACK_IMPORTED_MODULE_133__ = __webpack_require__(/*! ./loaders/NodeLoader.js */ \"./node_modules/three/examples/jsm/nodes/loaders/NodeLoader.js\");\n/* harmony import */ var _loaders_NodeObjectLoader_js__WEBPACK_IMPORTED_MODULE_134__ = __webpack_require__(/*! ./loaders/NodeObjectLoader.js */ \"./node_modules/three/examples/jsm/nodes/loaders/NodeObjectLoader.js\");\n/* harmony import */ var _loaders_NodeMaterialLoader_js__WEBPACK_IMPORTED_MODULE_135__ = __webpack_require__(/*! ./loaders/NodeMaterialLoader.js */ \"./node_modules/three/examples/jsm/nodes/loaders/NodeMaterialLoader.js\");\n/* harmony import */ var _parsers_GLSLNodeParser_js__WEBPACK_IMPORTED_MODULE_136__ = __webpack_require__(/*! ./parsers/GLSLNodeParser.js */ \"./node_modules/three/examples/jsm/nodes/parsers/GLSLNodeParser.js\");\n/* harmony import */ var _materials_Materials_js__WEBPACK_IMPORTED_MODULE_137__ = __webpack_require__(/*! ./materials/Materials.js */ \"./node_modules/three/examples/jsm/nodes/materials/Materials.js\");\n/* harmony import */ var _materialx_MaterialXNodes_js__WEBPACK_IMPORTED_MODULE_138__ = __webpack_require__(/*! ./materialx/MaterialXNodes.js */ \"./node_modules/three/examples/jsm/nodes/materialx/MaterialXNodes.js\");\n/* harmony import */ var _functions_BSDF_BRDF_GGX_js__WEBPACK_IMPORTED_MODULE_139__ = __webpack_require__(/*! ./functions/BSDF/BRDF_GGX.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js\");\n/* harmony import */ var _functions_BSDF_BRDF_Lambert_js__WEBPACK_IMPORTED_MODULE_140__ = __webpack_require__(/*! ./functions/BSDF/BRDF_Lambert.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js\");\n/* harmony import */ var _functions_BSDF_D_GGX_js__WEBPACK_IMPORTED_MODULE_141__ = __webpack_require__(/*! ./functions/BSDF/D_GGX.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/D_GGX.js\");\n/* harmony import */ var _functions_BSDF_DFGApprox_js__WEBPACK_IMPORTED_MODULE_142__ = __webpack_require__(/*! ./functions/BSDF/DFGApprox.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/DFGApprox.js\");\n/* harmony import */ var _functions_BSDF_F_Schlick_js__WEBPACK_IMPORTED_MODULE_143__ = __webpack_require__(/*! ./functions/BSDF/F_Schlick.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/F_Schlick.js\");\n/* harmony import */ var _functions_BSDF_Schlick_to_F0_js__WEBPACK_IMPORTED_MODULE_144__ = __webpack_require__(/*! ./functions/BSDF/Schlick_to_F0.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js\");\n/* harmony import */ var _functions_BSDF_V_GGX_SmithCorrelated_js__WEBPACK_IMPORTED_MODULE_145__ = __webpack_require__(/*! ./functions/BSDF/V_GGX_SmithCorrelated.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js\");\n/* harmony import */ var _lighting_LightUtils_js__WEBPACK_IMPORTED_MODULE_146__ = __webpack_require__(/*! ./lighting/LightUtils.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightUtils.js\");\n/* harmony import */ var _functions_material_getGeometryRoughness_js__WEBPACK_IMPORTED_MODULE_147__ = __webpack_require__(/*! ./functions/material/getGeometryRoughness.js */ \"./node_modules/three/examples/jsm/nodes/functions/material/getGeometryRoughness.js\");\n/* harmony import */ var _functions_material_getRoughness_js__WEBPACK_IMPORTED_MODULE_148__ = __webpack_require__(/*! ./functions/material/getRoughness.js */ \"./node_modules/three/examples/jsm/nodes/functions/material/getRoughness.js\");\n/* harmony import */ var _functions_PhongLightingModel_js__WEBPACK_IMPORTED_MODULE_149__ = __webpack_require__(/*! ./functions/PhongLightingModel.js */ \"./node_modules/three/examples/jsm/nodes/functions/PhongLightingModel.js\");\n/* harmony import */ var _functions_PhysicalLightingModel_js__WEBPACK_IMPORTED_MODULE_150__ = __webpack_require__(/*! ./functions/PhysicalLightingModel.js */ \"./node_modules/three/examples/jsm/nodes/functions/PhysicalLightingModel.js\");\n// @TODO: We can simplify \"export { default as SomeNode, other, exports } from '...'\" to just \"export * from '...'\" if we will use only named exports\n// this will also solve issues like \"import TempNode from '../core/Node.js'\"\n\n// constants\n\n\n// core\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// math\n\n\n\n\n\n\n// math utils\n\n\n\n// utils\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// shadernode\n\n\n// accessors\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// display\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// code\n\n\n\n\n\n\n\n// fog\n\n\n\n\n// geometry\n\n\n// gpgpu\n\n\n// lighting\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// pmrem\n\n\n\n// procedural\n\n\n// loaders\n\n\n\n\n// parsers\n // @TODO: Move to jsm/renderers/webgl.\n\n// materials\n\n\n// materialX\n\n\n// functions\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/Nodes.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/AccessorsUtils.js": +/*!***************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/AccessorsUtils.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TBNViewMatrix: () => (/* binding */ TBNViewMatrix),\n/* harmony export */ parallaxDirection: () => (/* binding */ parallaxDirection),\n/* harmony export */ parallaxUV: () => (/* binding */ parallaxUV)\n/* harmony export */ });\n/* harmony import */ var _BitangentNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BitangentNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BitangentNode.js\");\n/* harmony import */ var _NormalNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _TangentNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TangentNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TangentNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _PositionNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n\n\n\n\n\n\nconst TBNViewMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.mat3)( _TangentNode_js__WEBPACK_IMPORTED_MODULE_2__.tangentView, _BitangentNode_js__WEBPACK_IMPORTED_MODULE_0__.bitangentView, _NormalNode_js__WEBPACK_IMPORTED_MODULE_1__.normalView );\n\nconst parallaxDirection = _PositionNode_js__WEBPACK_IMPORTED_MODULE_4__.positionViewDirection.mul( TBNViewMatrix )/*.normalize()*/;\nconst parallaxUV = ( uv, scale ) => uv.sub( parallaxDirection.mul( scale ) );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/AccessorsUtils.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/BatchNode.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/BatchNode.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ batch: () => (/* binding */ batch),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _NormalNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _PositionNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _TextureNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _TextureSizeNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TextureSizeNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureSizeNode.js\");\n/* harmony import */ var _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var _TangentNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./TangentNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TangentNode.js\");\n\n\n\n\n\n\n\n\n\nclass BatchNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( batchMesh ) {\n\n\t\tsuper( 'void' );\n\n\t\tthis.batchMesh = batchMesh;\n\n\n\t\tthis.instanceColorNode = null;\n\n\t\tthis.batchingIdNode = null;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\t// POSITION\n\n\t\tif ( this.batchingIdNode === null ) {\n\n\t\t\tthis.batchingIdNode = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_6__.attribute)( 'batchId' );\n\n\t\t}\n\n\t\tconst matriceTexture = this.batchMesh._matricesTexture;\n\n\t\tconst size = (0,_TextureSizeNode_js__WEBPACK_IMPORTED_MODULE_5__.textureSize)( (0,_TextureNode_js__WEBPACK_IMPORTED_MODULE_4__.textureLoad)( matriceTexture ), 0 );\n\t\tconst j = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.float)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.int)( this.batchingIdNode ) ).mul( 4 ).toVar();\n\n\t\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.int)( j.mod( size ) );\n\t\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.int)( j ).div( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.int)( size ) );\n\t\tconst batchingMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.mat4)(\n\t\t\t(0,_TextureNode_js__WEBPACK_IMPORTED_MODULE_4__.textureLoad)( matriceTexture, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.ivec2)( x, y ) ),\n\t\t\t(0,_TextureNode_js__WEBPACK_IMPORTED_MODULE_4__.textureLoad)( matriceTexture, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.ivec2)( x.add( 1 ), y ) ),\n\t\t\t(0,_TextureNode_js__WEBPACK_IMPORTED_MODULE_4__.textureLoad)( matriceTexture, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.ivec2)( x.add( 2 ), y ) ),\n\t\t\t(0,_TextureNode_js__WEBPACK_IMPORTED_MODULE_4__.textureLoad)( matriceTexture, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.ivec2)( x.add( 3 ), y ) )\n\t\t);\n\n\n\t\tconst bm = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.mat3)(\n\t\t\tbatchingMatrix[ 0 ].xyz,\n\t\t\tbatchingMatrix[ 1 ].xyz,\n\t\t\tbatchingMatrix[ 2 ].xyz\n\t\t );\n\n\t\t_PositionNode_js__WEBPACK_IMPORTED_MODULE_2__.positionLocal.assign( batchingMatrix.mul( _PositionNode_js__WEBPACK_IMPORTED_MODULE_2__.positionLocal ) );\n\n\t\tconst transformedNormal = _NormalNode_js__WEBPACK_IMPORTED_MODULE_1__.normalLocal.div( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec3)( bm[ 0 ].dot( bm[ 0 ] ), bm[ 1 ].dot( bm[ 1 ] ), bm[ 2 ].dot( bm[ 2 ] ) ) );\n\n\t\tconst batchingNormal = bm.mul( transformedNormal ).xyz;\n\n\t\t_NormalNode_js__WEBPACK_IMPORTED_MODULE_1__.normalLocal.assign( batchingNormal );\n\n\t\tif ( builder.hasGeometryAttribute( 'tangent' ) ) {\n\n\t\t\t_TangentNode_js__WEBPACK_IMPORTED_MODULE_7__.tangentLocal.mulAssign( bm );\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BatchNode);\n\nconst batch = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( BatchNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'batch', BatchNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/BatchNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/BitangentNode.js": +/*!**************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/BitangentNode.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bitangentGeometry: () => (/* binding */ bitangentGeometry),\n/* harmony export */ bitangentLocal: () => (/* binding */ bitangentLocal),\n/* harmony export */ bitangentView: () => (/* binding */ bitangentView),\n/* harmony export */ bitangentWorld: () => (/* binding */ bitangentWorld),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ transformedBitangentView: () => (/* binding */ transformedBitangentView),\n/* harmony export */ transformedBitangentWorld: () => (/* binding */ transformedBitangentWorld)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _CameraNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n/* harmony import */ var _NormalNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _TangentNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TangentNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TangentNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\n\n\nclass BitangentNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope = BitangentNode.LOCAL ) {\n\n\t\tsuper( 'vec3' );\n\n\t\tthis.scope = scope;\n\n\t}\n\n\tgetHash( /*builder*/ ) {\n\n\t\treturn `bitangent-${this.scope}`;\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst scope = this.scope;\n\n\t\tlet crossNormalTangent;\n\n\t\tif ( scope === BitangentNode.GEOMETRY ) {\n\n\t\t\tcrossNormalTangent = _NormalNode_js__WEBPACK_IMPORTED_MODULE_4__.normalGeometry.cross( _TangentNode_js__WEBPACK_IMPORTED_MODULE_5__.tangentGeometry );\n\n\t\t} else if ( scope === BitangentNode.LOCAL ) {\n\n\t\t\tcrossNormalTangent = _NormalNode_js__WEBPACK_IMPORTED_MODULE_4__.normalLocal.cross( _TangentNode_js__WEBPACK_IMPORTED_MODULE_5__.tangentLocal );\n\n\t\t} else if ( scope === BitangentNode.VIEW ) {\n\n\t\t\tcrossNormalTangent = _NormalNode_js__WEBPACK_IMPORTED_MODULE_4__.normalView.cross( _TangentNode_js__WEBPACK_IMPORTED_MODULE_5__.tangentView );\n\n\t\t} else if ( scope === BitangentNode.WORLD ) {\n\n\t\t\tcrossNormalTangent = _NormalNode_js__WEBPACK_IMPORTED_MODULE_4__.normalWorld.cross( _TangentNode_js__WEBPACK_IMPORTED_MODULE_5__.tangentWorld );\n\n\t\t}\n\n\t\tconst vertexNode = crossNormalTangent.mul( _TangentNode_js__WEBPACK_IMPORTED_MODULE_5__.tangentGeometry.w ).xyz;\n\n\t\tconst outputNode = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.normalize)( (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_1__.varying)( vertexNode ) );\n\n\t\treturn outputNode.build( builder, this.getNodeType( builder ) );\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.scope = this.scope;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.scope = data.scope;\n\n\t}\n\n}\n\nBitangentNode.GEOMETRY = 'geometry';\nBitangentNode.LOCAL = 'local';\nBitangentNode.VIEW = 'view';\nBitangentNode.WORLD = 'world';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BitangentNode);\n\nconst bitangentGeometry = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.nodeImmutable)( BitangentNode, BitangentNode.GEOMETRY );\nconst bitangentLocal = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.nodeImmutable)( BitangentNode, BitangentNode.LOCAL );\nconst bitangentView = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.nodeImmutable)( BitangentNode, BitangentNode.VIEW );\nconst bitangentWorld = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.nodeImmutable)( BitangentNode, BitangentNode.WORLD );\nconst transformedBitangentView = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.normalize)( _NormalNode_js__WEBPACK_IMPORTED_MODULE_4__.transformedNormalView.cross( _TangentNode_js__WEBPACK_IMPORTED_MODULE_5__.transformedTangentView ).mul( _TangentNode_js__WEBPACK_IMPORTED_MODULE_5__.tangentGeometry.w ) );\nconst transformedBitangentWorld = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.normalize)( transformedBitangentView.transformDirection( _CameraNode_js__WEBPACK_IMPORTED_MODULE_3__.cameraViewMatrix ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'BitangentNode', BitangentNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/BitangentNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/BufferAttributeNode.js": +/*!********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/BufferAttributeNode.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bufferAttribute: () => (/* binding */ bufferAttribute),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ dynamicBufferAttribute: () => (/* binding */ dynamicBufferAttribute),\n/* harmony export */ instancedBufferAttribute: () => (/* binding */ instancedBufferAttribute),\n/* harmony export */ instancedDynamicBufferAttribute: () => (/* binding */ instancedDynamicBufferAttribute)\n/* harmony export */ });\n/* harmony import */ var _core_InputNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/InputNode.js */ \"./node_modules/three/examples/jsm/nodes/core/InputNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\nclass BufferAttributeNode extends _core_InputNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( value, bufferType = null, bufferStride = 0, bufferOffset = 0 ) {\n\n\t\tsuper( value, bufferType );\n\n\t\tthis.isBufferNode = true;\n\n\t\tthis.bufferType = bufferType;\n\t\tthis.bufferStride = bufferStride;\n\t\tthis.bufferOffset = bufferOffset;\n\n\t\tthis.usage = three__WEBPACK_IMPORTED_MODULE_4__.StaticDrawUsage;\n\t\tthis.instanced = false;\n\n\t\tthis.attribute = null;\n\n\t\tif ( value && value.isBufferAttribute === true ) {\n\n\t\t\tthis.attribute = value;\n\t\t\tthis.usage = value.usage;\n\t\t\tthis.instanced = value.isInstancedBufferAttribute;\n\n\t\t}\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\tif ( this.bufferType === null ) {\n\n\t\t\tthis.bufferType = builder.getTypeFromAttribute( this.attribute );\n\n\t\t}\n\n\t\treturn this.bufferType;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tif ( this.attribute !== null ) return;\n\n\t\tconst type = this.getNodeType( builder );\n\t\tconst array = this.value;\n\t\tconst itemSize = builder.getTypeLength( type );\n\t\tconst stride = this.bufferStride || itemSize;\n\t\tconst offset = this.bufferOffset;\n\n\t\tconst buffer = array.isInterleavedBuffer === true ? array : new three__WEBPACK_IMPORTED_MODULE_4__.InterleavedBuffer( array, stride );\n\t\tconst bufferAttribute = new three__WEBPACK_IMPORTED_MODULE_4__.InterleavedBufferAttribute( buffer, itemSize, offset );\n\n\t\tbuffer.setUsage( this.usage );\n\n\t\tthis.attribute = bufferAttribute;\n\t\tthis.attribute.isInstancedBufferAttribute = this.instanced; // @TODO: Add a possible: InstancedInterleavedBufferAttribute\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst nodeType = this.getNodeType( builder );\n\n\t\tconst nodeAttribute = builder.getBufferAttributeFromNode( this, nodeType );\n\t\tconst propertyName = builder.getPropertyName( nodeAttribute );\n\n\t\tlet output = null;\n\n\t\tif ( builder.shaderStage === 'vertex' || builder.shaderStage === 'compute' ) {\n\n\t\t\tthis.name = propertyName;\n\n\t\t\toutput = propertyName;\n\n\t\t} else {\n\n\t\t\tconst nodeVarying = (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__.varying)( this );\n\n\t\t\toutput = nodeVarying.build( builder, nodeType );\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n\tgetInputType( /*builder*/ ) {\n\n\t\treturn 'bufferAttribute';\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetInstanced( value ) {\n\n\t\tthis.instanced = value;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BufferAttributeNode);\n\nconst bufferAttribute = ( array, type, stride, offset ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeObject)( new BufferAttributeNode( array, type, stride, offset ) );\nconst dynamicBufferAttribute = ( array, type, stride, offset ) => bufferAttribute( array, type, stride, offset ).setUsage( three__WEBPACK_IMPORTED_MODULE_4__.DynamicDrawUsage );\n\nconst instancedBufferAttribute = ( array, type, stride, offset ) => bufferAttribute( array, type, stride, offset ).setInstanced( true );\nconst instancedDynamicBufferAttribute = ( array, type, stride, offset ) => dynamicBufferAttribute( array, type, stride, offset ).setInstanced( true );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'toAttribute', ( bufferNode ) => bufferAttribute( bufferNode.value ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'BufferAttributeNode', BufferAttributeNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/BufferAttributeNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/BufferNode.js": +/*!***********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/BufferNode.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ buffer: () => (/* binding */ buffer),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass BufferNode extends _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( value, bufferType, bufferCount = 0 ) {\n\n\t\tsuper( value, bufferType );\n\n\t\tthis.isBufferNode = true;\n\n\t\tthis.bufferType = bufferType;\n\t\tthis.bufferCount = bufferCount;\n\n\t}\n\n\tgetInputType( /*builder*/ ) {\n\n\t\treturn 'buffer';\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BufferNode);\n\nconst buffer = ( value, type, count ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new BufferNode( value, type, count ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'BufferNode', BufferNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/BufferNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js": +/*!***********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cameraFar: () => (/* binding */ cameraFar),\n/* harmony export */ cameraLogDepth: () => (/* binding */ cameraLogDepth),\n/* harmony export */ cameraNear: () => (/* binding */ cameraNear),\n/* harmony export */ cameraNormalMatrix: () => (/* binding */ cameraNormalMatrix),\n/* harmony export */ cameraPosition: () => (/* binding */ cameraPosition),\n/* harmony export */ cameraProjectionMatrix: () => (/* binding */ cameraProjectionMatrix),\n/* harmony export */ cameraProjectionMatrixInverse: () => (/* binding */ cameraProjectionMatrixInverse),\n/* harmony export */ cameraViewMatrix: () => (/* binding */ cameraViewMatrix),\n/* harmony export */ cameraWorldMatrix: () => (/* binding */ cameraWorldMatrix),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _Object3DNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Object3DNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/Object3DNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n//import { sharedUniformGroup } from '../core/UniformGroupNode.js';\n\n\n//const cameraGroup = sharedUniformGroup( 'camera' );\n\nclass CameraNode extends _Object3DNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope = CameraNode.POSITION ) {\n\n\t\tsuper( scope );\n\n\t\tthis.updateType = _core_constants_js__WEBPACK_IMPORTED_MODULE_2__.NodeUpdateType.RENDER;\n\n\t\t//this._uniformNode.groupNode = cameraGroup;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\tconst scope = this.scope;\n\n\t\tif ( scope === CameraNode.PROJECTION_MATRIX || scope === CameraNode.PROJECTION_MATRIX_INVERSE ) {\n\n\t\t\treturn 'mat4';\n\n\t\t} else if ( scope === CameraNode.NEAR || scope === CameraNode.FAR || scope === CameraNode.LOG_DEPTH ) {\n\n\t\t\treturn 'float';\n\n\t\t}\n\n\t\treturn super.getNodeType( builder );\n\n\t}\n\n\tupdate( frame ) {\n\n\t\tconst camera = frame.camera;\n\t\tconst uniformNode = this._uniformNode;\n\t\tconst scope = this.scope;\n\n\t\t//cameraGroup.needsUpdate = true;\n\n\t\tif ( scope === CameraNode.VIEW_MATRIX ) {\n\n\t\t\tuniformNode.value = camera.matrixWorldInverse;\n\n\t\t} else if ( scope === CameraNode.PROJECTION_MATRIX ) {\n\n\t\t\tuniformNode.value = camera.projectionMatrix;\n\n\t\t} else if ( scope === CameraNode.PROJECTION_MATRIX_INVERSE ) {\n\n\t\t\tuniformNode.value = camera.projectionMatrixInverse;\n\n\t\t} else if ( scope === CameraNode.NEAR ) {\n\n\t\t\tuniformNode.value = camera.near;\n\n\t\t} else if ( scope === CameraNode.FAR ) {\n\n\t\t\tuniformNode.value = camera.far;\n\n\t\t} else if ( scope === CameraNode.LOG_DEPTH ) {\n\n\t\t\tuniformNode.value = 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 );\n\n\t\t} else {\n\n\t\t\tthis.object3d = camera;\n\n\t\t\tsuper.update( frame );\n\n\t\t}\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst scope = this.scope;\n\n\t\tif ( scope === CameraNode.PROJECTION_MATRIX || scope === CameraNode.PROJECTION_MATRIX_INVERSE ) {\n\n\t\t\tthis._uniformNode.nodeType = 'mat4';\n\n\t\t} else if ( scope === CameraNode.NEAR || scope === CameraNode.FAR || scope === CameraNode.LOG_DEPTH ) {\n\n\t\t\tthis._uniformNode.nodeType = 'float';\n\n\t\t}\n\n\t\treturn super.generate( builder );\n\n\t}\n\n}\n\nCameraNode.PROJECTION_MATRIX = 'projectionMatrix';\nCameraNode.PROJECTION_MATRIX_INVERSE = 'projectionMatrixInverse';\nCameraNode.NEAR = 'near';\nCameraNode.FAR = 'far';\nCameraNode.LOG_DEPTH = 'logDepth';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CameraNode);\n\nconst cameraProjectionMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( CameraNode, CameraNode.PROJECTION_MATRIX );\nconst cameraProjectionMatrixInverse = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( CameraNode, CameraNode.PROJECTION_MATRIX_INVERSE );\nconst cameraNear = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( CameraNode, CameraNode.NEAR );\nconst cameraFar = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( CameraNode, CameraNode.FAR );\nconst cameraLogDepth = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( CameraNode, CameraNode.LOG_DEPTH );\nconst cameraViewMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( CameraNode, CameraNode.VIEW_MATRIX );\nconst cameraNormalMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( CameraNode, CameraNode.NORMAL_MATRIX );\nconst cameraWorldMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( CameraNode, CameraNode.WORLD_MATRIX );\nconst cameraPosition = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( CameraNode, CameraNode.POSITION );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'CameraNode', CameraNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/ClippingNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/ClippingNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clipping: () => (/* binding */ clipping),\n/* harmony export */ clippingAlpha: () => (/* binding */ clippingAlpha),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _PositionNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/LoopNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/LoopNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _UniformsNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./UniformsNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UniformsNode.js\");\n\n\n\n\n\n\n\n\n\n\nclass ClippingNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope = ClippingNode.DEFAULT ) {\n\n\t\tsuper();\n\n\t\tthis.scope = scope;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tsuper.setup( builder );\n\n\t\tconst clippingContext = builder.clippingContext;\n\t\tconst { localClipIntersection, localClippingCount, globalClippingCount } = clippingContext;\n\n\t\tconst numClippingPlanes = globalClippingCount + localClippingCount;\n\t\tconst numUnionClippingPlanes = localClipIntersection ? numClippingPlanes - localClippingCount : numClippingPlanes;\n\n\t\tif ( this.scope === ClippingNode.ALPHA_TO_COVERAGE ) {\n\n\t\t\treturn this.setupAlphaToCoverage( clippingContext.planes, numClippingPlanes, numUnionClippingPlanes );\n\n\t\t} else {\n\n\t\t\treturn this.setupDefault( clippingContext.planes, numClippingPlanes, numUnionClippingPlanes );\n\n\t\t}\n\n\t}\n\n\tsetupAlphaToCoverage( planes, numClippingPlanes, numUnionClippingPlanes ) {\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.tslFn)( () => {\n\n\t\t\tconst clippingPlanes = (0,_UniformsNode_js__WEBPACK_IMPORTED_MODULE_6__.uniforms)( planes );\n\n\t\t\tconst distanceToPlane = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.property)( 'float', 'distanceToPlane' );\n\t\t\tconst distanceGradient = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.property)( 'float', 'distanceToGradient' );\n\n\t\t\tconst clipOpacity = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.property)( 'float', 'clipOpacity' );\n\n\t\t\tclipOpacity.assign( 1 );\n\n\t\t\tlet plane;\n\n\t\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_4__.loop)( numUnionClippingPlanes, ( { i } ) => {\n\n\t\t\t\tplane = clippingPlanes.element( i );\n\n\t\t\t\tdistanceToPlane.assign( _PositionNode_js__WEBPACK_IMPORTED_MODULE_2__.positionView.dot( plane.xyz ).negate().add( plane.w ) );\n\t\t\t\tdistanceGradient.assign( distanceToPlane.fwidth().div( 2.0 ) );\n\n\t\t\t\tclipOpacity.mulAssign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_5__.smoothstep)( distanceGradient.negate(), distanceGradient, distanceToPlane ) );\n\n\t\t\t\tclipOpacity.equal( 0.0 ).discard();\n\n\t\t\t} );\n\n\t\t\tif ( numUnionClippingPlanes < numClippingPlanes ) {\n\n\t\t\t\tconst unionClipOpacity = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.property)( 'float', 'unionclipOpacity' );\n\n\t\t\t\tunionClipOpacity.assign( 1 );\n\n\t\t\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_4__.loop)( { start: numUnionClippingPlanes, end: numClippingPlanes }, ( { i } ) => {\n\n\t\t\t\t\tplane = clippingPlanes.element( i );\n\n\t\t\t\t\tdistanceToPlane.assign( _PositionNode_js__WEBPACK_IMPORTED_MODULE_2__.positionView.dot( plane.xyz ).negate().add( plane.w ) );\n\t\t\t\t\tdistanceGradient.assign( distanceToPlane.fwidth().div( 2.0 ) );\n\n\t\t\t\t\tunionClipOpacity.mulAssign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_5__.smoothstep)( distanceGradient.negate(), distanceGradient, distanceToPlane ).oneMinus() );\n\n\t\t\t\t} );\n\n\t\t\t\tclipOpacity.mulAssign( unionClipOpacity.oneMinus() );\n\n\t\t\t}\n\n\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.diffuseColor.a.mulAssign( clipOpacity );\n\n\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.diffuseColor.a.equal( 0.0 ).discard();\n\n\t\t} )();\n\n\t}\n\n\tsetupDefault( planes, numClippingPlanes, numUnionClippingPlanes ) {\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.tslFn)( () => {\n\n\t\t\tconst clippingPlanes = (0,_UniformsNode_js__WEBPACK_IMPORTED_MODULE_6__.uniforms)( planes );\n\n\t\t\tlet plane;\n\n\t\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_4__.loop)( numUnionClippingPlanes, ( { i } ) => {\n\n\t\t\t\tplane = clippingPlanes.element( i );\n\t\t\t\t_PositionNode_js__WEBPACK_IMPORTED_MODULE_2__.positionView.dot( plane.xyz ).greaterThan( plane.w ).discard();\n\n\t\t\t} );\n\n\t\t\tif ( numUnionClippingPlanes < numClippingPlanes ) {\n\n\t\t\t\tconst clipped = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.property)( 'bool', 'clipped' );\n\n\t\t\t\tclipped.assign( true );\n\n\t\t\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_4__.loop)( { start: numUnionClippingPlanes, end: numClippingPlanes }, ( { i } ) => {\n\n\t\t\t\t\tplane = clippingPlanes.element( i );\n\t\t\t\t\tclipped.assign( _PositionNode_js__WEBPACK_IMPORTED_MODULE_2__.positionView.dot( plane.xyz ).greaterThan( plane.w ).and( clipped ) );\n\n\t\t\t\t} );\n\n\t\t\t\tclipped.discard();\n\t\t\t}\n\n\t\t} )();\n\n\t}\n\n}\n\nClippingNode.ALPHA_TO_COVERAGE = 'alphaToCoverage';\nClippingNode.DEFAULT = 'default';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ClippingNode);\n\nconst clipping = () => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( new ClippingNode() );\n\nconst clippingAlpha = () => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( new ClippingNode( ClippingNode.ALPHA_TO_COVERAGE ) );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/ClippingNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/CubeTextureNode.js": +/*!****************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/CubeTextureNode.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cubeTexture: () => (/* binding */ cubeTexture),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _TextureNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _ReflectVectorNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ReflectVectorNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ReflectVectorNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\nclass CubeTextureNode extends _TextureNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( value, uvNode = null, levelNode = null ) {\n\n\t\tsuper( value, uvNode, levelNode );\n\n\t\tthis.isCubeTextureNode = true;\n\n\t}\n\n\tgetInputType( /*builder*/ ) {\n\n\t\treturn 'cubeTexture';\n\n\t}\n\n\tgetDefaultUV() {\n\n\t\treturn _ReflectVectorNode_js__WEBPACK_IMPORTED_MODULE_1__.reflectVector;\n\n\t}\n\n\tsetUpdateMatrix( /*updateMatrix*/ ) { } // Ignore .updateMatrix for CubeTextureNode\n\n\tsetupUV( builder, uvNode ) {\n\n\t\tconst texture = this.value;\n\n\t\tif ( builder.renderer.coordinateSystem === three__WEBPACK_IMPORTED_MODULE_4__.WebGPUCoordinateSystem || ! texture.isRenderTargetTexture ) {\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec3)( uvNode.x.negate(), uvNode.yz );\n\n\t\t} else {\n\n\t\t\treturn uvNode;\n\n\t\t}\n\n\t}\n\n\tgenerateUV( builder, cubeUV ) {\n\n\t\treturn cubeUV.build( builder, 'vec3' );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CubeTextureNode);\n\nconst cubeTexture = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( CubeTextureNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'cubeTexture', cubeTexture );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_2__.addNodeClass)( 'CubeTextureNode', CubeTextureNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/CubeTextureNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/InstanceNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/InstanceNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ instance: () => (/* binding */ instance)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BufferAttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BufferAttributeNode.js\");\n/* harmony import */ var _NormalNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _PositionNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\nclass InstanceNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( instanceMesh ) {\n\n\t\tsuper( 'void' );\n\n\t\tthis.instanceMesh = instanceMesh;\n\n\t\tthis.instanceMatrixNode = null;\n\n\t\tthis.instanceColorNode = null;\n\n\t}\n\n\tsetup( /*builder*/ ) {\n\n\t\tlet instanceMatrixNode = this.instanceMatrixNode;\n\n\t\tconst instanceMesh = this.instanceMesh;\n\n\t\tif ( instanceMatrixNode === null ) {\n\n\t\t\tconst instanceAttribute = instanceMesh.instanceMatrix;\n\t\t\tconst buffer = new three__WEBPACK_IMPORTED_MODULE_6__.InstancedInterleavedBuffer( instanceAttribute.array, 16, 1 );\n\n\t\t\tconst bufferFn = instanceAttribute.usage === three__WEBPACK_IMPORTED_MODULE_6__.DynamicDrawUsage ? _BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_2__.instancedDynamicBufferAttribute : _BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_2__.instancedBufferAttribute;\n\n\t\t\tconst instanceBuffers = [\n\t\t\t\t// F.Signature -> bufferAttribute( array, type, stride, offset )\n\t\t\t\tbufferFn( buffer, 'vec4', 16, 0 ),\n\t\t\t\tbufferFn( buffer, 'vec4', 16, 4 ),\n\t\t\t\tbufferFn( buffer, 'vec4', 16, 8 ),\n\t\t\t\tbufferFn( buffer, 'vec4', 16, 12 )\n\t\t\t];\n\n\t\t\tinstanceMatrixNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.mat4)( ...instanceBuffers );\n\n\t\t\tthis.instanceMatrixNode = instanceMatrixNode;\n\n\t\t}\n\n\t\tconst instanceColorAttribute = instanceMesh.instanceColor;\n\n\t\tif ( instanceColorAttribute && this.instanceColorNode === null ) {\n\n\t\t\tconst buffer = new three__WEBPACK_IMPORTED_MODULE_6__.InstancedBufferAttribute( instanceColorAttribute.array, 3 );\n\t\t\tconst bufferFn = instanceColorAttribute.usage === three__WEBPACK_IMPORTED_MODULE_6__.DynamicDrawUsage ? _BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_2__.instancedDynamicBufferAttribute : _BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_2__.instancedBufferAttribute;\n\n\t\t\tthis.instanceColorNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.vec3)( bufferFn( buffer, 'vec3', 3, 0 ) );\n\n\t\t}\n\n\t\t// POSITION\n\n\t\tconst instancePosition = instanceMatrixNode.mul( _PositionNode_js__WEBPACK_IMPORTED_MODULE_4__.positionLocal ).xyz;\n\n\t\t// NORMAL\n\n\t\tconst m = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.mat3)( instanceMatrixNode[ 0 ].xyz, instanceMatrixNode[ 1 ].xyz, instanceMatrixNode[ 2 ].xyz );\n\n\t\tconst transformedNormal = _NormalNode_js__WEBPACK_IMPORTED_MODULE_3__.normalLocal.div( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.vec3)( m[ 0 ].dot( m[ 0 ] ), m[ 1 ].dot( m[ 1 ] ), m[ 2 ].dot( m[ 2 ] ) ) );\n\n\t\tconst instanceNormal = m.mul( transformedNormal ).xyz;\n\n\t\t// ASSIGNS\n\n\t\t_PositionNode_js__WEBPACK_IMPORTED_MODULE_4__.positionLocal.assign( instancePosition );\n\t\t_NormalNode_js__WEBPACK_IMPORTED_MODULE_3__.normalLocal.assign( instanceNormal );\n\n\t\t// COLOR\n\n\t\tif ( this.instanceColorNode !== null ) {\n\n\t\t\t(0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__.varyingProperty)( 'vec3', 'vInstanceColor' ).assign( this.instanceColorNode );\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (InstanceNode);\n\nconst instance = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeProxy)( InstanceNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'InstanceNode', InstanceNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/InstanceNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ materialAlphaTest: () => (/* binding */ materialAlphaTest),\n/* harmony export */ materialClearcoat: () => (/* binding */ materialClearcoat),\n/* harmony export */ materialClearcoatNormal: () => (/* binding */ materialClearcoatNormal),\n/* harmony export */ materialClearcoatRoughness: () => (/* binding */ materialClearcoatRoughness),\n/* harmony export */ materialColor: () => (/* binding */ materialColor),\n/* harmony export */ materialEmissive: () => (/* binding */ materialEmissive),\n/* harmony export */ materialIridescence: () => (/* binding */ materialIridescence),\n/* harmony export */ materialIridescenceIOR: () => (/* binding */ materialIridescenceIOR),\n/* harmony export */ materialIridescenceThickness: () => (/* binding */ materialIridescenceThickness),\n/* harmony export */ materialLineDashOffset: () => (/* binding */ materialLineDashOffset),\n/* harmony export */ materialLineDashSize: () => (/* binding */ materialLineDashSize),\n/* harmony export */ materialLineGapSize: () => (/* binding */ materialLineGapSize),\n/* harmony export */ materialLineScale: () => (/* binding */ materialLineScale),\n/* harmony export */ materialLineWidth: () => (/* binding */ materialLineWidth),\n/* harmony export */ materialMetalness: () => (/* binding */ materialMetalness),\n/* harmony export */ materialNormal: () => (/* binding */ materialNormal),\n/* harmony export */ materialOpacity: () => (/* binding */ materialOpacity),\n/* harmony export */ materialPointWidth: () => (/* binding */ materialPointWidth),\n/* harmony export */ materialReflectivity: () => (/* binding */ materialReflectivity),\n/* harmony export */ materialRotation: () => (/* binding */ materialRotation),\n/* harmony export */ materialRoughness: () => (/* binding */ materialRoughness),\n/* harmony export */ materialSheen: () => (/* binding */ materialSheen),\n/* harmony export */ materialSheenRoughness: () => (/* binding */ materialSheenRoughness),\n/* harmony export */ materialShininess: () => (/* binding */ materialShininess),\n/* harmony export */ materialSpecularColor: () => (/* binding */ materialSpecularColor),\n/* harmony export */ materialSpecularStrength: () => (/* binding */ materialSpecularStrength)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _ReferenceNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js\");\n/* harmony import */ var _MaterialReferenceNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./MaterialReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialReferenceNode.js\");\n/* harmony import */ var _NormalNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\nconst _propertyCache = new Map();\n\nclass MaterialNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope ) {\n\n\t\tsuper();\n\n\t\tthis.scope = scope;\n\n\t}\n\n\tgetCache( property, type ) {\n\n\t\tlet node = _propertyCache.get( property );\n\n\t\tif ( node === undefined ) {\n\n\t\t\tnode = (0,_MaterialReferenceNode_js__WEBPACK_IMPORTED_MODULE_2__.materialReference)( property, type );\n\n\t\t\t_propertyCache.set( property, node );\n\n\t\t}\n\n\t\treturn node;\n\n\t}\n\n\tgetFloat( property ) {\n\n\t\treturn this.getCache( property, 'float' );\n\n\t}\n\n\tgetColor( property ) {\n\n\t\treturn this.getCache( property, 'color' );\n\n\t}\n\n\tgetTexture( property ) {\n\n\t\treturn this.getCache( property === 'map' ? 'map' : property + 'Map', 'texture' );\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst material = builder.context.material;\n\t\tconst scope = this.scope;\n\n\t\tlet node = null;\n\n\t\tif ( scope === MaterialNode.COLOR ) {\n\n\t\t\tconst colorNode = this.getColor( scope );\n\n\t\t\tif ( material.map && material.map.isTexture === true ) {\n\n\t\t\t\tnode = colorNode.mul( this.getTexture( 'map' ) );\n\n\t\t\t} else {\n\n\t\t\t\tnode = colorNode;\n\n\t\t\t}\n\n\t\t} else if ( scope === MaterialNode.OPACITY ) {\n\n\t\t\tconst opacityNode = this.getFloat( scope );\n\n\t\t\tif ( material.alphaMap && material.alphaMap.isTexture === true ) {\n\n\t\t\t\tnode = opacityNode.mul( this.getTexture( 'alpha' ) );\n\n\t\t\t} else {\n\n\t\t\t\tnode = opacityNode;\n\n\t\t\t}\n\n\t\t} else if ( scope === MaterialNode.SPECULAR_STRENGTH ) {\n\n\t\t\tif ( material.specularMap && material.specularMap.isTexture === true ) {\n\n\t\t\t\tnode = this.getTexture( scope ).r;\n\n\t\t\t} else {\n\n\t\t\t\tnode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.float)( 1 );\n\n\t\t\t}\n\n\t\t} else if ( scope === MaterialNode.ROUGHNESS ) { // TODO: cleanup similar branches\n\n\t\t\tconst roughnessNode = this.getFloat( scope );\n\n\t\t\tif ( material.roughnessMap && material.roughnessMap.isTexture === true ) {\n\n\t\t\t\tnode = roughnessNode.mul( this.getTexture( scope ).g );\n\n\t\t\t} else {\n\n\t\t\t\tnode = roughnessNode;\n\n\t\t\t}\n\n\t\t} else if ( scope === MaterialNode.METALNESS ) {\n\n\t\t\tconst metalnessNode = this.getFloat( scope );\n\n\t\t\tif ( material.metalnessMap && material.metalnessMap.isTexture === true ) {\n\n\t\t\t\tnode = metalnessNode.mul( this.getTexture( scope ).b );\n\n\t\t\t} else {\n\n\t\t\t\tnode = metalnessNode;\n\n\t\t\t}\n\n\t\t} else if ( scope === MaterialNode.EMISSIVE ) {\n\n\t\t\tconst emissiveNode = this.getColor( scope );\n\n\t\t\tif ( material.emissiveMap && material.emissiveMap.isTexture === true ) {\n\n\t\t\t\tnode = emissiveNode.mul( this.getTexture( scope ) );\n\n\t\t\t} else {\n\n\t\t\t\tnode = emissiveNode;\n\n\t\t\t}\n\n\t\t} else if ( scope === MaterialNode.NORMAL ) {\n\n\t\t\tif ( material.normalMap ) {\n\n\t\t\t\tnode = this.getTexture( 'normal' ).normalMap( this.getCache( 'normalScale', 'vec2' ) );\n\n\t\t\t} else if ( material.bumpMap ) {\n\n\t\t\t\tnode = this.getTexture( 'bump' ).r.bumpMap( this.getFloat( 'bumpScale' ) );\n\n\t\t\t} else {\n\n\t\t\t\tnode = _NormalNode_js__WEBPACK_IMPORTED_MODULE_3__.normalView;\n\n\t\t\t}\n\n\t\t} else if ( scope === MaterialNode.CLEARCOAT ) {\n\n\t\t\tconst clearcoatNode = this.getFloat( scope );\n\n\t\t\tif ( material.clearcoatMap && material.clearcoatMap.isTexture === true ) {\n\n\t\t\t\tnode = clearcoatNode.mul( this.getTexture( scope ).r );\n\n\t\t\t} else {\n\n\t\t\t\tnode = clearcoatNode;\n\n\t\t\t}\n\n\t\t} else if ( scope === MaterialNode.CLEARCOAT_ROUGHNESS ) {\n\n\t\t\tconst clearcoatRoughnessNode = this.getFloat( scope );\n\n\t\t\tif ( material.clearcoatRoughnessMap && material.clearcoatRoughnessMap.isTexture === true ) {\n\n\t\t\t\tnode = clearcoatRoughnessNode.mul( this.getTexture( scope ).r );\n\n\t\t\t} else {\n\n\t\t\t\tnode = clearcoatRoughnessNode;\n\n\t\t\t}\n\n\t\t} else if ( scope === MaterialNode.CLEARCOAT_NORMAL ) {\n\n\t\t\tif ( material.clearcoatNormalMap ) {\n\n\t\t\t\tnode = this.getTexture( scope ).normalMap( this.getCache( scope + 'Scale', 'vec2' ) );\n\n\t\t\t} else {\n\n\t\t\t\tnode = _NormalNode_js__WEBPACK_IMPORTED_MODULE_3__.normalView;\n\n\t\t\t}\n\n\t\t} else if ( scope === MaterialNode.SHEEN ) {\n\n\t\t\tconst sheenNode = this.getColor( 'sheenColor' ).mul( this.getFloat( 'sheen' ) ); // Move this mul() to CPU\n\n\t\t\tif ( material.sheenColorMap && material.sheenColorMap.isTexture === true ) {\n\n\t\t\t\tnode = sheenNode.mul( this.getTexture( 'sheenColor' ).rgb );\n\n\t\t\t} else {\n\n\t\t\t\tnode = sheenNode;\n\n\t\t\t}\n\n\t\t} else if ( scope === MaterialNode.SHEEN_ROUGHNESS ) {\n\n\t\t\tconst sheenRoughnessNode = this.getFloat( scope );\n\n\t\t\tif ( material.sheenRoughnessMap && material.sheenRoughnessMap.isTexture === true ) {\n\n\t\t\t\tnode = sheenRoughnessNode.mul( this.getTexture( scope ).a );\n\n\t\t\t} else {\n\n\t\t\t\tnode = sheenRoughnessNode;\n\n\t\t\t}\n\n\t\t\tnode = node.clamp( 0.07, 1.0 );\n\n\t\t} else if ( scope === MaterialNode.IRIDESCENCE_THICKNESS ) {\n\n\t\t\tconst iridescenceThicknessMaximum = (0,_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_1__.reference)( '1', 'float', material.iridescenceThicknessRange );\n\n\t\t\tif ( material.iridescenceThicknessMap ) {\n\n\t\t\t\tconst iridescenceThicknessMinimum = (0,_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_1__.reference)( '0', 'float', material.iridescenceThicknessRange );\n\n\t\t\t\tnode = iridescenceThicknessMaximum.sub( iridescenceThicknessMinimum ).mul( this.getTexture( scope ).g ).add( iridescenceThicknessMinimum );\n\n\t\t\t} else {\n\n\t\t\t\tnode = iridescenceThicknessMaximum;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst outputType = this.getNodeType( builder );\n\n\t\t\tnode = this.getCache( scope, outputType );\n\n\t\t}\n\n\t\treturn node;\n\n\t}\n\n}\n\nMaterialNode.ALPHA_TEST = 'alphaTest';\nMaterialNode.COLOR = 'color';\nMaterialNode.OPACITY = 'opacity';\nMaterialNode.SHININESS = 'shininess';\nMaterialNode.SPECULAR_COLOR = 'specular';\nMaterialNode.SPECULAR_STRENGTH = 'specularStrength';\nMaterialNode.REFLECTIVITY = 'reflectivity';\nMaterialNode.ROUGHNESS = 'roughness';\nMaterialNode.METALNESS = 'metalness';\nMaterialNode.NORMAL = 'normal';\nMaterialNode.CLEARCOAT = 'clearcoat';\nMaterialNode.CLEARCOAT_ROUGHNESS = 'clearcoatRoughness';\nMaterialNode.CLEARCOAT_NORMAL = 'clearcoatNormal';\nMaterialNode.EMISSIVE = 'emissive';\nMaterialNode.ROTATION = 'rotation';\nMaterialNode.SHEEN = 'sheen';\nMaterialNode.SHEEN_ROUGHNESS = 'sheenRoughness';\nMaterialNode.IRIDESCENCE = 'iridescence';\nMaterialNode.IRIDESCENCE_IOR = 'iridescenceIOR';\nMaterialNode.IRIDESCENCE_THICKNESS = 'iridescenceThickness';\nMaterialNode.LINE_SCALE = 'scale';\nMaterialNode.LINE_DASH_SIZE = 'dashSize';\nMaterialNode.LINE_GAP_SIZE = 'gapSize';\nMaterialNode.LINE_WIDTH = 'linewidth';\nMaterialNode.LINE_DASH_OFFSET = 'dashOffset';\nMaterialNode.POINT_WIDTH = 'pointWidth';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MaterialNode);\n\nconst materialAlphaTest = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.ALPHA_TEST );\nconst materialColor = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.COLOR );\nconst materialShininess = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.SHININESS );\nconst materialEmissive = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.EMISSIVE );\nconst materialOpacity = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.OPACITY );\nconst materialSpecularColor = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.SPECULAR_COLOR );\nconst materialSpecularStrength = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.SPECULAR_STRENGTH );\nconst materialReflectivity = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.REFLECTIVITY );\nconst materialRoughness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.ROUGHNESS );\nconst materialMetalness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.METALNESS );\nconst materialNormal = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.NORMAL );\nconst materialClearcoat = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.CLEARCOAT );\nconst materialClearcoatRoughness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.CLEARCOAT_ROUGHNESS );\nconst materialClearcoatNormal = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.CLEARCOAT_NORMAL );\nconst materialRotation = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.ROTATION );\nconst materialSheen = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.SHEEN );\nconst materialSheenRoughness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.SHEEN_ROUGHNESS );\nconst materialIridescence = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.IRIDESCENCE );\nconst materialIridescenceIOR = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.IRIDESCENCE_IOR );\nconst materialIridescenceThickness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.IRIDESCENCE_THICKNESS );\nconst materialLineScale = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.LINE_SCALE );\nconst materialLineDashSize = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.LINE_DASH_SIZE );\nconst materialLineGapSize = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.LINE_GAP_SIZE );\nconst materialLineWidth = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.LINE_WIDTH );\nconst materialLineDashOffset = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.LINE_DASH_OFFSET );\nconst materialPointWidth = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( MaterialNode, MaterialNode.POINT_WIDTH );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'MaterialNode', MaterialNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/MaterialReferenceNode.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/MaterialReferenceNode.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ materialReference: () => (/* binding */ materialReference)\n/* harmony export */ });\n/* harmony import */ var _ReferenceNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n//import { renderGroup } from '../core/UniformGroupNode.js';\n//import { NodeUpdateType } from '../core/constants.js';\n\n\n\nclass MaterialReferenceNode extends _ReferenceNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( property, inputType, material = null ) {\n\n\t\tsuper( property, inputType, material );\n\n\t\tthis.material = material;\n\n\t\t//this.updateType = NodeUpdateType.RENDER;\n\n\t}\n\n\t/*setNodeType( node ) {\n\n\t\tsuper.setNodeType( node );\n\n\t\tthis.node.groupNode = renderGroup;\n\n\t}*/\n\n\tupdateReference( state ) {\n\n\t\tthis.reference = this.material !== null ? this.material : state.material;\n\n\t\treturn this.reference;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MaterialReferenceNode);\n\nconst materialReference = ( name, type, material ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new MaterialReferenceNode( name, type, material ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'MaterialReferenceNode', MaterialReferenceNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/MaterialReferenceNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/ModelNode.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/ModelNode.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ modelDirection: () => (/* binding */ modelDirection),\n/* harmony export */ modelNormalMatrix: () => (/* binding */ modelNormalMatrix),\n/* harmony export */ modelPosition: () => (/* binding */ modelPosition),\n/* harmony export */ modelScale: () => (/* binding */ modelScale),\n/* harmony export */ modelViewMatrix: () => (/* binding */ modelViewMatrix),\n/* harmony export */ modelViewPosition: () => (/* binding */ modelViewPosition),\n/* harmony export */ modelWorldMatrix: () => (/* binding */ modelWorldMatrix)\n/* harmony export */ });\n/* harmony import */ var _Object3DNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Object3DNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/Object3DNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass ModelNode extends _Object3DNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope = ModelNode.VIEW_MATRIX ) {\n\n\t\tsuper( scope );\n\n\t}\n\n\tupdate( frame ) {\n\n\t\tthis.object3d = frame.object;\n\n\t\tsuper.update( frame );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ModelNode);\n\nconst modelDirection = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeImmutable)( ModelNode, ModelNode.DIRECTION );\nconst modelViewMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeImmutable)( ModelNode, ModelNode.VIEW_MATRIX ).label( 'modelViewMatrix' ).temp( 'ModelViewMatrix' );\nconst modelNormalMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeImmutable)( ModelNode, ModelNode.NORMAL_MATRIX );\nconst modelWorldMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeImmutable)( ModelNode, ModelNode.WORLD_MATRIX );\nconst modelPosition = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeImmutable)( ModelNode, ModelNode.POSITION );\nconst modelScale = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeImmutable)( ModelNode, ModelNode.SCALE );\nconst modelViewPosition = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeImmutable)( ModelNode, ModelNode.VIEW_POSITION );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'ModelNode', ModelNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/ModelNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/ModelViewProjectionNode.js": +/*!************************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/ModelViewProjectionNode.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ modelViewProjection: () => (/* binding */ modelViewProjection)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _CameraNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n/* harmony import */ var _ModelNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ModelNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ModelNode.js\");\n/* harmony import */ var _PositionNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../core/VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n\n\n\n\n\n\n\n\nclass ModelViewProjectionNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n\n\tconstructor( positionNode = null ) {\n\n\t\tsuper( 'vec4' );\n\n\t\tthis.positionNode = positionNode;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tif ( builder.shaderStage === 'fragment' ) {\n\n\t\t\treturn (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_6__.varying)( builder.context.mvp );\n\n\t\t}\n\n\t\tconst position = this.positionNode || _PositionNode_js__WEBPACK_IMPORTED_MODULE_4__.positionLocal;\n\n\t\treturn _CameraNode_js__WEBPACK_IMPORTED_MODULE_2__.cameraProjectionMatrix.mul( _ModelNode_js__WEBPACK_IMPORTED_MODULE_3__.modelViewMatrix ).mul( position );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ModelViewProjectionNode);\n\nconst modelViewProjection = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeProxy)( ModelViewProjectionNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ModelViewProjectionNode', ModelViewProjectionNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/ModelViewProjectionNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/MorphNode.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/MorphNode.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ morphReference: () => (/* binding */ morphReference)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _ReferenceNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js\");\n/* harmony import */ var _PositionNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _NormalNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _TextureNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _core_IndexNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../core/IndexNode.js */ \"./node_modules/three/examples/jsm/nodes/core/IndexNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/LoopNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/LoopNode.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst morphTextures = new WeakMap();\nconst morphVec4 = new three__WEBPACK_IMPORTED_MODULE_10__.Vector4();\n\nconst getMorph = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.tslFn)( ( { bufferMap, influence, stride, width, depth, offset } ) => {\n\n\tconst texelIndex = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.int)( _core_IndexNode_js__WEBPACK_IMPORTED_MODULE_8__.vertexIndex ).mul( stride ).add( offset );\n\n\tconst y = texelIndex.div( width );\n\tconst x = texelIndex.sub( y.mul( width ) );\n\n\tconst bufferAttrib = (0,_TextureNode_js__WEBPACK_IMPORTED_MODULE_7__.textureLoad)( bufferMap, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.ivec2)( x, y ) ).depth( depth );\n\n\treturn bufferAttrib.mul( influence );\n\n} );\n\nfunction getEntry( geometry ) {\n\n\tconst hasMorphPosition = geometry.morphAttributes.position !== undefined;\n\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n\tconst hasMorphColors = geometry.morphAttributes.color !== undefined;\n\n\t// instead of using attributes, the WebGL 2 code path encodes morph targets\n\t// into an array of data textures. Each layer represents a single morph target.\n\n\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\tlet entry = morphTextures.get( geometry );\n\n\tif ( entry === undefined || entry.count !== morphTargetsCount ) {\n\n\t\tif ( entry !== undefined ) entry.texture.dispose();\n\n\t\tconst morphTargets = geometry.morphAttributes.position || [];\n\t\tconst morphNormals = geometry.morphAttributes.normal || [];\n\t\tconst morphColors = geometry.morphAttributes.color || [];\n\n\t\tlet vertexDataCount = 0;\n\n\t\tif ( hasMorphPosition === true ) vertexDataCount = 1;\n\t\tif ( hasMorphNormals === true ) vertexDataCount = 2;\n\t\tif ( hasMorphColors === true ) vertexDataCount = 3;\n\n\t\tlet width = geometry.attributes.position.count * vertexDataCount;\n\t\tlet height = 1;\n\n\t\tconst maxTextureSize = 4096; // @TODO: Use 'capabilities.maxTextureSize'\n\n\t\tif ( width > maxTextureSize ) {\n\n\t\t\theight = Math.ceil( width / maxTextureSize );\n\t\t\twidth = maxTextureSize;\n\n\t\t}\n\n\t\tconst buffer = new Float32Array( width * height * 4 * morphTargetsCount );\n\n\t\tconst bufferTexture = new three__WEBPACK_IMPORTED_MODULE_10__.DataArrayTexture( buffer, width, height, morphTargetsCount );\n\t\tbufferTexture.type = three__WEBPACK_IMPORTED_MODULE_10__.FloatType;\n\t\tbufferTexture.needsUpdate = true;\n\n\t\t// fill buffer\n\n\t\tconst vertexDataStride = vertexDataCount * 4;\n\n\t\tfor ( let i = 0; i < morphTargetsCount; i ++ ) {\n\n\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\tconst morphNormal = morphNormals[ i ];\n\t\t\tconst morphColor = morphColors[ i ];\n\n\t\t\tconst offset = width * height * 4 * i;\n\n\t\t\tfor ( let j = 0; j < morphTarget.count; j ++ ) {\n\n\t\t\t\tconst stride = j * vertexDataStride;\n\n\t\t\t\tif ( hasMorphPosition === true ) {\n\n\t\t\t\t\tmorphVec4.fromBufferAttribute( morphTarget, j );\n\n\t\t\t\t\tbuffer[ offset + stride + 0 ] = morphVec4.x;\n\t\t\t\t\tbuffer[ offset + stride + 1 ] = morphVec4.y;\n\t\t\t\t\tbuffer[ offset + stride + 2 ] = morphVec4.z;\n\t\t\t\t\tbuffer[ offset + stride + 3 ] = 0;\n\n\t\t\t\t}\n\n\t\t\t\tif ( hasMorphNormals === true ) {\n\n\t\t\t\t\tmorphVec4.fromBufferAttribute( morphNormal, j );\n\n\t\t\t\t\tbuffer[ offset + stride + 4 ] = morphVec4.x;\n\t\t\t\t\tbuffer[ offset + stride + 5 ] = morphVec4.y;\n\t\t\t\t\tbuffer[ offset + stride + 6 ] = morphVec4.z;\n\t\t\t\t\tbuffer[ offset + stride + 7 ] = 0;\n\n\t\t\t\t}\n\n\t\t\t\tif ( hasMorphColors === true ) {\n\n\t\t\t\t\tmorphVec4.fromBufferAttribute( morphColor, j );\n\n\t\t\t\t\tbuffer[ offset + stride + 8 ] = morphVec4.x;\n\t\t\t\t\tbuffer[ offset + stride + 9 ] = morphVec4.y;\n\t\t\t\t\tbuffer[ offset + stride + 10 ] = morphVec4.z;\n\t\t\t\t\tbuffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morphVec4.w : 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tentry = {\n\t\t\tcount: morphTargetsCount,\n\t\t\ttexture: bufferTexture,\n\t\t\tstride: vertexDataCount,\n\t\t\tsize: new three__WEBPACK_IMPORTED_MODULE_10__.Vector2( width, height )\n\t\t};\n\n\t\tmorphTextures.set( geometry, entry );\n\n\t\tfunction disposeTexture() {\n\n\t\t\tbufferTexture.dispose();\n\n\t\t\tmorphTextures.delete( geometry );\n\n\t\t\tgeometry.removeEventListener( 'dispose', disposeTexture );\n\n\t\t}\n\n\t\tgeometry.addEventListener( 'dispose', disposeTexture );\n\n\t}\n\n\treturn entry;\n\n}\n\n\nclass MorphNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( mesh ) {\n\n\t\tsuper( 'void' );\n\n\t\tthis.mesh = mesh;\n\t\tthis.morphBaseInfluence = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__.uniform)( 1 );\n\n\t\tthis.updateType = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeUpdateType.OBJECT;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst { geometry } = builder;\n\n\t\tconst hasMorphPosition = geometry.morphAttributes.position !== undefined;\n\t\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\t// nodes\n\n\t\tconst { texture: bufferMap, stride, size } = getEntry( geometry );\n\n\t\tif ( hasMorphPosition === true ) _PositionNode_js__WEBPACK_IMPORTED_MODULE_5__.positionLocal.mulAssign( this.morphBaseInfluence );\n\t\tif ( hasMorphNormals === true ) _NormalNode_js__WEBPACK_IMPORTED_MODULE_6__.normalLocal.mulAssign( this.morphBaseInfluence );\n\n\t\tconst width = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.int)( size.width );\n\n\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_9__.loop)( morphTargetsCount, ( { i } ) => {\n\n\t\t\tconst influence = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.float)( 0 ).toVar();\n\n\t\t\tif ( this.mesh.isInstancedMesh === true && ( this.mesh.morphTexture !== null && this.mesh.morphTexture !== undefined ) ) {\n\n\t\t\t\tinfluence.assign( (0,_TextureNode_js__WEBPACK_IMPORTED_MODULE_7__.textureLoad)( this.mesh.morphTexture, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.ivec2)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.int)( i ).add( 1 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.int)( _core_IndexNode_js__WEBPACK_IMPORTED_MODULE_8__.instanceIndex ) ) ).r );\n\n\t\t\t} else {\n\n\t\t\t\tinfluence.assign( (0,_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_4__.reference)( 'morphTargetInfluences', 'float' ).element( i ).toVar() );\n\n\t\t\t}\n\n\t\t\tif ( hasMorphPosition === true ) {\n\n\t\t\t\t_PositionNode_js__WEBPACK_IMPORTED_MODULE_5__.positionLocal.addAssign( getMorph( {\n\t\t\t\t\tbufferMap,\n\t\t\t\t\tinfluence,\n\t\t\t\t\tstride,\n\t\t\t\t\twidth,\n\t\t\t\t\tdepth: i,\n\t\t\t\t\toffset: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.int)( 0 )\n\t\t\t\t} ) );\n\n\t\t\t}\n\n\t\t\tif ( hasMorphNormals === true ) {\n\n\t\t\t\t_NormalNode_js__WEBPACK_IMPORTED_MODULE_6__.normalLocal.addAssign( getMorph( {\n\t\t\t\t\tbufferMap,\n\t\t\t\t\tinfluence,\n\t\t\t\t\tstride,\n\t\t\t\t\twidth,\n\t\t\t\t\tdepth: i,\n\t\t\t\t\toffset: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.int)( 1 )\n\t\t\t\t} ) );\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n\tupdate() {\n\n\t\tconst morphBaseInfluence = this.morphBaseInfluence;\n\n\t\tif ( this.mesh.geometry.morphTargetsRelative ) {\n\n\t\t\tmorphBaseInfluence.value = 1;\n\n\t\t} else {\n\n\t\t\tmorphBaseInfluence.value = 1 - this.mesh.morphTargetInfluences.reduce( ( a, b ) => a + b, 0 );\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MorphNode);\n\nconst morphReference = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( MorphNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'MorphNode', MorphNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/MorphNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js": +/*!***********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ normalGeometry: () => (/* binding */ normalGeometry),\n/* harmony export */ normalLocal: () => (/* binding */ normalLocal),\n/* harmony export */ normalView: () => (/* binding */ normalView),\n/* harmony export */ normalWorld: () => (/* binding */ normalWorld),\n/* harmony export */ transformedClearcoatNormalView: () => (/* binding */ transformedClearcoatNormalView),\n/* harmony export */ transformedNormalView: () => (/* binding */ transformedNormalView),\n/* harmony export */ transformedNormalWorld: () => (/* binding */ transformedNormalWorld)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _CameraNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n/* harmony import */ var _ModelNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ModelNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ModelNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\n\n\n\nclass NormalNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope = NormalNode.LOCAL ) {\n\n\t\tsuper( 'vec3' );\n\n\t\tthis.scope = scope;\n\n\t}\n\n\tisGlobal() {\n\n\t\treturn true;\n\n\t}\n\n\tgetHash( /*builder*/ ) {\n\n\t\treturn `normal-${this.scope}`;\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst scope = this.scope;\n\n\t\tlet outputNode = null;\n\n\t\tif ( scope === NormalNode.GEOMETRY ) {\n\n\t\t\tconst geometryAttribute = builder.hasGeometryAttribute( 'normal' );\n\n\t\t\tif ( geometryAttribute === false ) {\n\n\t\t\t\toutputNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.vec3)( 0, 1, 0 );\n\n\t\t\t} else {\n\n\t\t\t\toutputNode = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__.attribute)( 'normal', 'vec3' );\n\n\t\t\t}\n\n\t\t} else if ( scope === NormalNode.LOCAL ) {\n\n\t\t\toutputNode = (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__.varying)( normalGeometry );\n\n\t\t} else if ( scope === NormalNode.VIEW ) {\n\n\t\t\tconst vertexNode = _ModelNode_js__WEBPACK_IMPORTED_MODULE_6__.modelNormalMatrix.mul( normalLocal );\n\t\t\toutputNode = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__.normalize)( (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__.varying)( vertexNode ) );\n\n\t\t} else if ( scope === NormalNode.WORLD ) {\n\n\t\t\t// To use inverseTransformDirection only inverse the param order like this: cameraViewMatrix.transformDirection( normalView )\n\t\t\tconst vertexNode = normalView.transformDirection( _CameraNode_js__WEBPACK_IMPORTED_MODULE_5__.cameraViewMatrix );\n\t\t\toutputNode = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__.normalize)( (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__.varying)( vertexNode ) );\n\n\t\t}\n\n\t\treturn outputNode.build( builder, this.getNodeType( builder ) );\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.scope = this.scope;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.scope = data.scope;\n\n\t}\n\n}\n\nNormalNode.GEOMETRY = 'geometry';\nNormalNode.LOCAL = 'local';\nNormalNode.VIEW = 'view';\nNormalNode.WORLD = 'world';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NormalNode);\n\nconst normalGeometry = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeImmutable)( NormalNode, NormalNode.GEOMETRY );\nconst normalLocal = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeImmutable)( NormalNode, NormalNode.LOCAL ).temp( 'Normal' );\nconst normalView = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeImmutable)( NormalNode, NormalNode.VIEW );\nconst normalWorld = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeImmutable)( NormalNode, NormalNode.WORLD );\nconst transformedNormalView = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.property)( 'vec3', 'TransformedNormalView' );\nconst transformedNormalWorld = transformedNormalView.transformDirection( _CameraNode_js__WEBPACK_IMPORTED_MODULE_5__.cameraViewMatrix ).normalize();\nconst transformedClearcoatNormalView = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.property)( 'vec3', 'TransformedClearcoatNormalView' );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'NormalNode', NormalNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/Object3DNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/Object3DNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ objectDirection: () => (/* binding */ objectDirection),\n/* harmony export */ objectNormalMatrix: () => (/* binding */ objectNormalMatrix),\n/* harmony export */ objectPosition: () => (/* binding */ objectPosition),\n/* harmony export */ objectScale: () => (/* binding */ objectScale),\n/* harmony export */ objectViewMatrix: () => (/* binding */ objectViewMatrix),\n/* harmony export */ objectViewPosition: () => (/* binding */ objectViewPosition),\n/* harmony export */ objectWorldMatrix: () => (/* binding */ objectWorldMatrix)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\nclass Object3DNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope = Object3DNode.VIEW_MATRIX, object3d = null ) {\n\n\t\tsuper();\n\n\t\tthis.scope = scope;\n\t\tthis.object3d = object3d;\n\n\t\tthis.updateType = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeUpdateType.OBJECT;\n\n\t\tthis._uniformNode = new _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]( null );\n\n\t}\n\n\tgetNodeType() {\n\n\t\tconst scope = this.scope;\n\n\t\tif ( scope === Object3DNode.WORLD_MATRIX || scope === Object3DNode.VIEW_MATRIX ) {\n\n\t\t\treturn 'mat4';\n\n\t\t} else if ( scope === Object3DNode.NORMAL_MATRIX ) {\n\n\t\t\treturn 'mat3';\n\n\t\t} else if ( scope === Object3DNode.POSITION || scope === Object3DNode.VIEW_POSITION || scope === Object3DNode.DIRECTION || scope === Object3DNode.SCALE ) {\n\n\t\t\treturn 'vec3';\n\n\t\t}\n\n\t}\n\n\tupdate( frame ) {\n\n\t\tconst object = this.object3d;\n\t\tconst uniformNode = this._uniformNode;\n\t\tconst scope = this.scope;\n\n\t\tif ( scope === Object3DNode.VIEW_MATRIX ) {\n\n\t\t\tuniformNode.value = object.modelViewMatrix;\n\n\t\t} else if ( scope === Object3DNode.NORMAL_MATRIX ) {\n\n\t\t\tuniformNode.value = object.normalMatrix;\n\n\t\t} else if ( scope === Object3DNode.WORLD_MATRIX ) {\n\n\t\t\tuniformNode.value = object.matrixWorld;\n\n\t\t} else if ( scope === Object3DNode.POSITION ) {\n\n\t\t\tuniformNode.value = uniformNode.value || new three__WEBPACK_IMPORTED_MODULE_4__.Vector3();\n\n\t\t\tuniformNode.value.setFromMatrixPosition( object.matrixWorld );\n\n\t\t} else if ( scope === Object3DNode.SCALE ) {\n\n\t\t\tuniformNode.value = uniformNode.value || new three__WEBPACK_IMPORTED_MODULE_4__.Vector3();\n\n\t\t\tuniformNode.value.setFromMatrixScale( object.matrixWorld );\n\n\t\t} else if ( scope === Object3DNode.DIRECTION ) {\n\n\t\t\tuniformNode.value = uniformNode.value || new three__WEBPACK_IMPORTED_MODULE_4__.Vector3();\n\n\t\t\tobject.getWorldDirection( uniformNode.value );\n\n\t\t} else if ( scope === Object3DNode.VIEW_POSITION ) {\n\n\t\t\tconst camera = frame.camera;\n\n\t\t\tuniformNode.value = uniformNode.value || new three__WEBPACK_IMPORTED_MODULE_4__.Vector3();\n\t\t\tuniformNode.value.setFromMatrixPosition( object.matrixWorld );\n\n\t\t\tuniformNode.value.applyMatrix4( camera.matrixWorldInverse );\n\n\t\t}\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst scope = this.scope;\n\n\t\tif ( scope === Object3DNode.WORLD_MATRIX || scope === Object3DNode.VIEW_MATRIX ) {\n\n\t\t\tthis._uniformNode.nodeType = 'mat4';\n\n\t\t} else if ( scope === Object3DNode.NORMAL_MATRIX ) {\n\n\t\t\tthis._uniformNode.nodeType = 'mat3';\n\n\t\t} else if ( scope === Object3DNode.POSITION || scope === Object3DNode.VIEW_POSITION || scope === Object3DNode.DIRECTION || scope === Object3DNode.SCALE ) {\n\n\t\t\tthis._uniformNode.nodeType = 'vec3';\n\n\t\t}\n\n\t\treturn this._uniformNode.build( builder );\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.scope = this.scope;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.scope = data.scope;\n\n\t}\n\n}\n\nObject3DNode.VIEW_MATRIX = 'viewMatrix';\nObject3DNode.NORMAL_MATRIX = 'normalMatrix';\nObject3DNode.WORLD_MATRIX = 'worldMatrix';\nObject3DNode.POSITION = 'position';\nObject3DNode.SCALE = 'scale';\nObject3DNode.VIEW_POSITION = 'viewPosition';\nObject3DNode.DIRECTION = 'direction';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Object3DNode);\n\nconst objectDirection = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( Object3DNode, Object3DNode.DIRECTION );\nconst objectViewMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( Object3DNode, Object3DNode.VIEW_MATRIX );\nconst objectNormalMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( Object3DNode, Object3DNode.NORMAL_MATRIX );\nconst objectWorldMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( Object3DNode, Object3DNode.WORLD_MATRIX );\nconst objectPosition = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( Object3DNode, Object3DNode.POSITION );\nconst objectScale = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( Object3DNode, Object3DNode.SCALE );\nconst objectViewPosition = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( Object3DNode, Object3DNode.VIEW_POSITION );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'Object3DNode', Object3DNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/Object3DNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/PointUVNode.js": +/*!************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/PointUVNode.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ pointUV: () => (/* binding */ pointUV)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nclass PointUVNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor() {\n\n\t\tsuper( 'vec2' );\n\n\t\tthis.isPointUVNode = true;\n\n\t}\n\n\tgenerate( /*builder*/ ) {\n\n\t\treturn 'vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )';\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PointUVNode);\n\nconst pointUV = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PointUVNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'PointUVNode', PointUVNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/PointUVNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ positionGeometry: () => (/* binding */ positionGeometry),\n/* harmony export */ positionLocal: () => (/* binding */ positionLocal),\n/* harmony export */ positionView: () => (/* binding */ positionView),\n/* harmony export */ positionViewDirection: () => (/* binding */ positionViewDirection),\n/* harmony export */ positionWorld: () => (/* binding */ positionWorld),\n/* harmony export */ positionWorldDirection: () => (/* binding */ positionWorldDirection)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _ModelNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ModelNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ModelNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\n\nclass PositionNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope = PositionNode.LOCAL ) {\n\n\t\tsuper( 'vec3' );\n\n\t\tthis.scope = scope;\n\n\t}\n\n\tisGlobal() {\n\n\t\treturn true;\n\n\t}\n\n\tgetHash( /*builder*/ ) {\n\n\t\treturn `position-${this.scope}`;\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst scope = this.scope;\n\n\t\tlet outputNode = null;\n\n\t\tif ( scope === PositionNode.GEOMETRY ) {\n\n\t\t\toutputNode = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__.attribute)( 'position', 'vec3' );\n\n\t\t} else if ( scope === PositionNode.LOCAL ) {\n\n\t\t\toutputNode = (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__.varying)( positionGeometry );\n\n\t\t} else if ( scope === PositionNode.WORLD ) {\n\n\t\t\tconst vertexPositionNode = _ModelNode_js__WEBPACK_IMPORTED_MODULE_4__.modelWorldMatrix.mul( positionLocal );\n\t\t\toutputNode = (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__.varying)( vertexPositionNode );\n\n\t\t} else if ( scope === PositionNode.VIEW ) {\n\n\t\t\tconst vertexPositionNode = _ModelNode_js__WEBPACK_IMPORTED_MODULE_4__.modelViewMatrix.mul( positionLocal );\n\t\t\toutputNode = (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__.varying)( vertexPositionNode );\n\n\t\t} else if ( scope === PositionNode.VIEW_DIRECTION ) {\n\n\t\t\tconst vertexPositionNode = positionView.negate();\n\t\t\toutputNode = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.normalize)( (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__.varying)( vertexPositionNode ) );\n\n\t\t} else if ( scope === PositionNode.WORLD_DIRECTION ) {\n\n\t\t\tconst vertexPositionNode = positionLocal.transformDirection( _ModelNode_js__WEBPACK_IMPORTED_MODULE_4__.modelWorldMatrix );\n\t\t\toutputNode = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.normalize)( (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__.varying)( vertexPositionNode ) );\n\n\t\t}\n\n\t\treturn outputNode.build( builder, this.getNodeType( builder ) );\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.scope = this.scope;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.scope = data.scope;\n\n\t}\n\n}\n\nPositionNode.GEOMETRY = 'geometry';\nPositionNode.LOCAL = 'local';\nPositionNode.WORLD = 'world';\nPositionNode.WORLD_DIRECTION = 'worldDirection';\nPositionNode.VIEW = 'view';\nPositionNode.VIEW_DIRECTION = 'viewDirection';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PositionNode);\n\nconst positionGeometry = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeImmutable)( PositionNode, PositionNode.GEOMETRY );\nconst positionLocal = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeImmutable)( PositionNode, PositionNode.LOCAL ).temp( 'Position' );\nconst positionWorld = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeImmutable)( PositionNode, PositionNode.WORLD );\nconst positionWorldDirection = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeImmutable)( PositionNode, PositionNode.WORLD_DIRECTION );\nconst positionView = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeImmutable)( PositionNode, PositionNode.VIEW );\nconst positionViewDirection = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeImmutable)( PositionNode, PositionNode.VIEW_DIRECTION );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'PositionNode', PositionNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js": +/*!**************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ reference: () => (/* binding */ reference),\n/* harmony export */ referenceBuffer: () => (/* binding */ referenceBuffer)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _TextureNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _BufferNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./BufferNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BufferNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _UniformsNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./UniformsNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UniformsNode.js\");\n/* harmony import */ var _utils_ArrayElementNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/ArrayElementNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/ArrayElementNode.js\");\n\n\n\n\n\n\n\n\n\nclass ReferenceElementNode extends _utils_ArrayElementNode_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"] {\n\n\tconstructor( referenceNode, indexNode ) {\n\n\t\tsuper( referenceNode, indexNode );\n\n\t\tthis.referenceNode = referenceNode;\n\n\t\tthis.isReferenceElementNode = true;\n\n\t}\n\n\tgetNodeType() {\n\n\t\treturn this.referenceNode.uniformType;\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst snippet = super.generate( builder );\n\t\tconst arrayType = this.referenceNode.getNodeType();\n\t\tconst elementType = this.getNodeType();\n\n\t\treturn builder.format( snippet, arrayType, elementType );\n\n\t}\n\n}\n\nclass ReferenceNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( property, uniformType, object = null, count = null ) {\n\n\t\tsuper();\n\n\t\tthis.property = property;\n\t\tthis.uniformType = uniformType;\n\t\tthis.object = object;\n\t\tthis.count = count;\n\n\t\tthis.properties = property.split( '.' );\n\t\tthis.reference = null;\n\t\tthis.node = null;\n\n\t\tthis.updateType = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeUpdateType.OBJECT;\n\n\t}\n\n\telement( indexNode ) {\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeObject)( new ReferenceElementNode( this, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeObject)( indexNode ) ) );\n\n\t}\n\n\tsetNodeType( uniformType ) {\n\n\t\tlet node = null;\n\n\t\tif ( this.count !== null ) {\n\n\t\t\tnode = (0,_BufferNode_js__WEBPACK_IMPORTED_MODULE_4__.buffer)( null, uniformType, this.count );\n\n\t\t} else if ( Array.isArray( this.getValueFromReference() ) ) {\n\n\t\t\tnode = (0,_UniformsNode_js__WEBPACK_IMPORTED_MODULE_6__.uniforms)( null, uniformType );\n\n\t\t} else if ( uniformType === 'texture' ) {\n\n\t\t\tnode = (0,_TextureNode_js__WEBPACK_IMPORTED_MODULE_3__.texture)( null );\n\n\t\t} else {\n\n\t\t\tnode = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_2__.uniform)( null, uniformType );\n\n\t\t}\n\n\t\tthis.node = node;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.node.getNodeType( builder );\n\n\t}\n\n\tgetValueFromReference( object = this.reference ) {\n\n\t\tconst { properties } = this;\n\n\t\tlet value = object[ properties[ 0 ] ];\n\n\t\tfor ( let i = 1; i < properties.length; i ++ ) {\n\n\t\t\tvalue = value[ properties[ i ] ];\n\n\t\t}\n\n\t\treturn value;\n\n\t}\n\n\tupdateReference( state ) {\n\n\t\tthis.reference = this.object !== null ? this.object : state.object;\n\n\t\treturn this.reference;\n\n\t}\n\n\tsetup() {\n\n\t\tthis.updateValue();\n\n\t\treturn this.node;\n\n\t}\n\n\tupdate( /*frame*/ ) {\n\n\t\tthis.updateValue();\n\n\t}\n\n\tupdateValue() {\n\n\t\tif ( this.node === null ) this.setNodeType( this.uniformType );\n\n\t\tconst value = this.getValueFromReference();\n\n\t\tif ( Array.isArray( value ) ) {\n\n\t\t\tthis.node.array = value;\n\n\t\t} else {\n\n\t\t\tthis.node.value = value;\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ReferenceNode);\n\nconst reference = ( name, type, object ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeObject)( new ReferenceNode( name, type, object ) );\nconst referenceBuffer = ( name, type, count, object ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeObject)( new ReferenceNode( name, type, object, count ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ReferenceNode', ReferenceNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/ReflectVectorNode.js": +/*!******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/ReflectVectorNode.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ reflectVector: () => (/* binding */ reflectVector)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _CameraNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n/* harmony import */ var _NormalNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _PositionNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\nclass ReflectVectorNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor() {\n\n\t\tsuper( 'vec3' );\n\n\t}\n\n\tgetHash( /*builder*/ ) {\n\n\t\treturn 'reflectVector';\n\n\t}\n\n\tsetup() {\n\n\t\tconst reflectView = _PositionNode_js__WEBPACK_IMPORTED_MODULE_3__.positionViewDirection.negate().reflect( _NormalNode_js__WEBPACK_IMPORTED_MODULE_2__.transformedNormalView );\n\n\t\treturn reflectView.transformDirection( _CameraNode_js__WEBPACK_IMPORTED_MODULE_1__.cameraViewMatrix );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ReflectVectorNode);\n\nconst reflectVector = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeImmutable)( ReflectVectorNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ReflectVectorNode', ReflectVectorNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/ReflectVectorNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/RendererReferenceNode.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/RendererReferenceNode.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ rendererReference: () => (/* binding */ rendererReference)\n/* harmony export */ });\n/* harmony import */ var _ReferenceNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass RendererReferenceNode extends _ReferenceNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( property, inputType, renderer = null ) {\n\n\t\tsuper( property, inputType, renderer );\n\n\t\tthis.renderer = renderer;\n\n\t}\n\n\tupdateReference( state ) {\n\n\t\tthis.reference = this.renderer !== null ? this.renderer : state.renderer;\n\n\t\treturn this.reference;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RendererReferenceNode);\n\nconst rendererReference = ( name, type, renderer ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new RendererReferenceNode( name, type, renderer ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'RendererReferenceNode', RendererReferenceNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/RendererReferenceNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/SceneNode.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/SceneNode.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ backgroundBlurriness: () => (/* binding */ backgroundBlurriness),\n/* harmony export */ backgroundIntensity: () => (/* binding */ backgroundIntensity),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _ReferenceNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js\");\n\n\n\n\n\nclass SceneNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope = SceneNode.BACKGROUND_BLURRINESS, scene = null ) {\n\n\t\tsuper();\n\n\t\tthis.scope = scope;\n\t\tthis.scene = scene;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst scope = this.scope;\n\t\tconst scene = this.scene !== null ? this.scene : builder.scene;\n\n\t\tlet output;\n\n\t\tif ( scope === SceneNode.BACKGROUND_BLURRINESS ) {\n\n\t\t\toutput = (0,_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_2__.reference)( 'backgroundBlurriness', 'float', scene );\n\n\t\t} else if ( scope === SceneNode.BACKGROUND_INTENSITY ) {\n\n\t\t\toutput = (0,_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_2__.reference)( 'backgroundIntensity', 'float', scene );\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.SceneNode: Unknown scope:', scope );\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n}\n\nSceneNode.BACKGROUND_BLURRINESS = 'backgroundBlurriness';\nSceneNode.BACKGROUND_INTENSITY = 'backgroundIntensity';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SceneNode);\n\nconst backgroundBlurriness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( SceneNode, SceneNode.BACKGROUND_BLURRINESS );\nconst backgroundIntensity = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( SceneNode, SceneNode.BACKGROUND_INTENSITY );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'SceneNode', SceneNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/SceneNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/SkinningNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/SkinningNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ skinning: () => (/* binding */ skinning),\n/* harmony export */ skinningReference: () => (/* binding */ skinningReference)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var _ReferenceNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js\");\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _NormalNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _PositionNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _TangentNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TangentNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TangentNode.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _BufferNode_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./BufferNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BufferNode.js\");\n\n\n\n\n\n\n\n\n\n\n\n\nclass SkinningNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( skinnedMesh, useReference = false ) {\n\n\t\tsuper( 'void' );\n\n\t\tthis.skinnedMesh = skinnedMesh;\n\t\tthis.useReference = useReference;\n\n\t\tthis.updateType = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeUpdateType.OBJECT;\n\n\t\t//\n\n\t\tthis.skinIndexNode = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_3__.attribute)( 'skinIndex', 'uvec4' );\n\t\tthis.skinWeightNode = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_3__.attribute)( 'skinWeight', 'vec4' );\n\n\t\tlet bindMatrixNode, bindMatrixInverseNode, boneMatricesNode;\n\n\t\tif ( useReference ) {\n\n\t\t\tbindMatrixNode = (0,_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_4__.reference)( 'bindMatrix', 'mat4' );\n\t\t\tbindMatrixInverseNode = (0,_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_4__.reference)( 'bindMatrixInverse', 'mat4' );\n\t\t\tboneMatricesNode = (0,_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_4__.referenceBuffer)( 'skeleton.boneMatrices', 'mat4', skinnedMesh.skeleton.bones.length );\n\n\t\t} else {\n\n\t\t\tbindMatrixNode = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_9__.uniform)( skinnedMesh.bindMatrix, 'mat4' );\n\t\t\tbindMatrixInverseNode = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_9__.uniform)( skinnedMesh.bindMatrixInverse, 'mat4' );\n\t\t\tboneMatricesNode = (0,_BufferNode_js__WEBPACK_IMPORTED_MODULE_10__.buffer)( skinnedMesh.skeleton.boneMatrices, 'mat4', skinnedMesh.skeleton.bones.length );\n\n\t\t}\n\n\t\tthis.bindMatrixNode = bindMatrixNode;\n\t\tthis.bindMatrixInverseNode = bindMatrixInverseNode;\n\t\tthis.boneMatricesNode = boneMatricesNode;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst { skinIndexNode, skinWeightNode, bindMatrixNode, bindMatrixInverseNode, boneMatricesNode } = this;\n\n\t\tconst boneMatX = boneMatricesNode.element( skinIndexNode.x );\n\t\tconst boneMatY = boneMatricesNode.element( skinIndexNode.y );\n\t\tconst boneMatZ = boneMatricesNode.element( skinIndexNode.z );\n\t\tconst boneMatW = boneMatricesNode.element( skinIndexNode.w );\n\n\t\t// POSITION\n\n\t\tconst skinVertex = bindMatrixNode.mul( _PositionNode_js__WEBPACK_IMPORTED_MODULE_7__.positionLocal );\n\n\t\tconst skinned = (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_5__.add)(\n\t\t\tboneMatX.mul( skinWeightNode.x ).mul( skinVertex ),\n\t\t\tboneMatY.mul( skinWeightNode.y ).mul( skinVertex ),\n\t\t\tboneMatZ.mul( skinWeightNode.z ).mul( skinVertex ),\n\t\t\tboneMatW.mul( skinWeightNode.w ).mul( skinVertex )\n\t\t);\n\n\t\tconst skinPosition = bindMatrixInverseNode.mul( skinned ).xyz;\n\n\t\t// NORMAL\n\n\t\tlet skinMatrix = (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_5__.add)(\n\t\t\tskinWeightNode.x.mul( boneMatX ),\n\t\t\tskinWeightNode.y.mul( boneMatY ),\n\t\t\tskinWeightNode.z.mul( boneMatZ ),\n\t\t\tskinWeightNode.w.mul( boneMatW )\n\t\t);\n\n\t\tskinMatrix = bindMatrixInverseNode.mul( skinMatrix ).mul( bindMatrixNode );\n\n\t\tconst skinNormal = skinMatrix.transformDirection( _NormalNode_js__WEBPACK_IMPORTED_MODULE_6__.normalLocal ).xyz;\n\n\t\t// ASSIGNS\n\n\t\t_PositionNode_js__WEBPACK_IMPORTED_MODULE_7__.positionLocal.assign( skinPosition );\n\t\t_NormalNode_js__WEBPACK_IMPORTED_MODULE_6__.normalLocal.assign( skinNormal );\n\n\t\tif ( builder.hasGeometryAttribute( 'tangent' ) ) {\n\n\t\t\t_TangentNode_js__WEBPACK_IMPORTED_MODULE_8__.tangentLocal.assign( skinNormal );\n\n\t\t}\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tif ( output !== 'void' ) {\n\n\t\t\treturn _PositionNode_js__WEBPACK_IMPORTED_MODULE_7__.positionLocal.build( builder, output );\n\n\t\t}\n\n\t}\n\n\tupdate( frame ) {\n\n\t\tconst object = this.useReference ? frame.object : this.skinnedMesh;\n\n\t\tobject.skeleton.update();\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SkinningNode);\n\nconst skinning = ( skinnedMesh ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new SkinningNode( skinnedMesh ) );\nconst skinningReference = ( skinnedMesh ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new SkinningNode( skinnedMesh, true ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'SkinningNode', SkinningNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/SkinningNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/StorageBufferNode.js": +/*!******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/StorageBufferNode.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ storage: () => (/* binding */ storage),\n/* harmony export */ storageObject: () => (/* binding */ storageObject)\n/* harmony export */ });\n/* harmony import */ var _BufferNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BufferNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BufferNode.js\");\n/* harmony import */ var _BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BufferAttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BufferAttributeNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../core/VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n/* harmony import */ var _utils_StorageArrayElementNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/StorageArrayElementNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/StorageArrayElementNode.js\");\n\n\n\n\n\n\n\nclass StorageBufferNode extends _BufferNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( value, bufferType, bufferCount = 0 ) {\n\n\t\tsuper( value, bufferType, bufferCount );\n\n\t\tthis.isStorageBufferNode = true;\n\n\t\tthis.bufferObject = false;\n\n\t\tthis._attribute = null;\n\t\tthis._varying = null;\n\n\t}\n\n\tgetInputType( /*builder*/ ) {\n\n\t\treturn 'storageBuffer';\n\n\t}\n\n\telement( indexNode ) {\n\n\t\treturn (0,_utils_StorageArrayElementNode_js__WEBPACK_IMPORTED_MODULE_5__.storageElement)( this, indexNode );\n\n\t}\n\n\tsetBufferObject( value ) {\n\n\t\tthis.bufferObject = value;\n\n\t\treturn this;\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tif ( builder.isAvailable( 'storageBuffer' ) ) return super.generate( builder );\n\n\t\tconst nodeType = this.getNodeType( builder );\n\n\t\tif ( this._attribute === null ) {\n\n\t\t\tthis._attribute = (0,_BufferAttributeNode_js__WEBPACK_IMPORTED_MODULE_1__.bufferAttribute)( this.value );\n\t\t\tthis._varying = (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_4__.varying)( this._attribute );\n\n\t\t}\n\n\n\t\tconst output = this._varying.build( builder, nodeType );\n\n\t\tbuilder.registerTransform( output, this._attribute );\n\n\t\treturn output;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StorageBufferNode);\n\nconst storage = ( value, type, count ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeObject)( new StorageBufferNode( value, type, count ) );\nconst storageObject = ( value, type, count ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeObject)( new StorageBufferNode( value, type, count ).setBufferObject( true ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_2__.addNodeClass)( 'StorageBufferNode', StorageBufferNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/StorageBufferNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/TangentNode.js": +/*!************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/TangentNode.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ tangentGeometry: () => (/* binding */ tangentGeometry),\n/* harmony export */ tangentLocal: () => (/* binding */ tangentLocal),\n/* harmony export */ tangentView: () => (/* binding */ tangentView),\n/* harmony export */ tangentWorld: () => (/* binding */ tangentWorld),\n/* harmony export */ transformedTangentView: () => (/* binding */ transformedTangentView),\n/* harmony export */ transformedTangentWorld: () => (/* binding */ transformedTangentWorld)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var _core_VarNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/VarNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VarNode.js\");\n/* harmony import */ var _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _CameraNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n/* harmony import */ var _ModelNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ModelNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ModelNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\n\n\n\nclass TangentNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope = TangentNode.LOCAL ) {\n\n\t\tsuper();\n\n\t\tthis.scope = scope;\n\n\t}\n\n\tgetHash( /*builder*/ ) {\n\n\t\treturn `tangent-${this.scope}`;\n\n\t}\n\n\tgetNodeType() {\n\n\t\tconst scope = this.scope;\n\n\t\tif ( scope === TangentNode.GEOMETRY ) {\n\n\t\t\treturn 'vec4';\n\n\t\t}\n\n\t\treturn 'vec3';\n\n\t}\n\n\n\tgenerate( builder ) {\n\n\t\tconst scope = this.scope;\n\n\t\tlet outputNode = null;\n\n\t\tif ( scope === TangentNode.GEOMETRY ) {\n\n\t\t\toutputNode = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__.attribute)( 'tangent', 'vec4' );\n\n\t\t\tif ( builder.geometry.hasAttribute( 'tangent' ) === false ) {\n\n\t\t\t\tbuilder.geometry.computeTangents();\n\n\t\t\t}\n\n\t\t} else if ( scope === TangentNode.LOCAL ) {\n\n\t\t\toutputNode = (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_3__.varying)( tangentGeometry.xyz );\n\n\t\t} else if ( scope === TangentNode.VIEW ) {\n\n\t\t\tconst vertexNode = _ModelNode_js__WEBPACK_IMPORTED_MODULE_6__.modelViewMatrix.mul( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.vec4)( tangentLocal, 0 ) ).xyz;\n\t\t\toutputNode = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__.normalize)( (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_3__.varying)( vertexNode ) );\n\n\t\t} else if ( scope === TangentNode.WORLD ) {\n\n\t\t\tconst vertexNode = tangentView.transformDirection( _CameraNode_js__WEBPACK_IMPORTED_MODULE_5__.cameraViewMatrix );\n\t\t\toutputNode = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__.normalize)( (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_3__.varying)( vertexNode ) );\n\n\t\t}\n\n\t\treturn outputNode.build( builder, this.getNodeType( builder ) );\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.scope = this.scope;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.scope = data.scope;\n\n\t}\n\n}\n\nTangentNode.GEOMETRY = 'geometry';\nTangentNode.LOCAL = 'local';\nTangentNode.VIEW = 'view';\nTangentNode.WORLD = 'world';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TangentNode);\n\nconst tangentGeometry = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeImmutable)( TangentNode, TangentNode.GEOMETRY );\nconst tangentLocal = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeImmutable)( TangentNode, TangentNode.LOCAL );\nconst tangentView = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeImmutable)( TangentNode, TangentNode.VIEW );\nconst tangentWorld = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeImmutable)( TangentNode, TangentNode.WORLD );\nconst transformedTangentView = (0,_core_VarNode_js__WEBPACK_IMPORTED_MODULE_2__.temp)( tangentView, 'TransformedTangentView' );\nconst transformedTangentWorld = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__.normalize)( transformedTangentView.transformDirection( _CameraNode_js__WEBPACK_IMPORTED_MODULE_5__.cameraViewMatrix ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'TangentNode', TangentNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/TangentNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/TextureBicubicNode.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/TextureBicubicNode.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ textureBicubic: () => (/* binding */ textureBicubic)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\n// Mipped Bicubic Texture Filtering by N8\n// https://www.shadertoy.com/view/Dl2SDW\n\nconst bC = 1.0 / 6.0;\n\nconst w0 = ( a ) => (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( bC, (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( a, (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( a, a.negate().add( 3.0 ) ).sub( 3.0 ) ).add( 1.0 ) );\n\nconst w1 = ( a ) => (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( bC, (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( a, (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( a, (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( 3.0, a ).sub( 6.0 ) ) ).add( 4.0 ) );\n\nconst w2 = ( a ) => (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( bC, (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( a, (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( a, (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( - 3.0, a ).add( 3.0 ) ).add( 3.0 ) ).add( 1.0 ) );\n\nconst w3 = ( a ) => (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( bC, (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.pow)( a, 3 ) );\n\nconst g0 = ( a ) => w0( a ).add( w1( a ) );\n\nconst g1 = ( a ) => w2( a ).add( w3( a ) );\n\n// h0 and h1 are the two offset functions\nconst h0 = ( a ) => (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.add)( - 1.0, w1( a ).div( w0( a ).add( w1( a ) ) ) );\n\nconst h1 = ( a ) => (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.add)( 1.0, w3( a ).div( w2( a ).add( w3( a ) ) ) );\n\nconst bicubic = ( textureNode, texelSize, lod ) => {\n\n\tconst uv = textureNode.uvNode;\n\tconst uvScaled = (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( uv, texelSize.zw ).add( 0.5 );\n\n\tconst iuv = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.floor)( uvScaled );\n\tconst fuv = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.fract)( uvScaled );\n\n\tconst g0x = g0( fuv.x );\n\tconst g1x = g1( fuv.x );\n\tconst h0x = h0( fuv.x );\n\tconst h1x = h1( fuv.x );\n\tconst h0y = h0( fuv.y );\n\tconst h1y = h1( fuv.y );\n\n\tconst p0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec2)( iuv.x.add( h0x ), iuv.y.add( h0y ) ).sub( 0.5 ).mul( texelSize.xy );\n\tconst p1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec2)( iuv.x.add( h1x ), iuv.y.add( h0y ) ).sub( 0.5 ).mul( texelSize.xy );\n\tconst p2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec2)( iuv.x.add( h0x ), iuv.y.add( h1y ) ).sub( 0.5 ).mul( texelSize.xy );\n\tconst p3 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec2)( iuv.x.add( h1x ), iuv.y.add( h1y ) ).sub( 0.5 ).mul( texelSize.xy );\n\n\tconst a = g0( fuv.y ).mul( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.add)( g0x.mul( textureNode.uv( p0 ).level( lod ) ), g1x.mul( textureNode.uv( p1 ).level( lod ) ) ) );\n\tconst b = g1( fuv.y ).mul( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.add)( g0x.mul( textureNode.uv( p2 ).level( lod ) ), g1x.mul( textureNode.uv( p3 ).level( lod ) ) ) );\n\n\treturn a.add( b );\n\n};\n\nconst textureBicubicMethod = ( textureNode, lodNode ) => {\n\n\tconst fLodSize = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec2)( textureNode.size( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.int)( lodNode ) ) );\n\tconst cLodSize = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec2)( textureNode.size( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.int)( lodNode.add( 1.0 ) ) ) );\n\tconst fLodSizeInv = (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.div)( 1.0, fLodSize );\n\tconst cLodSizeInv = (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.div)( 1.0, cLodSize );\n\tconst fSample = bicubic( textureNode, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec4)( fLodSizeInv, fLodSize ), (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.floor)( lodNode ) );\n\tconst cSample = bicubic( textureNode, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec4)( cLodSizeInv, cLodSize ), (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.ceil)( lodNode ) );\n\n\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.fract)( lodNode ).mix( fSample, cSample );\n\n};\n\nclass TextureBicubicNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( textureNode, blurNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.float)( 3 ) ) {\n\n\t\tsuper( 'vec4' );\n\n\t\tthis.textureNode = textureNode;\n\t\tthis.blurNode = blurNode;\n\n\t}\n\n\tsetup() {\n\n\t\treturn textureBicubicMethod( this.textureNode, this.blurNode );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TextureBicubicNode);\n\nconst textureBicubic = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeProxy)( TextureBicubicNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.addNodeElement)( 'bicubic', textureBicubic );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'TextureBicubicNode', TextureBicubicNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/TextureBicubicNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js": +/*!************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ sampler: () => (/* binding */ sampler),\n/* harmony export */ texture: () => (/* binding */ texture),\n/* harmony export */ textureLoad: () => (/* binding */ textureLoad)\n/* harmony export */ });\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _UVNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _TextureSizeNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TextureSizeNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureSizeNode.js\");\n/* harmony import */ var _display_ColorSpaceNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../display/ColorSpaceNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ColorSpaceNode.js\");\n/* harmony import */ var _code_ExpressionNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../code/ExpressionNode.js */ \"./node_modules/three/examples/jsm/nodes/code/ExpressionNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _utils_MaxMipLevelNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/MaxMipLevelNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/MaxMipLevelNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n\n\n\n\n\n\n\n\n\n\nclass TextureNode extends _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( value, uvNode = null, levelNode = null ) {\n\n\t\tsuper( value );\n\n\t\tthis.isTextureNode = true;\n\n\t\tthis.uvNode = uvNode;\n\t\tthis.levelNode = levelNode;\n\t\tthis.compareNode = null;\n\t\tthis.depthNode = null;\n\n\t\tthis.sampler = true;\n\t\tthis.updateMatrix = false;\n\t\tthis.updateType = _core_constants_js__WEBPACK_IMPORTED_MODULE_8__.NodeUpdateType.NONE;\n\n\t\tthis.referenceNode = null;\n\n\t\tthis._value = value;\n\n\t\tthis.setUpdateMatrix( uvNode === null );\n\n\t}\n\n\tset value( value ) {\n\n\t\tif ( this.referenceNode ) {\n\n\t\t\tthis.referenceNode.value = value;\n\n\t\t} else {\n\n\t\t\tthis._value = value;\n\n\t\t}\n\n\t}\n\n\tget value() {\n\n\t\treturn this.referenceNode ? this.referenceNode.value : this._value;\n\n\t}\n\n\tgetUniformHash( /*builder*/ ) {\n\n\t\treturn this.value.uuid;\n\n\t}\n\n\tgetNodeType( /*builder*/ ) {\n\n\t\tif ( this.value.isDepthTexture === true ) return 'float';\n\n\t\treturn 'vec4';\n\n\t}\n\n\tgetInputType( /*builder*/ ) {\n\n\t\treturn 'texture';\n\n\t}\n\n\tgetDefaultUV() {\n\n\t\treturn (0,_UVNode_js__WEBPACK_IMPORTED_MODULE_1__.uv)( this.value.channel );\n\n\t}\n\n\tupdateReference( /*state*/ ) {\n\n\t\treturn this.value;\n\n\t}\n\n\tgetTransformedUV( uvNode ) {\n\n\t\tconst texture = this.value;\n\n\t\treturn (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_0__.uniform)( texture.matrix ).mul( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.vec3)( uvNode, 1 ) ).xy;\n\n\t}\n\n\tsetUpdateMatrix( value ) {\n\n\t\tthis.updateMatrix = value;\n\t\tthis.updateType = value ? _core_constants_js__WEBPACK_IMPORTED_MODULE_8__.NodeUpdateType.FRAME : _core_constants_js__WEBPACK_IMPORTED_MODULE_8__.NodeUpdateType.NONE;\n\n\t\treturn this;\n\n\t}\n\n\tsetupUV( builder, uvNode ) {\n\n\t\tconst texture = this.value;\n\n\t\tif ( builder.isFlipY() && ( texture.isRenderTargetTexture === true || texture.isFramebufferTexture === true || texture.isDepthTexture === true ) ) {\n\n\t\t\tuvNode = uvNode.setY( uvNode.y.oneMinus() );\n\n\t\t}\n\n\t\treturn uvNode;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst properties = builder.getNodeProperties( this );\n\n\t\t//\n\n\t\tlet uvNode = this.uvNode;\n\n\t\tif ( ( uvNode === null || builder.context.forceUVContext === true ) && builder.context.getUV ) {\n\n\t\t\tuvNode = builder.context.getUV( this );\n\n\t\t}\n\n\t\tif ( ! uvNode ) uvNode = this.getDefaultUV();\n\n\t\tif ( this.updateMatrix === true ) {\n\n\t\t\tuvNode = this.getTransformedUV( uvNode );\n\n\t\t}\n\n\t\tuvNode = this.setupUV( builder, uvNode );\n\n\t\t//\n\n\t\tlet levelNode = this.levelNode;\n\n\t\tif ( levelNode === null && builder.context.getTextureLevel ) {\n\n\t\t\tlevelNode = builder.context.getTextureLevel( this );\n\n\t\t}\n\n\t\t//\n\n\t\tproperties.uvNode = uvNode;\n\t\tproperties.levelNode = levelNode;\n\t\tproperties.compareNode = this.compareNode;\n\t\tproperties.depthNode = this.depthNode;\n\n\t}\n\n\tgenerateUV( builder, uvNode ) {\n\n\t\treturn uvNode.build( builder, this.sampler === true ? 'vec2' : 'ivec2' );\n\n\t}\n\n\tgenerateSnippet( builder, textureProperty, uvSnippet, levelSnippet, depthSnippet, compareSnippet ) {\n\n\t\tconst texture = this.value;\n\n\t\tlet snippet;\n\n\t\tif ( levelSnippet ) {\n\n\t\t\tsnippet = builder.generateTextureLevel( texture, textureProperty, uvSnippet, levelSnippet, depthSnippet );\n\n\t\t} else if ( compareSnippet ) {\n\n\t\t\tsnippet = builder.generateTextureCompare( texture, textureProperty, uvSnippet, compareSnippet, depthSnippet );\n\n\t\t} else if ( this.sampler === false ) {\n\n\t\t\tsnippet = builder.generateTextureLoad( texture, textureProperty, uvSnippet, depthSnippet );\n\n\t\t} else {\n\n\t\t\tsnippet = builder.generateTexture( texture, textureProperty, uvSnippet, depthSnippet );\n\n\t\t}\n\n\t\treturn snippet;\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst properties = builder.getNodeProperties( this );\n\n\t\tconst texture = this.value;\n\n\t\tif ( ! texture || texture.isTexture !== true ) {\n\n\t\t\tthrow new Error( 'TextureNode: Need a three.js texture.' );\n\n\t\t}\n\n\t\tconst textureProperty = super.generate( builder, 'property' );\n\n\t\tif ( output === 'sampler' ) {\n\n\t\t\treturn textureProperty + '_sampler';\n\n\t\t} else if ( builder.isReference( output ) ) {\n\n\t\t\treturn textureProperty;\n\n\t\t} else {\n\n\t\t\tconst nodeData = builder.getDataFromNode( this );\n\n\t\t\tlet propertyName = nodeData.propertyName;\n\n\t\t\tif ( propertyName === undefined ) {\n\n\t\t\t\tconst { uvNode, levelNode, compareNode, depthNode } = properties;\n\n\t\t\t\tconst uvSnippet = this.generateUV( builder, uvNode );\n\t\t\t\tconst levelSnippet = levelNode ? levelNode.build( builder, 'float' ) : null;\n\t\t\t\tconst depthSnippet = depthNode ? depthNode.build( builder, 'int' ) : null;\n\t\t\t\tconst compareSnippet = compareNode ? compareNode.build( builder, 'float' ) : null;\n\n\t\t\t\tconst nodeVar = builder.getVarFromNode( this );\n\n\t\t\t\tpropertyName = builder.getPropertyName( nodeVar );\n\n\t\t\t\tconst snippet = this.generateSnippet( builder, textureProperty, uvSnippet, levelSnippet, depthSnippet, compareSnippet );\n\n\t\t\t\tbuilder.addLineFlowCode( `${propertyName} = ${snippet}` );\n\n\t\t\t\tif ( builder.context.tempWrite !== false ) {\n\n\t\t\t\t\tnodeData.snippet = snippet;\n\t\t\t\t\tnodeData.propertyName = propertyName;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tlet snippet = propertyName;\n\t\t\tconst nodeType = this.getNodeType( builder );\n\n\t\t\tif ( builder.needsColorSpaceToLinear( texture ) ) {\n\n\t\t\t\tsnippet = (0,_display_ColorSpaceNode_js__WEBPACK_IMPORTED_MODULE_3__.colorSpaceToLinear)( (0,_code_ExpressionNode_js__WEBPACK_IMPORTED_MODULE_4__.expression)( snippet, nodeType ), texture.colorSpace ).setup( builder ).build( builder, nodeType );\n\n\t\t\t}\n\n\t\t\treturn builder.format( snippet, nodeType, output );\n\n\t\t}\n\n\t}\n\n\tsetSampler( value ) {\n\n\t\tthis.sampler = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetSampler() {\n\n\t\treturn this.sampler;\n\n\t}\n\n\t// @TODO: Move to TSL\n\n\tuv( uvNode ) {\n\n\t\tconst textureNode = this.clone();\n\t\ttextureNode.uvNode = uvNode;\n\t\ttextureNode.referenceNode = this;\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeObject)( textureNode );\n\n\t}\n\n\tblur( levelNode ) {\n\n\t\tconst textureNode = this.clone();\n\t\ttextureNode.levelNode = levelNode.mul( (0,_utils_MaxMipLevelNode_js__WEBPACK_IMPORTED_MODULE_6__.maxMipLevel)( textureNode ) );\n\t\ttextureNode.referenceNode = this;\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeObject)( textureNode );\n\n\t}\n\n\tlevel( levelNode ) {\n\n\t\tconst textureNode = this.clone();\n\t\ttextureNode.levelNode = levelNode;\n\t\ttextureNode.referenceNode = this;\n\n\t\treturn textureNode;\n\n\t}\n\n\tsize( levelNode ) {\n\n\t\treturn (0,_TextureSizeNode_js__WEBPACK_IMPORTED_MODULE_2__.textureSize)( this, levelNode );\n\n\t}\n\n\tcompare( compareNode ) {\n\n\t\tconst textureNode = this.clone();\n\t\ttextureNode.compareNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeObject)( compareNode );\n\t\ttextureNode.referenceNode = this;\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeObject)( textureNode );\n\n\t}\n\n\tdepth( depthNode ) {\n\n\t\tconst textureNode = this.clone();\n\t\ttextureNode.depthNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeObject)( depthNode );\n\t\ttextureNode.referenceNode = this;\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeObject)( textureNode );\n\n\t}\n\n\t// --\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.value = this.value.toJSON( data.meta ).uuid;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.value = data.meta.textures[ data.value ];\n\n\t}\n\n\tupdate() {\n\n\t\tconst texture = this.value;\n\n\t\tif ( texture.matrixAutoUpdate === true ) {\n\n\t\t\ttexture.updateMatrix();\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\tconst newNode = new this.constructor( this.value, this.uvNode, this.levelNode );\n\t\tnewNode.sampler = this.sampler;\n\n\t\treturn newNode;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TextureNode);\n\nconst texture = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.nodeProxy)( TextureNode );\nconst textureLoad = ( ...params ) => texture( ...params ).setSampler( false );\n\n//export const textureLevel = ( value, uv, level ) => texture( value, uv ).level( level );\n\nconst sampler = ( aTexture ) => ( aTexture.isNode === true ? aTexture : texture( aTexture ) ).convert( 'sampler' );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.addNodeElement)( 'texture', texture );\n//addNodeElement( 'textureLevel', textureLevel );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_5__.addNodeClass)( 'TextureNode', TextureNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/TextureSizeNode.js": +/*!****************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/TextureSizeNode.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ textureSize: () => (/* binding */ textureSize)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass TextureSizeNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( textureNode, levelNode = null ) {\n\n\t\tsuper( 'uvec2' );\n\n\t\tthis.isTextureSizeNode = true;\n\n\t\tthis.textureNode = textureNode;\n\t\tthis.levelNode = levelNode;\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst textureProperty = this.textureNode.build( builder, 'property' );\n\t\tconst levelNode = this.levelNode.build( builder, 'int' );\n\n\t\treturn builder.format( `${builder.getMethod( 'textureDimensions' )}( ${textureProperty}, ${levelNode} )`, this.getNodeType( builder ), output );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TextureSizeNode);\n\nconst textureSize = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( TextureSizeNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'textureSize', textureSize );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'TextureSizeNode', TextureSizeNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/TextureSizeNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/TextureStoreNode.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/TextureStoreNode.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ textureStore: () => (/* binding */ textureStore)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _TextureNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass TextureStoreNode extends _TextureNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n\n\tconstructor( value, uvNode, storeNode = null ) {\n\n\t\tsuper( value, uvNode );\n\n\t\tthis.storeNode = storeNode;\n\n\t\tthis.isStoreTextureNode = true;\n\n\t}\n\n\tgetInputType( /*builder*/ ) {\n\n\t\treturn 'storageTexture';\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tsuper.setup( builder );\n\n\t\tconst properties = builder.getNodeProperties( this );\n\t\tproperties.storeNode = this.storeNode;\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tlet snippet;\n\n\t\tif ( this.storeNode !== null ) {\n\n\t\t\tsnippet = this.generateStore( builder );\n\n\t\t} else {\n\n\t\t\tsnippet = super.generate( builder, output );\n\n\t\t}\n\n\t\treturn snippet;\n\n\t}\n\n\tgenerateStore( builder ) {\n\n\t\tconst properties = builder.getNodeProperties( this );\n\n\t\tconst { uvNode, storeNode } = properties;\n\n\t\tconst textureProperty = super.generate( builder, 'property' );\n\t\tconst uvSnippet = uvNode.build( builder, 'uvec2' );\n\t\tconst storeSnippet = storeNode.build( builder, 'vec4' );\n\n\t\tconst snippet = builder.generateTextureStore( builder, textureProperty, uvSnippet, storeSnippet );\n\n\t\tbuilder.addLineFlowCode( snippet );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TextureStoreNode);\n\nconst textureStoreBase = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( TextureStoreNode );\n\nconst textureStore = ( value, uvNode, storeNode ) => {\n\n\tconst node = textureStoreBase( value, uvNode, storeNode );\n\n\tif ( storeNode !== null ) node.append();\n\n\treturn node;\n\n};\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'TextureStoreNode', TextureStoreNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/TextureStoreNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/UVNode.js": +/*!*******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/UVNode.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ uv: () => (/* binding */ uv)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass UVNode extends _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n\n\tconstructor( index = 0 ) {\n\n\t\tsuper( null, 'vec2' );\n\n\t\tthis.isUVNode = true;\n\n\t\tthis.index = index;\n\n\t}\n\n\tgetAttributeName( /*builder*/ ) {\n\n\t\tconst index = this.index;\n\n\t\treturn 'uv' + ( index > 0 ? index : '' );\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.index = this.index;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.index = data.index;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (UVNode);\n\nconst uv = ( ...params ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new UVNode( ...params ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'UVNode', UVNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/UVNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/UniformsNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/UniformsNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ uniforms: () => (/* binding */ uniforms)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/NodeUtils.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeUtils.js\");\n/* harmony import */ var _utils_ArrayElementNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/ArrayElementNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/ArrayElementNode.js\");\n/* harmony import */ var _BufferNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BufferNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BufferNode.js\");\n\n\n\n\n\n\n\nclass UniformsElementNode extends _utils_ArrayElementNode_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"] {\n\n\tconstructor( arrayBuffer, indexNode ) {\n\n\t\tsuper( arrayBuffer, indexNode );\n\n\t\tthis.isArrayBufferElementNode = true;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.node.getElementType( builder );\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst snippet = super.generate( builder );\n\t\tconst type = this.getNodeType();\n\n\t\treturn builder.format( snippet, 'vec4', type );\n\n\t}\n\n}\n\nclass UniformsNode extends _BufferNode_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"] {\n\n\tconstructor( value, elementType = null ) {\n\n\t\tsuper( null, 'vec4' );\n\n\t\tthis.array = value;\n\t\tthis.elementType = elementType;\n\n\t\tthis._elementType = null;\n\t\tthis._elementLength = 0;\n\n\t\tthis.updateType = _core_constants_js__WEBPACK_IMPORTED_MODULE_2__.NodeUpdateType.RENDER;\n\n\t\tthis.isArrayBufferNode = true;\n\n\t}\n\n\tgetElementType() {\n\n\t\treturn this.elementType || this._elementType;\n\n\t}\n\n\tgetElementLength() {\n\n\t\treturn this._elementLength;\n\n\t}\n\n\tupdate( /*frame*/ ) {\n\n\t\tconst { array, value } = this;\n\n\t\tconst elementLength = this.getElementLength();\n\t\tconst elementType = this.getElementType();\n\n\t\tif ( elementLength === 1 ) {\n\n\t\t\tfor ( let i = 0; i < array.length; i ++ ) {\n\n\t\t\t\tconst index = i * 4;\n\n\t\t\t\tvalue[ index ] = array[ i ];\n\n\t\t\t}\n\n\t\t} else if ( elementType === 'color' ) {\n\n\t\t\tfor ( let i = 0; i < array.length; i ++ ) {\n\n\t\t\t\tconst index = i * 4;\n\t\t\t\tconst vector = array[ i ];\n\n\t\t\t\tvalue[ index ] = vector.r;\n\t\t\t\tvalue[ index + 1 ] = vector.g;\n\t\t\t\tvalue[ index + 2 ] = vector.b || 0;\n\t\t\t\t//value[ index + 3 ] = vector.a || 0;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0; i < array.length; i ++ ) {\n\n\t\t\t\tconst index = i * 4;\n\t\t\t\tconst vector = array[ i ];\n\n\t\t\t\tvalue[ index ] = vector.x;\n\t\t\t\tvalue[ index + 1 ] = vector.y;\n\t\t\t\tvalue[ index + 2 ] = vector.z || 0;\n\t\t\t\tvalue[ index + 3 ] = vector.w || 0;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst length = this.array.length;\n\n\t\tthis._elementType = this.elementType === null ? (0,_core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_3__.getValueType)( this.array[ 0 ] ) : this.elementType;\n\t\tthis._elementLength = builder.getTypeLength( this._elementType );\n\n\t\tthis.value = new Float32Array( length * 4 );\n\t\tthis.bufferCount = length;\n\n\t\treturn super.setup( builder );\n\n\t}\n\n\telement( indexNode ) {\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( new UniformsElementNode( this, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( indexNode ) ) );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (UniformsNode);\n\nconst uniforms = ( values, nodeType ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( new UniformsNode( values, nodeType ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'UniformsNode', UniformsNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/UniformsNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/UserDataNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/UserDataNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ userData: () => (/* binding */ userData)\n/* harmony export */ });\n/* harmony import */ var _ReferenceNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass UserDataNode extends _ReferenceNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( property, inputType, userData = null ) {\n\n\t\tsuper( property, inputType, userData );\n\n\t\tthis.userData = userData;\n\n\t}\n\n\tupdate( frame ) {\n\n\t\tthis.reference = this.userData !== null ? this.userData : frame.object.userData;\n\n\t\tsuper.update( frame );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (UserDataNode);\n\nconst userData = ( name, inputType, userData ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new UserDataNode( name, inputType, userData ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'UserDataNode', UserDataNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/UserDataNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/accessors/VertexColorNode.js": +/*!****************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/accessors/VertexColorNode.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ vertexColor: () => (/* binding */ vertexColor)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\nclass VertexColorNode extends _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n\n\tconstructor( index = 0 ) {\n\n\t\tsuper( null, 'vec4' );\n\n\t\tthis.isVertexColorNode = true;\n\n\t\tthis.index = index;\n\n\t}\n\n\tgetAttributeName( /*builder*/ ) {\n\n\t\tconst index = this.index;\n\n\t\treturn 'color' + ( index > 0 ? index : '' );\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst attributeName = this.getAttributeName( builder );\n\t\tconst geometryAttribute = builder.hasGeometryAttribute( attributeName );\n\n\t\tlet result;\n\n\t\tif ( geometryAttribute === true ) {\n\n\t\t\tresult = super.generate( builder );\n\n\t\t} else {\n\n\t\t\t// Vertex color fallback should be white\n\t\t\tresult = builder.generateConst( this.nodeType, new three__WEBPACK_IMPORTED_MODULE_3__.Vector4( 1, 1, 1, 1 ) );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.index = this.index;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.index = data.index;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (VertexColorNode);\n\nconst vertexColor = ( ...params ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new VertexColorNode( ...params ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'VertexColorNode', VertexColorNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/accessors/VertexColorNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/code/CodeNode.js": +/*!****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/code/CodeNode.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ code: () => (/* binding */ code),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ glsl: () => (/* binding */ glsl),\n/* harmony export */ js: () => (/* binding */ js),\n/* harmony export */ wgsl: () => (/* binding */ wgsl)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nclass CodeNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( code = '', includes = [], language = '' ) {\n\n\t\tsuper( 'code' );\n\n\t\tthis.isCodeNode = true;\n\n\t\tthis.code = code;\n\t\tthis.language = language;\n\n\t\tthis.includes = includes;\n\n\t}\n\n\tisGlobal() {\n\n\t\treturn true;\n\n\t}\n\n\tsetIncludes( includes ) {\n\n\t\tthis.includes = includes;\n\n\t\treturn this;\n\n\t}\n\n\tgetIncludes( /*builder*/ ) {\n\n\t\treturn this.includes;\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst includes = this.getIncludes( builder );\n\n\t\tfor ( const include of includes ) {\n\n\t\t\tinclude.build( builder );\n\n\t\t}\n\n\t\tconst nodeCode = builder.getCodeFromNode( this, this.getNodeType( builder ) );\n\t\tnodeCode.code = this.code;\n\n\t\treturn nodeCode.code;\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.code = this.code;\n\t\tdata.language = this.language;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.code = data.code;\n\t\tthis.language = data.language;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CodeNode);\n\nconst code = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( CodeNode );\n\nconst js = ( src, includes ) => code( src, includes, 'js' );\nconst wgsl = ( src, includes ) => code( src, includes, 'wgsl' );\nconst glsl = ( src, includes ) => code( src, includes, 'glsl' );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'CodeNode', CodeNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/code/CodeNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/code/ExpressionNode.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/code/ExpressionNode.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ expression: () => (/* binding */ expression)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nclass ExpressionNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( snippet = '', nodeType = 'void' ) {\n\n\t\tsuper( nodeType );\n\n\t\tthis.snippet = snippet;\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst type = this.getNodeType( builder );\n\t\tconst snippet = this.snippet;\n\n\t\tif ( type === 'void' ) {\n\n\t\t\tbuilder.addLineFlowCode( snippet );\n\n\t\t} else {\n\n\t\t\treturn builder.format( `( ${ snippet } )`, type, output );\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ExpressionNode);\n\nconst expression = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( ExpressionNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ExpressionNode', ExpressionNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/code/ExpressionNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/code/FunctionCallNode.js": +/*!************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/code/FunctionCallNode.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ call: () => (/* binding */ call),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass FunctionCallNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( functionNode = null, parameters = {} ) {\n\n\t\tsuper();\n\n\t\tthis.functionNode = functionNode;\n\t\tthis.parameters = parameters;\n\n\t}\n\n\tsetParameters( parameters ) {\n\n\t\tthis.parameters = parameters;\n\n\t\treturn this;\n\n\t}\n\n\tgetParameters() {\n\n\t\treturn this.parameters;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.functionNode.getNodeType( builder );\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst params = [];\n\n\t\tconst functionNode = this.functionNode;\n\n\t\tconst inputs = functionNode.getInputs( builder );\n\t\tconst parameters = this.parameters;\n\n\t\tif ( Array.isArray( parameters ) ) {\n\n\t\t\tfor ( let i = 0; i < parameters.length; i ++ ) {\n\n\t\t\t\tconst inputNode = inputs[ i ];\n\t\t\t\tconst node = parameters[ i ];\n\n\t\t\t\tparams.push( node.build( builder, inputNode.type ) );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tfor ( const inputNode of inputs ) {\n\n\t\t\t\tconst node = parameters[ inputNode.name ];\n\n\t\t\t\tif ( node !== undefined ) {\n\n\t\t\t\t\tparams.push( node.build( builder, inputNode.type ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( `FunctionCallNode: Input '${inputNode.name}' not found in FunctionNode.` );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst functionName = functionNode.build( builder, 'property' );\n\n\t\treturn `${functionName}( ${params.join( ', ' )} )`;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FunctionCallNode);\n\nconst call = ( func, ...params ) => {\n\n\tparams = params.length > 1 || ( params[ 0 ] && params[ 0 ].isNode === true ) ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeArray)( params ) : (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObjects)( params[ 0 ] );\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new FunctionCallNode( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( func ), params ) );\n\n};\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'call', call );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'FunctionCallNode', FunctionCallNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/code/FunctionCallNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/code/FunctionNode.js": +/*!********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/code/FunctionNode.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ func: () => (/* binding */ func),\n/* harmony export */ glslFn: () => (/* binding */ glslFn),\n/* harmony export */ wgslFn: () => (/* binding */ wgslFn)\n/* harmony export */ });\n/* harmony import */ var _CodeNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CodeNode.js */ \"./node_modules/three/examples/jsm/nodes/code/CodeNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass FunctionNode extends _CodeNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( code = '', includes = [], language = '' ) {\n\n\t\tsuper( code, includes, language );\n\n\t\tthis.keywords = {};\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.getNodeFunction( builder ).type;\n\n\t}\n\n\tgetInputs( builder ) {\n\n\t\treturn this.getNodeFunction( builder ).inputs;\n\n\t}\n\n\tgetNodeFunction( builder ) {\n\n\t\tconst nodeData = builder.getDataFromNode( this );\n\n\t\tlet nodeFunction = nodeData.nodeFunction;\n\n\t\tif ( nodeFunction === undefined ) {\n\n\t\t\tnodeFunction = builder.parser.parseFunction( this.code );\n\n\t\t\tnodeData.nodeFunction = nodeFunction;\n\n\t\t}\n\n\t\treturn nodeFunction;\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tsuper.generate( builder );\n\n\t\tconst nodeFunction = this.getNodeFunction( builder );\n\n\t\tconst name = nodeFunction.name;\n\t\tconst type = nodeFunction.type;\n\n\t\tconst nodeCode = builder.getCodeFromNode( this, type );\n\n\t\tif ( name !== '' ) {\n\n\t\t\t// use a custom property name\n\n\t\t\tnodeCode.name = name;\n\n\t\t}\n\n\t\tconst propertyName = builder.getPropertyName( nodeCode );\n\n\t\tlet code = this.getNodeFunction( builder ).getCode( propertyName );\n\n\t\tconst keywords = this.keywords;\n\t\tconst keywordsProperties = Object.keys( keywords );\n\n\t\tif ( keywordsProperties.length > 0 ) {\n\n\t\t\tfor ( const property of keywordsProperties ) {\n\n\t\t\t\tconst propertyRegExp = new RegExp( `\\\\b${property}\\\\b`, 'g' );\n\t\t\t\tconst nodeProperty = keywords[ property ].build( builder, 'property' );\n\n\t\t\t\tcode = code.replace( propertyRegExp, nodeProperty );\n\n\t\t\t}\n\n\t\t}\n\n\t\tnodeCode.code = code + '\\n';\n\n\t\tif ( output === 'property' ) {\n\n\t\t\treturn propertyName;\n\n\t\t} else {\n\n\t\t\treturn builder.format( `${ propertyName }()`, type, output );\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FunctionNode);\n\nconst nativeFn = ( code, includes = [], language = '' ) => {\n\n\tfor ( let i = 0; i < includes.length; i ++ ) {\n\n\t\tconst include = includes[ i ];\n\n\t\t// TSL Function: glslFn, wgslFn\n\n\t\tif ( typeof include === 'function' ) {\n\n\t\t\tincludes[ i ] = include.functionNode;\n\n\t\t}\n\n\t}\n\n\tconst functionNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new FunctionNode( code, includes, language ) );\n\n\tconst fn = ( ...params ) => functionNode.call( ...params );\n\tfn.functionNode = functionNode;\n\n\treturn fn;\n\n};\n\nconst glslFn = ( code, includes ) => nativeFn( code, includes, 'glsl' );\nconst wgslFn = ( code, includes ) => nativeFn( code, includes, 'wgsl' );\n\nconst func = ( code, includes ) => { // @deprecated, r154\n\n\tconsole.warn( 'TSL: func() is deprecated. Use nativeFn(), wgslFn() or glslFn() instead.' );\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new FunctionNode( code, includes ) );\n\n};\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'FunctionNode', FunctionNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/code/FunctionNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/code/ScriptableNode.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/code/ScriptableNode.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ global: () => (/* binding */ global),\n/* harmony export */ scriptable: () => (/* binding */ scriptable)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _ScriptableValueNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ScriptableValueNode.js */ \"./node_modules/three/examples/jsm/nodes/code/ScriptableValueNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass Resources extends Map {\n\n\tget( key, callback = null, ...params ) {\n\n\t\tif ( this.has( key ) ) return super.get( key );\n\n\t\tif ( callback !== null ) {\n\n\t\t\tconst value = callback( ...params );\n\t\t\tthis.set( key, value );\n\t\t\treturn value;\n\n\t\t}\n\n\t}\n\n}\n\nclass Parameters {\n\n\tconstructor( scriptableNode ) {\n\n\t\tthis.scriptableNode = scriptableNode;\n\n\t}\n\n\tget parameters() {\n\n\t\treturn this.scriptableNode.parameters;\n\n\t}\n\n\tget layout() {\n\n\t\treturn this.scriptableNode.getLayout();\n\n\t}\n\n\tgetInputLayout( id ) {\n\n\t\treturn this.scriptableNode.getInputLayout( id );\n\n\t}\n\n\tget( name ) {\n\n\t\tconst param = this.parameters[ name ];\n\t\tconst value = param ? param.getValue() : null;\n\n\t\treturn value;\n\n\t}\n\n}\n\nconst global = new Resources();\n\nclass ScriptableNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( codeNode = null, parameters = {} ) {\n\n\t\tsuper();\n\n\t\tthis.codeNode = codeNode;\n\t\tthis.parameters = parameters;\n\n\t\tthis._local = new Resources();\n\t\tthis._output = (0,_ScriptableValueNode_js__WEBPACK_IMPORTED_MODULE_1__.scriptableValue)();\n\t\tthis._outputs = {};\n\t\tthis._source = this.source;\n\t\tthis._method = null;\n\t\tthis._object = null;\n\t\tthis._value = null;\n\t\tthis._needsOutputUpdate = true;\n\n\t\tthis.onRefresh = this.onRefresh.bind( this );\n\n\t\tthis.isScriptableNode = true;\n\n\t}\n\n\tget source() {\n\n\t\treturn this.codeNode ? this.codeNode.code : '';\n\n\t}\n\n\tsetLocal( name, value ) {\n\n\t\treturn this._local.set( name, value );\n\n\t}\n\n\tgetLocal( name ) {\n\n\t\treturn this._local.get( name );\n\n\t}\n\n\tonRefresh() {\n\n\t\tthis._refresh();\n\n\t}\n\n\tgetInputLayout( id ) {\n\n\t\tfor ( const element of this.getLayout() ) {\n\n\t\t\tif ( element.inputType && ( element.id === id || element.name === id ) ) {\n\n\t\t\t\treturn element;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tgetOutputLayout( id ) {\n\n\t\tfor ( const element of this.getLayout() ) {\n\n\t\t\tif ( element.outputType && ( element.id === id || element.name === id ) ) {\n\n\t\t\t\treturn element;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tsetOutput( name, value ) {\n\n\t\tconst outputs = this._outputs;\n\n\t\tif ( outputs[ name ] === undefined ) {\n\n\t\t\toutputs[ name ] = (0,_ScriptableValueNode_js__WEBPACK_IMPORTED_MODULE_1__.scriptableValue)( value );\n\n\t\t} else {\n\n\t\t\toutputs[ name ].value = value;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetOutput( name ) {\n\n\t\treturn this._outputs[ name ];\n\n\t}\n\n\tgetParameter( name ) {\n\n\t\treturn this.parameters[ name ];\n\n\t}\n\n\tsetParameter( name, value ) {\n\n\t\tconst parameters = this.parameters;\n\n\t\tif ( value && value.isScriptableNode ) {\n\n\t\t\tthis.deleteParameter( name );\n\n\t\t\tparameters[ name ] = value;\n\t\t\tparameters[ name ].getDefaultOutput().events.addEventListener( 'refresh', this.onRefresh );\n\n\t\t} else if ( value && value.isScriptableValueNode ) {\n\n\t\t\tthis.deleteParameter( name );\n\n\t\t\tparameters[ name ] = value;\n\t\t\tparameters[ name ].events.addEventListener( 'refresh', this.onRefresh );\n\n\t\t} else if ( parameters[ name ] === undefined ) {\n\n\t\t\tparameters[ name ] = (0,_ScriptableValueNode_js__WEBPACK_IMPORTED_MODULE_1__.scriptableValue)( value );\n\t\t\tparameters[ name ].events.addEventListener( 'refresh', this.onRefresh );\n\n\t\t} else {\n\n\t\t\tparameters[ name ].value = value;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetValue() {\n\n\t\treturn this.getDefaultOutput().getValue();\n\n\t}\n\n\tdeleteParameter( name ) {\n\n\t\tlet valueNode = this.parameters[ name ];\n\n\t\tif ( valueNode ) {\n\n\t\t\tif ( valueNode.isScriptableNode ) valueNode = valueNode.getDefaultOutput();\n\n\t\t\tvalueNode.events.removeEventListener( 'refresh', this.onRefresh );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclearParameters() {\n\n\t\tfor ( const name of Object.keys( this.parameters ) ) {\n\n\t\t\tthis.deleteParameter( name );\n\n\t\t}\n\n\t\tthis.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tcall( name, ...params ) {\n\n\t\tconst object = this.getObject();\n\t\tconst method = object[ name ];\n\n\t\tif ( typeof method === 'function' ) {\n\n\t\t\treturn method( ...params );\n\n\t\t}\n\n\t}\n\n\tasync callAsync( name, ...params ) {\n\n\t\tconst object = this.getObject();\n\t\tconst method = object[ name ];\n\n\t\tif ( typeof method === 'function' ) {\n\n\t\t\treturn method.constructor.name === 'AsyncFunction' ? await method( ...params ) : method( ...params );\n\n\t\t}\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.getDefaultOutputNode().getNodeType( builder );\n\n\t}\n\n\trefresh( output = null ) {\n\n\t\tif ( output !== null ) {\n\n\t\t\tthis.getOutput( output ).refresh();\n\n\t\t} else {\n\n\t\t\tthis._refresh();\n\n\t\t}\n\n\t}\n\n\tgetObject() {\n\n\t\tif ( this.needsUpdate ) this.dispose();\n\t\tif ( this._object !== null ) return this._object;\n\n\t\t//\n\n\t\tconst refresh = () => this.refresh();\n\t\tconst setOutput = ( id, value ) => this.setOutput( id, value );\n\n\t\tconst parameters = new Parameters( this );\n\n\t\tconst THREE = global.get( 'THREE' );\n\t\tconst TSL = global.get( 'TSL' );\n\n\t\tconst method = this.getMethod( this.codeNode );\n\t\tconst params = [ parameters, this._local, global, refresh, setOutput, THREE, TSL ];\n\n\t\tthis._object = method( ...params );\n\n\t\tconst layout = this._object.layout;\n\n\t\tif ( layout ) {\n\n\t\t\tif ( layout.cache === false ) {\n\n\t\t\t\tthis._local.clear();\n\n\t\t\t}\n\n\t\t\t// default output\n\t\t\tthis._output.outputType = layout.outputType || null;\n\n\t\t\tif ( Array.isArray( layout.elements ) ) {\n\n\t\t\t\tfor ( const element of layout.elements ) {\n\n\t\t\t\t\tconst id = element.id || element.name;\n\n\t\t\t\t\tif ( element.inputType ) {\n\n\t\t\t\t\t\tif ( this.getParameter( id ) === undefined ) this.setParameter( id, null );\n\n\t\t\t\t\t\tthis.getParameter( id ).inputType = element.inputType;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( element.outputType ) {\n\n\t\t\t\t\t\tif ( this.getOutput( id ) === undefined ) this.setOutput( id, null );\n\n\t\t\t\t\t\tthis.getOutput( id ).outputType = element.outputType;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this._object;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tfor ( const name in this.parameters ) {\n\n\t\t\tlet valueNode = this.parameters[ name ];\n\n\t\t\tif ( valueNode.isScriptableNode ) valueNode = valueNode.getDefaultOutput();\n\n\t\t\tvalueNode.events.addEventListener( 'refresh', this.onRefresh );\n\n\t\t}\n\n\t}\n\n\tgetLayout() {\n\n\t\treturn this.getObject().layout;\n\n\t}\n\n\tgetDefaultOutputNode() {\n\n\t\tconst output = this.getDefaultOutput().value;\n\n\t\tif ( output && output.isNode ) {\n\n\t\t\treturn output;\n\n\t\t}\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.float)();\n\n\t}\n\n\tgetDefaultOutput()\t{\n\n\t\treturn this._exec()._output;\n\n\t}\n\n\tgetMethod() {\n\n\t\tif ( this.needsUpdate ) this.dispose();\n\t\tif ( this._method !== null ) return this._method;\n\n\t\t//\n\n\t\tconst parametersProps = [ 'parameters', 'local', 'global', 'refresh', 'setOutput', 'THREE', 'TSL' ];\n\t\tconst interfaceProps = [ 'layout', 'init', 'main', 'dispose' ];\n\n\t\tconst properties = interfaceProps.join( ', ' );\n\t\tconst declarations = 'var ' + properties + '; var output = {};\\n';\n\t\tconst returns = '\\nreturn { ...output, ' + properties + ' };';\n\n\t\tconst code = declarations + this.codeNode.code + returns;\n\n\t\t//\n\n\t\tthis._method = new Function( ...parametersProps, code );\n\n\t\treturn this._method;\n\n\t}\n\n\tdispose() {\n\n\t\tif ( this._method === null ) return;\n\n\t\tif ( this._object && typeof this._object.dispose === 'function' ) {\n\n\t\t\tthis._object.dispose();\n\n\t\t}\n\n\t\tthis._method = null;\n\t\tthis._object = null;\n\t\tthis._source = null;\n\t\tthis._value = null;\n\t\tthis._needsOutputUpdate = true;\n\t\tthis._output.value = null;\n\t\tthis._outputs = {};\n\n\t}\n\n\tsetup() {\n\n\t\treturn this.getDefaultOutputNode();\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.dispose();\n\n\t}\n\n\tget needsUpdate() {\n\n\t\treturn this.source !== this._source;\n\n\t}\n\n\t_exec()\t{\n\n\t\tif ( this.codeNode === null ) return this;\n\n\t\tif ( this._needsOutputUpdate === true ) {\n\n\t\t\tthis._value = this.call( 'main' );\n\n\t\t\tthis._needsOutputUpdate = false;\n\n\t\t}\n\n\t\tthis._output.value = this._value;\n\n\t\treturn this;\n\n\t}\n\n\t_refresh() {\n\n\t\tthis.needsUpdate = true;\n\n\t\tthis._exec();\n\n\t\tthis._output.refresh();\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ScriptableNode);\n\nconst scriptable = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( ScriptableNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'scriptable', scriptable );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ScriptableNode', ScriptableNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/code/ScriptableNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/code/ScriptableValueNode.js": +/*!***************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/code/ScriptableValueNode.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ scriptableValue: () => (/* binding */ scriptableValue)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/NodeUtils.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeUtils.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\nclass ScriptableValueNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( value = null ) {\n\n\t\tsuper();\n\n\t\tthis._value = value;\n\t\tthis._cache = null;\n\n\t\tthis.inputType = null;\n\t\tthis.outpuType = null;\n\n\t\tthis.events = new three__WEBPACK_IMPORTED_MODULE_3__.EventDispatcher();\n\n\t\tthis.isScriptableValueNode = true;\n\n\t}\n\n\tget isScriptableOutputNode() {\n\n\t\treturn this.outputType !== null;\n\n\t}\n\n\tset value( val ) {\n\n\t\tif ( this._value === val ) return;\n\n\t\tif ( this._cache && this.inputType === 'URL' && this.value.value instanceof ArrayBuffer ) {\n\n\t\t\tURL.revokeObjectURL( this._cache );\n\n\t\t\tthis._cache = null;\n\n\t\t}\n\n\t\tthis._value = val;\n\n\t\tthis.events.dispatchEvent( { type: 'change' } );\n\n\t\tthis.refresh();\n\n\t}\n\n\tget value() {\n\n\t\treturn this._value;\n\n\t}\n\n\trefresh() {\n\n\t\tthis.events.dispatchEvent( { type: 'refresh' } );\n\n\t}\n\n\tgetValue() {\n\n\t\tconst value = this.value;\n\n\t\tif ( value && this._cache === null && this.inputType === 'URL' && value.value instanceof ArrayBuffer ) {\n\n\t\t\tthis._cache = URL.createObjectURL( new Blob( [ value.value ] ) );\n\n\t\t} else if ( value && value.value !== null && value.value !== undefined && (\n\t\t\t( ( this.inputType === 'URL' || this.inputType === 'String' ) && typeof value.value === 'string' ) ||\n\t\t\t( this.inputType === 'Number' && typeof value.value === 'number' ) ||\n\t\t\t( this.inputType === 'Vector2' && value.value.isVector2 ) ||\n\t\t\t( this.inputType === 'Vector3' && value.value.isVector3 ) ||\n\t\t\t( this.inputType === 'Vector4' && value.value.isVector4 ) ||\n\t\t\t( this.inputType === 'Color' && value.value.isColor ) ||\n\t\t\t( this.inputType === 'Matrix3' && value.value.isMatrix3 ) ||\n\t\t\t( this.inputType === 'Matrix4' && value.value.isMatrix4 )\n\t\t) ) {\n\n\t\t\treturn value.value;\n\n\t\t}\n\n\t\treturn this._cache || value;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.value && this.value.isNode ? this.value.getNodeType( builder ) : 'float';\n\n\t}\n\n\tsetup() {\n\n\t\treturn this.value && this.value.isNode ? this.value : (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.float)();\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tif ( this.value !== null ) {\n\n\t\t\tif ( this.inputType === 'ArrayBuffer' ) {\n\n\t\t\t\tdata.value = (0,_core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.arrayBufferToBase64)( this.value );\n\n\t\t\t} else {\n\n\t\t\t\tdata.value = this.value ? this.value.toJSON( data.meta ).uuid : null;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdata.value = null;\n\n\t\t}\n\n\t\tdata.inputType = this.inputType;\n\t\tdata.outputType = this.outputType;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tlet value = null;\n\n\t\tif ( data.value !== null ) {\n\n\t\t\tif ( data.inputType === 'ArrayBuffer' ) {\n\n\t\t\t\tvalue = (0,_core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.base64ToArrayBuffer)( data.value );\n\n\t\t\t} else if ( data.inputType === 'Texture' ) {\n\n\t\t\t\tvalue = data.meta.textures[ data.value ];\n\n\t\t\t} else {\n\n\t\t\t\tvalue = data.meta.nodes[ data.value ] || null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.value = value;\n\n\t\tthis.inputType = data.inputType;\n\t\tthis.outputType = data.outputType;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ScriptableValueNode);\n\nconst scriptableValue = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( ScriptableValueNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'scriptableValue', scriptableValue );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ScriptableValueNode', ScriptableValueNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/code/ScriptableValueNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/AssignNode.js": +/*!******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/AssignNode.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ assign: () => (/* binding */ assign),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n\n\n\n\n\nclass AssignNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n\n\tconstructor( targetNode, sourceNode ) {\n\n\t\tsuper();\n\n\t\tthis.targetNode = targetNode;\n\t\tthis.sourceNode = sourceNode;\n\n\t}\n\n\thasDependencies() {\n\n\t\treturn false;\n\n\t}\n\n\tgetNodeType( builder, output ) {\n\n\t\treturn output !== 'void' ? this.targetNode.getNodeType( builder ) : 'void';\n\n\t}\n\n\tneedsSplitAssign( builder ) {\n\n\t\tconst { targetNode } = this;\n\n\t\tif ( builder.isAvailable( 'swizzleAssign' ) === false && targetNode.isSplitNode && targetNode.components.length > 1 ) {\n\n\t\t\tconst targetLength = builder.getTypeLength( targetNode.node.getNodeType( builder ) );\n\t\t\tconst assignDiferentVector = _core_constants_js__WEBPACK_IMPORTED_MODULE_3__.vectorComponents.join( '' ).slice( 0, targetLength ) !== targetNode.components;\n\n\t\t\treturn assignDiferentVector;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst { targetNode, sourceNode } = this;\n\n\t\tconst needsSplitAssign = this.needsSplitAssign( builder );\n\n\t\tconst targetType = targetNode.getNodeType( builder );\n\n\t\tconst target = targetNode.context( { assign: true } ).build( builder );\n\t\tconst source = sourceNode.build( builder, targetType );\n\n\t\tconst sourceType = sourceNode.getNodeType( builder );\n\n\t\tconst nodeData = builder.getDataFromNode( this );\n\n\t\t//\n\n\t\tlet snippet;\n\n\t\tif ( nodeData.initialized === true ) {\n\n\t\t\tif ( output !== 'void' ) {\n\n\t\t\t\tsnippet = target;\n\n\t\t\t}\n\n\t\t} else if ( needsSplitAssign ) {\n\n\t\t\tconst sourceVar = builder.getVarFromNode( this, null, targetType );\n\t\t\tconst sourceProperty = builder.getPropertyName( sourceVar );\n\n\t\t\tbuilder.addLineFlowCode( `${ sourceProperty } = ${ source }` );\n\n\t\t\tconst targetRoot = targetNode.node.context( { assign: true } ).build( builder );\n\n\t\t\tfor ( let i = 0; i < targetNode.components.length; i ++ ) {\n\n\t\t\t\tconst component = targetNode.components[ i ];\n\n\t\t\t\tbuilder.addLineFlowCode( `${ targetRoot }.${ component } = ${ sourceProperty }[ ${ i } ]` );\n\n\t\t\t}\n\n\t\t\tif ( output !== 'void' ) {\n\n\t\t\t\tsnippet = target;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tsnippet = `${ target } = ${ source }`;\n\n\t\t\tif ( output === 'void' || sourceType === 'void' ) {\n\n\t\t\t\tbuilder.addLineFlowCode( snippet );\n\n\t\t\t\tif ( output !== 'void' ) {\n\n\t\t\t\t\tsnippet = target;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tnodeData.initialized = true;\n\n\t\treturn builder.format( snippet, targetType, output );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AssignNode);\n\nconst assign = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( AssignNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'AssignNode', AssignNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'assign', assign );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/AssignNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/AttributeNode.js": +/*!*********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/AttributeNode.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ attribute: () => (/* binding */ attribute),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _VaryingNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass AttributeNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( attributeName, nodeType = null ) {\n\n\t\tsuper( nodeType );\n\n\t\tthis._attributeName = attributeName;\n\n\t}\n\n\tisGlobal() {\n\n\t\treturn true;\n\n\t}\n\n\tgetHash( builder ) {\n\n\t\treturn this.getAttributeName( builder );\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\tlet nodeType = super.getNodeType( builder );\n\n\t\tif ( nodeType === null ) {\n\n\t\t\tconst attributeName = this.getAttributeName( builder );\n\n\t\t\tif ( builder.hasGeometryAttribute( attributeName ) ) {\n\n\t\t\t\tconst attribute = builder.geometry.getAttribute( attributeName );\n\n\t\t\t\tnodeType = builder.getTypeFromAttribute( attribute );\n\n\t\t\t} else {\n\n\t\t\t\tnodeType = 'float';\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn nodeType;\n\n\t}\n\n\tsetAttributeName( attributeName ) {\n\n\t\tthis._attributeName = attributeName;\n\n\t\treturn this;\n\n\t}\n\n\tgetAttributeName( /*builder*/ ) {\n\n\t\treturn this._attributeName;\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst attributeName = this.getAttributeName( builder );\n\t\tconst nodeType = this.getNodeType( builder );\n\t\tconst geometryAttribute = builder.hasGeometryAttribute( attributeName );\n\n\t\tif ( geometryAttribute === true ) {\n\n\t\t\tconst attribute = builder.geometry.getAttribute( attributeName );\n\t\t\tconst attributeType = builder.getTypeFromAttribute( attribute );\n\n\t\t\tconst nodeAttribute = builder.getAttribute( attributeName, attributeType );\n\n\t\t\tif ( builder.shaderStage === 'vertex' ) {\n\n\t\t\t\treturn builder.format( nodeAttribute.name, attributeType, nodeType );\n\n\t\t\t} else {\n\n\t\t\t\tconst nodeVarying = (0,_VaryingNode_js__WEBPACK_IMPORTED_MODULE_1__.varying)( this );\n\n\t\t\t\treturn nodeVarying.build( builder, nodeType );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconsole.warn( `AttributeNode: Vertex attribute \"${ attributeName }\" not found on geometry.` );\n\n\t\t\treturn builder.generateConst( nodeType );\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AttributeNode);\n\nconst attribute = ( name, nodeType ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new AttributeNode( name, nodeType ) );\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'AttributeNode', AttributeNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/AttributeNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/BypassNode.js": +/*!******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/BypassNode.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bypass: () => (/* binding */ bypass),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nclass BypassNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( returnNode, callNode ) {\n\n\t\tsuper();\n\n\t\tthis.isBypassNode = true;\n\n\t\tthis.outputNode = returnNode;\n\t\tthis.callNode = callNode;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.outputNode.getNodeType( builder );\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst snippet = this.callNode.build( builder, 'void' );\n\n\t\tif ( snippet !== '' ) {\n\n\t\t\tbuilder.addLineFlowCode( snippet );\n\n\t\t}\n\n\t\treturn this.outputNode.build( builder );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BypassNode);\n\nconst bypass = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( BypassNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'bypass', bypass );\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'BypassNode', BypassNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/BypassNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/CacheNode.js": +/*!*****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/CacheNode.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cache: () => (/* binding */ cache),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ globalCache: () => (/* binding */ globalCache)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _NodeCache_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NodeCache.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeCache.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass CacheNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( node, cache = new _NodeCache_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]() ) {\n\n\t\tsuper();\n\n\t\tthis.isCacheNode = true;\n\n\t\tthis.node = node;\n\t\tthis.cache = cache;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.node.getNodeType( builder );\n\n\t}\n\n\tbuild( builder, ...params ) {\n\n\t\tconst previousCache = builder.getCache();\n\t\tconst cache = this.cache || builder.globalCache;\n\n\t\tbuilder.setCache( cache );\n\n\t\tconst data = this.node.build( builder, ...params );\n\n\t\tbuilder.setCache( previousCache );\n\n\t\treturn data;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CacheNode);\n\nconst cache = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( CacheNode );\nconst globalCache = ( node ) => cache( node, null );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'cache', cache );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'globalCache', globalCache );\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'CacheNode', CacheNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/CacheNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/ConstNode.js": +/*!*****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/ConstNode.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _InputNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./InputNode.js */ \"./node_modules/three/examples/jsm/nodes/core/InputNode.js\");\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n\n\n\nclass ConstNode extends _InputNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( value, nodeType = null ) {\n\n\t\tsuper( value, nodeType );\n\n\t\tthis.isConstNode = true;\n\n\t}\n\n\tgenerateConst( builder ) {\n\n\t\treturn builder.generateConst( this.getNodeType( builder ), this.value );\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst type = this.getNodeType( builder );\n\n\t\treturn builder.format( this.generateConst( builder ), type, output );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ConstNode);\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'ConstNode', ConstNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/ConstNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/ContextNode.js": +/*!*******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/ContextNode.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ context: () => (/* binding */ context),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ label: () => (/* binding */ label)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nclass ContextNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( node, context = {} ) {\n\n\t\tsuper();\n\n\t\tthis.isContextNode = true;\n\n\t\tthis.node = node;\n\t\tthis.context = context;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.node.getNodeType( builder );\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst previousContext = builder.getContext();\n\n\t\tbuilder.setContext( { ...builder.context, ...this.context } );\n\n\t\tconst node = this.node.build( builder );\n\n\t\tbuilder.setContext( previousContext );\n\n\t\treturn node;\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst previousContext = builder.getContext();\n\n\t\tbuilder.setContext( { ...builder.context, ...this.context } );\n\n\t\tconst snippet = this.node.build( builder, output );\n\n\t\tbuilder.setContext( previousContext );\n\n\t\treturn snippet;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ContextNode);\n\nconst context = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( ContextNode );\nconst label = ( node, name ) => context( node, { label: name } );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'context', context );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'label', label );\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ContextNode', ContextNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/ContextNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/IndexNode.js": +/*!*****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/IndexNode.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ instanceIndex: () => (/* binding */ instanceIndex),\n/* harmony export */ vertexIndex: () => (/* binding */ vertexIndex)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _VaryingNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass IndexNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope ) {\n\n\t\tsuper( 'uint' );\n\n\t\tthis.scope = scope;\n\n\t\tthis.isInstanceIndexNode = true;\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst nodeType = this.getNodeType( builder );\n\t\tconst scope = this.scope;\n\n\t\tlet propertyName;\n\n\t\tif ( scope === IndexNode.VERTEX ) {\n\n\t\t\tpropertyName = builder.getVertexIndex();\n\n\t\t} else if ( scope === IndexNode.INSTANCE ) {\n\n\t\t\tpropertyName = builder.getInstanceIndex();\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.IndexNode: Unknown scope: ' + scope );\n\n\t\t}\n\n\t\tlet output;\n\n\t\tif ( builder.shaderStage === 'vertex' || builder.shaderStage === 'compute' ) {\n\n\t\t\toutput = propertyName;\n\n\t\t} else {\n\n\t\t\tconst nodeVarying = (0,_VaryingNode_js__WEBPACK_IMPORTED_MODULE_1__.varying)( this );\n\n\t\t\toutput = nodeVarying.build( builder, nodeType );\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n}\n\nIndexNode.VERTEX = 'vertex';\nIndexNode.INSTANCE = 'instance';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (IndexNode);\n\nconst vertexIndex = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeImmutable)( IndexNode, IndexNode.VERTEX );\nconst instanceIndex = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeImmutable)( IndexNode, IndexNode.INSTANCE );\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'IndexNode', IndexNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/IndexNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/InputNode.js": +/*!*****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/InputNode.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NodeUtils.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeUtils.js\");\n\n\n\nclass InputNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( value, nodeType = null ) {\n\n\t\tsuper( nodeType );\n\n\t\tthis.isInputNode = true;\n\n\t\tthis.value = value;\n\t\tthis.precision = null;\n\n\t}\n\n\tgetNodeType( /*builder*/ ) {\n\n\t\tif ( this.nodeType === null ) {\n\n\t\t\treturn (0,_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.getValueType)( this.value );\n\n\t\t}\n\n\t\treturn this.nodeType;\n\n\t}\n\n\tgetInputType( builder ) {\n\n\t\treturn this.getNodeType( builder );\n\n\t}\n\n\tsetPrecision( precision ) {\n\n\t\tthis.precision = precision;\n\n\t\treturn this;\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.value = this.value;\n\n\t\tif ( this.value && this.value.toArray ) data.value = this.value.toArray();\n\n\t\tdata.valueType = (0,_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.getValueType)( this.value );\n\t\tdata.nodeType = this.nodeType;\n\n\t\tif ( data.valueType === 'ArrayBuffer' ) data.value = (0,_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.arrayBufferToBase64)( data.value );\n\n\t\tdata.precision = this.precision;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.nodeType = data.nodeType;\n\t\tthis.value = Array.isArray( data.value ) ? (0,_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.getValueFromType)( data.valueType, ...data.value ) : data.value;\n\n\t\tthis.precision = data.precision || null;\n\n\t\tif ( this.value && this.value.fromArray ) this.value = this.value.fromArray( data.value );\n\n\t}\n\n\tgenerate( /*builder, output*/ ) {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (InputNode);\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'InputNode', InputNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/InputNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/LightingModel.js": +/*!*********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/LightingModel.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nclass LightingModel {\n\n\tstart( /*input, stack, builder*/ ) { }\n\n\tfinish( /*input, stack, builder*/ ) { }\n\n\tdirect( /*input, stack, builder*/ ) { }\n\n\tindirectDiffuse( /*input, stack, builder*/ ) { }\n\n\tindirectSpecular( /*input, stack, builder*/ ) { }\n\n\tambientOcclusion( /*input, stack, builder*/ ) { }\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LightingModel);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/LightingModel.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/Node.js": +/*!************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/Node.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addNodeClass: () => (/* binding */ addNodeClass),\n/* harmony export */ createNodeFromType: () => (/* binding */ createNodeFromType),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NodeUtils.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeUtils.js\");\n\n\n\n\n\nconst NodeClasses = new Map();\n\nlet _nodeId = 0;\n\nclass Node extends three__WEBPACK_IMPORTED_MODULE_2__.EventDispatcher {\n\n\tconstructor( nodeType = null ) {\n\n\t\tsuper();\n\n\t\tthis.nodeType = nodeType;\n\n\t\tthis.updateType = _constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeUpdateType.NONE;\n\t\tthis.updateBeforeType = _constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeUpdateType.NONE;\n\n\t\tthis.uuid = three__WEBPACK_IMPORTED_MODULE_2__.MathUtils.generateUUID();\n\n\t\tthis.version = 0;\n\n\t\tthis._cacheKey = null;\n\t\tthis._cacheKeyVersion = 0;\n\n\t\tthis.isNode = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _nodeId ++ } );\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t}\n\n\tget type() {\n\n\t\treturn this.constructor.type;\n\n\t}\n\n\tonUpdate( callback, updateType ) {\n\n\t\tthis.updateType = updateType;\n\t\tthis.update = callback.bind( this.getSelf() );\n\n\t\treturn this;\n\n\t}\n\n\tonFrameUpdate( callback ) {\n\n\t\treturn this.onUpdate( callback, _constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeUpdateType.FRAME );\n\n\t}\n\n\tonRenderUpdate( callback ) {\n\n\t\treturn this.onUpdate( callback, _constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeUpdateType.RENDER );\n\n\t}\n\n\tonObjectUpdate( callback ) {\n\n\t\treturn this.onUpdate( callback, _constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeUpdateType.OBJECT );\n\n\t}\n\n\tgetSelf() {\n\n\t\t// Returns non-node object.\n\n\t\treturn this.self || this;\n\n\t}\n\n\tupdateReference( /*state*/ ) {\n\n\t\treturn this;\n\n\t}\n\n\tisGlobal( /*builder*/ ) {\n\n\t\treturn false;\n\n\t}\n\n\t* getChildren() {\n\n\t\tfor ( const { childNode } of (0,_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.getNodeChildren)( this ) ) {\n\n\t\t\tyield childNode;\n\n\t\t}\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\ttraverse( callback ) {\n\n\t\tcallback( this );\n\n\t\tfor ( const childNode of this.getChildren() ) {\n\n\t\t\tchildNode.traverse( callback );\n\n\t\t}\n\n\t}\n\n\tgetCacheKey( force = false ) {\n\n\t\tforce = force || this.version !== this._cacheKeyVersion;\n\n\t\tif ( force === true || this._cacheKey === null ) {\n\n\t\t\tthis._cacheKey = (0,_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.getCacheKey)( this, force );\n\t\t\tthis._cacheKeyVersion = this.version;\n\n\t\t}\n\n\t\treturn this._cacheKey;\n\n\t}\n\n\tgetHash( /*builder*/ ) {\n\n\t\treturn this.uuid;\n\n\t}\n\n\tgetUpdateType() {\n\n\t\treturn this.updateType;\n\n\t}\n\n\tgetUpdateBeforeType() {\n\n\t\treturn this.updateBeforeType;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\tconst nodeProperties = builder.getNodeProperties( this );\n\n\t\tif ( nodeProperties.outputNode ) {\n\n\t\t\treturn nodeProperties.outputNode.getNodeType( builder );\n\n\t\t}\n\n\t\treturn this.nodeType;\n\n\t}\n\n\tgetShared( builder ) {\n\n\t\tconst hash = this.getHash( builder );\n\t\tconst nodeFromHash = builder.getNodeFromHash( hash );\n\n\t\treturn nodeFromHash || this;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst nodeProperties = builder.getNodeProperties( this );\n\n\t\tfor ( const childNode of this.getChildren() ) {\n\n\t\t\tnodeProperties[ '_node' + childNode.id ] = childNode;\n\n\t\t}\n\n\t\t// return a outputNode if exists\n\t\treturn null;\n\n\t}\n\n\tconstruct( builder ) { // @deprecated, r157\n\n\t\tconsole.warn( 'THREE.Node: construct() is deprecated. Use setup() instead.' );\n\n\t\treturn this.setup( builder );\n\n\t}\n\n\tincreaseUsage( builder ) {\n\n\t\tconst nodeData = builder.getDataFromNode( this );\n\t\tnodeData.usageCount = nodeData.usageCount === undefined ? 1 : nodeData.usageCount + 1;\n\n\t\treturn nodeData.usageCount;\n\n\t}\n\n\tanalyze( builder ) {\n\n\t\tconst usageCount = this.increaseUsage( builder );\n\n\t\tif ( usageCount === 1 ) {\n\n\t\t\t// node flow children\n\n\t\t\tconst nodeProperties = builder.getNodeProperties( this );\n\n\t\t\tfor ( const childNode of Object.values( nodeProperties ) ) {\n\n\t\t\t\tif ( childNode && childNode.isNode === true ) {\n\n\t\t\t\t\tchildNode.build( builder );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst { outputNode } = builder.getNodeProperties( this );\n\n\t\tif ( outputNode && outputNode.isNode === true ) {\n\n\t\t\treturn outputNode.build( builder, output );\n\n\t\t}\n\n\t}\n\n\tupdateBefore( /*frame*/ ) {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n\tupdate( /*frame*/ ) {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n\tbuild( builder, output = null ) {\n\n\t\tconst refNode = this.getShared( builder );\n\n\t\tif ( this !== refNode ) {\n\n\t\t\treturn refNode.build( builder, output );\n\n\t\t}\n\n\t\tbuilder.addNode( this );\n\t\tbuilder.addChain( this );\n\n\t\t/* Build stages expected results:\n\t\t\t- \"setup\"\t\t-> Node\n\t\t\t- \"analyze\"\t\t-> null\n\t\t\t- \"generate\"\t-> String\n\t\t*/\n\t\tlet result = null;\n\n\t\tconst buildStage = builder.getBuildStage();\n\n\t\tif ( buildStage === 'setup' ) {\n\n\t\t\tthis.updateReference( builder );\n\n\t\t\tconst properties = builder.getNodeProperties( this );\n\n\t\t\tif ( properties.initialized !== true || builder.context.tempRead === false ) {\n\n\t\t\t\tconst stackNodesBeforeSetup = builder.stack.nodes.length;\n\n\t\t\t\tproperties.initialized = true;\n\t\t\t\tproperties.outputNode = this.setup( builder );\n\n\t\t\t\tif ( properties.outputNode !== null && builder.stack.nodes.length !== stackNodesBeforeSetup ) {\n\n\t\t\t\t\tproperties.outputNode = builder.stack;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( const childNode of Object.values( properties ) ) {\n\n\t\t\t\t\tif ( childNode && childNode.isNode === true ) {\n\n\t\t\t\t\t\tchildNode.build( builder );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( buildStage === 'analyze' ) {\n\n\t\t\tthis.analyze( builder );\n\n\t\t} else if ( buildStage === 'generate' ) {\n\n\t\t\tconst isGenerateOnce = this.generate.length === 1;\n\n\t\t\tif ( isGenerateOnce ) {\n\n\t\t\t\tconst type = this.getNodeType( builder );\n\t\t\t\tconst nodeData = builder.getDataFromNode( this );\n\n\t\t\t\tresult = nodeData.snippet;\n\n\t\t\t\tif ( result === undefined /*|| builder.context.tempRead === false*/ ) {\n\n\t\t\t\t\tresult = this.generate( builder ) || '';\n\n\t\t\t\t\tnodeData.snippet = result;\n\n\t\t\t\t}\n\n\t\t\t\tresult = builder.format( result, type, output );\n\n\t\t\t} else {\n\n\t\t\t\tresult = this.generate( builder, output ) || '';\n\n\t\t\t}\n\n\t\t}\n\n\t\tbuilder.removeChain( this );\n\n\t\treturn result;\n\n\t}\n\n\tgetSerializeChildren() {\n\n\t\treturn (0,_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.getNodeChildren)( this );\n\n\t}\n\n\tserialize( json ) {\n\n\t\tconst nodeChildren = this.getSerializeChildren();\n\n\t\tconst inputNodes = {};\n\n\t\tfor ( const { property, index, childNode } of nodeChildren ) {\n\n\t\t\tif ( index !== undefined ) {\n\n\t\t\t\tif ( inputNodes[ property ] === undefined ) {\n\n\t\t\t\t\tinputNodes[ property ] = Number.isInteger( index ) ? [] : {};\n\n\t\t\t\t}\n\n\t\t\t\tinputNodes[ property ][ index ] = childNode.toJSON( json.meta ).uuid;\n\n\t\t\t} else {\n\n\t\t\t\tinputNodes[ property ] = childNode.toJSON( json.meta ).uuid;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( Object.keys( inputNodes ).length > 0 ) {\n\n\t\t\tjson.inputNodes = inputNodes;\n\n\t\t}\n\n\t}\n\n\tdeserialize( json ) {\n\n\t\tif ( json.inputNodes !== undefined ) {\n\n\t\t\tconst nodes = json.meta.nodes;\n\n\t\t\tfor ( const property in json.inputNodes ) {\n\n\t\t\t\tif ( Array.isArray( json.inputNodes[ property ] ) ) {\n\n\t\t\t\t\tconst inputArray = [];\n\n\t\t\t\t\tfor ( const uuid of json.inputNodes[ property ] ) {\n\n\t\t\t\t\t\tinputArray.push( nodes[ uuid ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis[ property ] = inputArray;\n\n\t\t\t\t} else if ( typeof json.inputNodes[ property ] === 'object' ) {\n\n\t\t\t\t\tconst inputObject = {};\n\n\t\t\t\t\tfor ( const subProperty in json.inputNodes[ property ] ) {\n\n\t\t\t\t\t\tconst uuid = json.inputNodes[ property ][ subProperty ];\n\n\t\t\t\t\t\tinputObject[ subProperty ] = nodes[ uuid ];\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis[ property ] = inputObject;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst uuid = json.inputNodes[ property ];\n\n\t\t\t\t\tthis[ property ] = nodes[ uuid ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst { uuid, type } = this;\n\t\tconst isRoot = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( isRoot ) {\n\n\t\t\tmeta = {\n\t\t\t\ttextures: {},\n\t\t\t\timages: {},\n\t\t\t\tnodes: {}\n\t\t\t};\n\n\t\t}\n\n\t\t// serialize\n\n\t\tlet data = meta.nodes[ uuid ];\n\n\t\tif ( data === undefined ) {\n\n\t\t\tdata = {\n\t\t\t\tuuid,\n\t\t\t\ttype,\n\t\t\t\tmeta,\n\t\t\t\tmetadata: {\n\t\t\t\t\tversion: 4.6,\n\t\t\t\t\ttype: 'Node',\n\t\t\t\t\tgenerator: 'Node.toJSON'\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tif ( isRoot !== true ) meta.nodes[ data.uuid ] = data;\n\n\t\t\tthis.serialize( data );\n\n\t\t\tdelete data.meta;\n\n\t\t}\n\n\t\t// TODO: Copied from Object3D.toJSON\n\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t\tif ( isRoot ) {\n\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\t\t\tconst nodes = extractFromCache( meta.nodes );\n\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\n\t\t\tif ( images.length > 0 ) data.images = images;\n\t\t\tif ( nodes.length > 0 ) data.nodes = nodes;\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Node);\n\nfunction addNodeClass( type, nodeClass ) {\n\n\tif ( typeof nodeClass !== 'function' || ! type ) throw new Error( `Node class ${ type } is not a class` );\n\tif ( NodeClasses.has( type ) ) {\n\n\t\tconsole.warn( `Redefinition of node class ${ type }` );\n\t\treturn;\n\n\t}\n\n\tNodeClasses.set( type, nodeClass );\n\tnodeClass.type = type;\n\n}\n\nfunction createNodeFromType( type ) {\n\n\tconst Class = NodeClasses.get( type );\n\n\tif ( Class !== undefined ) {\n\n\t\treturn new Class();\n\n\t}\n\n}\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/Node.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeAttribute.js": +/*!*********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeAttribute.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nclass NodeAttribute {\n\n\tconstructor( name, type, node = null ) {\n\n\t\tthis.isNodeAttribute = true;\n\n\t\tthis.name = name;\n\t\tthis.type = type;\n\t\tthis.node = node;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeAttribute);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeAttribute.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeBuilder.js": +/*!*******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeBuilder.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeUniform_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeUniform.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeUniform.js\");\n/* harmony import */ var _NodeAttribute_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NodeAttribute.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeAttribute.js\");\n/* harmony import */ var _NodeVarying_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./NodeVarying.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeVarying.js\");\n/* harmony import */ var _NodeVar_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NodeVar.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeVar.js\");\n/* harmony import */ var _NodeCode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NodeCode.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeCode.js\");\n/* harmony import */ var _NodeKeywords_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./NodeKeywords.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeKeywords.js\");\n/* harmony import */ var _NodeCache_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./NodeCache.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeCache.js\");\n/* harmony import */ var _ParameterNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ParameterNode.js */ \"./node_modules/three/examples/jsm/nodes/core/ParameterNode.js\");\n/* harmony import */ var _code_FunctionNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../code/FunctionNode.js */ \"./node_modules/three/examples/jsm/nodes/code/FunctionNode.js\");\n/* harmony import */ var _materials_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../materials/NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _renderers_common_nodes_NodeUniform_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../renderers/common/nodes/NodeUniform.js */ \"./node_modules/three/examples/jsm/renderers/common/nodes/NodeUniform.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _StackNode_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./StackNode.js */ \"./node_modules/three/examples/jsm/nodes/core/StackNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _renderers_common_CubeRenderTarget_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../renderers/common/CubeRenderTarget.js */ \"./node_modules/three/examples/jsm/renderers/common/CubeRenderTarget.js\");\n/* harmony import */ var _renderers_common_ChainMap_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../renderers/common/ChainMap.js */ \"./node_modules/three/examples/jsm/renderers/common/ChainMap.js\");\n/* harmony import */ var _renderers_common_extras_PMREMGenerator_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../renderers/common/extras/PMREMGenerator.js */ \"./node_modules/three/examples/jsm/renderers/common/extras/PMREMGenerator.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst uniformsGroupCache = new _renderers_common_ChainMap_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"]();\n\nconst typeFromLength = new Map( [\n\t[ 2, 'vec2' ],\n\t[ 3, 'vec3' ],\n\t[ 4, 'vec4' ],\n\t[ 9, 'mat3' ],\n\t[ 16, 'mat4' ]\n] );\n\nconst typeFromArray = new Map( [\n\t[ Int8Array, 'int' ],\n\t[ Int16Array, 'int' ],\n\t[ Int32Array, 'int' ],\n\t[ Uint8Array, 'uint' ],\n\t[ Uint16Array, 'uint' ],\n\t[ Uint32Array, 'uint' ],\n\t[ Float32Array, 'float' ]\n] );\n\nconst toFloat = ( value ) => {\n\n\tvalue = Number( value );\n\n\treturn value + ( value % 1 ? '' : '.0' );\n\n};\n\nclass NodeBuilder {\n\n\tconstructor( object, renderer, parser, scene = null, material = null ) {\n\n\t\tthis.object = object;\n\t\tthis.material = material || ( object && object.material ) || null;\n\t\tthis.geometry = ( object && object.geometry ) || null;\n\t\tthis.renderer = renderer;\n\t\tthis.parser = parser;\n\t\tthis.scene = scene;\n\n\t\tthis.nodes = [];\n\t\tthis.updateNodes = [];\n\t\tthis.updateBeforeNodes = [];\n\t\tthis.hashNodes = {};\n\n\t\tthis.lightsNode = null;\n\t\tthis.environmentNode = null;\n\t\tthis.fogNode = null;\n\t\tthis.toneMappingNode = null;\n\n\t\tthis.clippingContext = null;\n\n\t\tthis.vertexShader = null;\n\t\tthis.fragmentShader = null;\n\t\tthis.computeShader = null;\n\n\t\tthis.flowNodes = { vertex: [], fragment: [], compute: [] };\n\t\tthis.flowCode = { vertex: '', fragment: '', compute: [] };\n\t\tthis.uniforms = { vertex: [], fragment: [], compute: [], index: 0 };\n\t\tthis.structs = { vertex: [], fragment: [], compute: [], index: 0 };\n\t\tthis.bindings = { vertex: [], fragment: [], compute: [] };\n\t\tthis.bindingsOffset = { vertex: 0, fragment: 0, compute: 0 };\n\t\tthis.bindingsArray = null;\n\t\tthis.attributes = [];\n\t\tthis.bufferAttributes = [];\n\t\tthis.varyings = [];\n\t\tthis.codes = {};\n\t\tthis.vars = {};\n\t\tthis.flow = { code: '' };\n\t\tthis.chaining = [];\n\t\tthis.stack = (0,_StackNode_js__WEBPACK_IMPORTED_MODULE_11__.stack)();\n\t\tthis.stacks = [];\n\t\tthis.tab = '\\t';\n\n\t\tthis.currentFunctionNode = null;\n\n\t\tthis.context = {\n\t\t\tkeywords: new _NodeKeywords_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"](),\n\t\t\tmaterial: this.material\n\t\t};\n\n\t\tthis.cache = new _NodeCache_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]();\n\t\tthis.globalCache = this.cache;\n\n\t\tthis.flowsData = new WeakMap();\n\n\t\tthis.shaderStage = null;\n\t\tthis.buildStage = null;\n\n\t}\n\n\tcreateRenderTarget( width, height, options ) {\n\n\t\treturn new three__WEBPACK_IMPORTED_MODULE_14__.RenderTarget( width, height, options );\n\n\t}\n\n\tcreateCubeRenderTarget( size, options ) {\n\n\t\treturn new _renderers_common_CubeRenderTarget_js__WEBPACK_IMPORTED_MODULE_15__[\"default\"]( size, options );\n\n\t}\n\n\tcreatePMREMGenerator() {\n\n\t\t// TODO: Move Materials.js to outside of the Nodes.js in order to remove this function and improve tree-shaking support\n\n\t\treturn new _renderers_common_extras_PMREMGenerator_js__WEBPACK_IMPORTED_MODULE_16__[\"default\"]( this.renderer );\n\n\t}\n\n\tincludes( node ) {\n\n\t\treturn this.nodes.includes( node );\n\n\t}\n\n\t_getSharedBindings( bindings ) {\n\n\t\tconst shared = [];\n\n\t\tfor ( const binding of bindings ) {\n\n\t\t\tif ( binding.shared === true ) {\n\n\t\t\t\t// nodes is the chainmap key\n\t\t\t\tconst nodes = binding.getNodes();\n\n\t\t\t\tlet sharedBinding = uniformsGroupCache.get( nodes );\n\n\t\t\t\tif ( sharedBinding === undefined ) {\n\n\t\t\t\t\tuniformsGroupCache.set( nodes, binding );\n\n\t\t\t\t\tsharedBinding = binding;\n\n\t\t\t\t}\n\n\t\t\t\tshared.push( sharedBinding );\n\n\t\t\t} else {\n\n\t\t\t\tshared.push( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn shared;\n\n\t}\n\n\tgetBindings() {\n\n\t\tlet bindingsArray = this.bindingsArray;\n\n\t\tif ( bindingsArray === null ) {\n\n\t\t\tconst bindings = this.bindings;\n\n\t\t\tthis.bindingsArray = bindingsArray = this._getSharedBindings( ( this.material !== null ) ? [ ...bindings.vertex, ...bindings.fragment ] : bindings.compute );\n\n\t\t}\n\n\t\treturn bindingsArray;\n\n\t}\n\n\tsetHashNode( node, hash ) {\n\n\t\tthis.hashNodes[ hash ] = node;\n\n\t}\n\n\taddNode( node ) {\n\n\t\tif ( this.nodes.includes( node ) === false ) {\n\n\t\t\tthis.nodes.push( node );\n\n\t\t\tthis.setHashNode( node, node.getHash( this ) );\n\n\t\t}\n\n\t}\n\n\tbuildUpdateNodes() {\n\n\t\tfor ( const node of this.nodes ) {\n\n\t\t\tconst updateType = node.getUpdateType();\n\t\t\tconst updateBeforeType = node.getUpdateBeforeType();\n\n\t\t\tif ( updateType !== _constants_js__WEBPACK_IMPORTED_MODULE_10__.NodeUpdateType.NONE ) {\n\n\t\t\t\tthis.updateNodes.push( node.getSelf() );\n\n\t\t\t}\n\n\t\t\tif ( updateBeforeType !== _constants_js__WEBPACK_IMPORTED_MODULE_10__.NodeUpdateType.NONE ) {\n\n\t\t\t\tthis.updateBeforeNodes.push( node );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tget currentNode() {\n\n\t\treturn this.chaining[ this.chaining.length - 1 ];\n\n\t}\n\n\taddChain( node ) {\n\n\t\t/*\n\t\tif ( this.chaining.indexOf( node ) !== - 1 ) {\n\n\t\t\tconsole.warn( 'Recursive node: ', node );\n\n\t\t}\n\t\t*/\n\n\t\tthis.chaining.push( node );\n\n\t}\n\n\tremoveChain( node ) {\n\n\t\tconst lastChain = this.chaining.pop();\n\n\t\tif ( lastChain !== node ) {\n\n\t\t\tthrow new Error( 'NodeBuilder: Invalid node chaining!' );\n\n\t\t}\n\n\t}\n\n\tgetMethod( method ) {\n\n\t\treturn method;\n\n\t}\n\n\tgetNodeFromHash( hash ) {\n\n\t\treturn this.hashNodes[ hash ];\n\n\t}\n\n\taddFlow( shaderStage, node ) {\n\n\t\tthis.flowNodes[ shaderStage ].push( node );\n\n\t\treturn node;\n\n\t}\n\n\tsetContext( context ) {\n\n\t\tthis.context = context;\n\n\t}\n\n\tgetContext() {\n\n\t\treturn this.context;\n\n\t}\n\n\tsetCache( cache ) {\n\n\t\tthis.cache = cache;\n\n\t}\n\n\tgetCache() {\n\n\t\treturn this.cache;\n\n\t}\n\n\tisAvailable( /*name*/ ) {\n\n\t\treturn false;\n\n\t}\n\n\tgetVertexIndex() {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n\tgetInstanceIndex() {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n\tgetFrontFacing() {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n\tgetFragCoord() {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n\tisFlipY() {\n\n\t\treturn false;\n\n\t}\n\n\tgenerateTexture( /* texture, textureProperty, uvSnippet */ ) {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n\tgenerateTextureLod( /* texture, textureProperty, uvSnippet, levelSnippet */ ) {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n\tgenerateConst( type, value = null ) {\n\n\t\tif ( value === null ) {\n\n\t\t\tif ( type === 'float' || type === 'int' || type === 'uint' ) value = 0;\n\t\t\telse if ( type === 'bool' ) value = false;\n\t\t\telse if ( type === 'color' ) value = new three__WEBPACK_IMPORTED_MODULE_14__.Color();\n\t\t\telse if ( type === 'vec2' ) value = new three__WEBPACK_IMPORTED_MODULE_14__.Vector2();\n\t\t\telse if ( type === 'vec3' ) value = new three__WEBPACK_IMPORTED_MODULE_14__.Vector3();\n\t\t\telse if ( type === 'vec4' ) value = new three__WEBPACK_IMPORTED_MODULE_14__.Vector4();\n\n\t\t}\n\n\t\tif ( type === 'float' ) return toFloat( value );\n\t\tif ( type === 'int' ) return `${ Math.round( value ) }`;\n\t\tif ( type === 'uint' ) return value >= 0 ? `${ Math.round( value ) }u` : '0u';\n\t\tif ( type === 'bool' ) return value ? 'true' : 'false';\n\t\tif ( type === 'color' ) return `${ this.getType( 'vec3' ) }( ${ toFloat( value.r ) }, ${ toFloat( value.g ) }, ${ toFloat( value.b ) } )`;\n\n\t\tconst typeLength = this.getTypeLength( type );\n\n\t\tconst componentType = this.getComponentType( type );\n\n\t\tconst generateConst = value => this.generateConst( componentType, value );\n\n\t\tif ( typeLength === 2 ) {\n\n\t\t\treturn `${ this.getType( type ) }( ${ generateConst( value.x ) }, ${ generateConst( value.y ) } )`;\n\n\t\t} else if ( typeLength === 3 ) {\n\n\t\t\treturn `${ this.getType( type ) }( ${ generateConst( value.x ) }, ${ generateConst( value.y ) }, ${ generateConst( value.z ) } )`;\n\n\t\t} else if ( typeLength === 4 ) {\n\n\t\t\treturn `${ this.getType( type ) }( ${ generateConst( value.x ) }, ${ generateConst( value.y ) }, ${ generateConst( value.z ) }, ${ generateConst( value.w ) } )`;\n\n\t\t} else if ( typeLength > 4 && value && ( value.isMatrix3 || value.isMatrix4 ) ) {\n\n\t\t\treturn `${ this.getType( type ) }( ${ value.elements.map( generateConst ).join( ', ' ) } )`;\n\n\t\t} else if ( typeLength > 4 ) {\n\n\t\t\treturn `${ this.getType( type ) }()`;\n\n\t\t}\n\n\t\tthrow new Error( `NodeBuilder: Type '${type}' not found in generate constant attempt.` );\n\n\t}\n\n\tgetType( type ) {\n\n\t\tif ( type === 'color' ) return 'vec3';\n\n\t\treturn type;\n\n\t}\n\n\tgenerateMethod( method ) {\n\n\t\treturn method;\n\n\t}\n\n\thasGeometryAttribute( name ) {\n\n\t\treturn this.geometry && this.geometry.getAttribute( name ) !== undefined;\n\n\t}\n\n\tgetAttribute( name, type ) {\n\n\t\tconst attributes = this.attributes;\n\n\t\t// find attribute\n\n\t\tfor ( const attribute of attributes ) {\n\n\t\t\tif ( attribute.name === name ) {\n\n\t\t\t\treturn attribute;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// create a new if no exist\n\n\t\tconst attribute = new _NodeAttribute_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]( name, type );\n\n\t\tattributes.push( attribute );\n\n\t\treturn attribute;\n\n\t}\n\n\tgetPropertyName( node/*, shaderStage*/ ) {\n\n\t\treturn node.name;\n\n\t}\n\n\tisVector( type ) {\n\n\t\treturn /vec\\d/.test( type );\n\n\t}\n\n\tisMatrix( type ) {\n\n\t\treturn /mat\\d/.test( type );\n\n\t}\n\n\tisReference( type ) {\n\n\t\treturn type === 'void' || type === 'property' || type === 'sampler' || type === 'texture' || type === 'cubeTexture' || type === 'storageTexture';\n\n\t}\n\n\tneedsColorSpaceToLinear( /*texture*/ ) {\n\n\t\treturn false;\n\n\t}\n\n\tgetComponentTypeFromTexture( texture ) {\n\n\t\tconst type = texture.type;\n\n\t\tif ( texture.isDataTexture ) {\n\n\t\t\tif ( type === three__WEBPACK_IMPORTED_MODULE_14__.IntType ) return 'int';\n\t\t\tif ( type === three__WEBPACK_IMPORTED_MODULE_14__.UnsignedIntType ) return 'uint';\n\n\t\t}\n\n\t\treturn 'float';\n\n\t}\n\n\tgetComponentType( type ) {\n\n\t\ttype = this.getVectorType( type );\n\n\t\tif ( type === 'float' || type === 'bool' || type === 'int' || type === 'uint' ) return type;\n\n\t\tconst componentType = /(b|i|u|)(vec|mat)([2-4])/.exec( type );\n\n\t\tif ( componentType === null ) return null;\n\n\t\tif ( componentType[ 1 ] === 'b' ) return 'bool';\n\t\tif ( componentType[ 1 ] === 'i' ) return 'int';\n\t\tif ( componentType[ 1 ] === 'u' ) return 'uint';\n\n\t\treturn 'float';\n\n\t}\n\n\tgetVectorType( type ) {\n\n\t\tif ( type === 'color' ) return 'vec3';\n\t\tif ( type === 'texture' || type === 'cubeTexture' || type === 'storageTexture' ) return 'vec4';\n\n\t\treturn type;\n\n\t}\n\n\tgetTypeFromLength( length, componentType = 'float' ) {\n\n\t\tif ( length === 1 ) return componentType;\n\n\t\tconst baseType = typeFromLength.get( length );\n\t\tconst prefix = componentType === 'float' ? '' : componentType[ 0 ];\n\n\t\treturn prefix + baseType;\n\n\t}\n\n\tgetTypeFromArray( array ) {\n\n\t\treturn typeFromArray.get( array.constructor );\n\n\t}\n\n\tgetTypeFromAttribute( attribute ) {\n\n\t\tlet dataAttribute = attribute;\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) dataAttribute = attribute.data;\n\n\t\tconst array = dataAttribute.array;\n\t\tconst itemSize = attribute.itemSize;\n\t\tconst normalized = attribute.normalized;\n\n\t\tlet arrayType;\n\n\t\tif ( ! ( attribute instanceof three__WEBPACK_IMPORTED_MODULE_14__.Float16BufferAttribute ) && normalized !== true ) {\n\n\t\t\tarrayType = this.getTypeFromArray( array );\n\n\t\t}\n\n\t\treturn this.getTypeFromLength( itemSize, arrayType );\n\n\t}\n\n\tgetTypeLength( type ) {\n\n\t\tconst vecType = this.getVectorType( type );\n\t\tconst vecNum = /vec([2-4])/.exec( vecType );\n\n\t\tif ( vecNum !== null ) return Number( vecNum[ 1 ] );\n\t\tif ( vecType === 'float' || vecType === 'bool' || vecType === 'int' || vecType === 'uint' ) return 1;\n\t\tif ( /mat2/.test( type ) === true ) return 4;\n\t\tif ( /mat3/.test( type ) === true ) return 9;\n\t\tif ( /mat4/.test( type ) === true ) return 16;\n\n\t\treturn 0;\n\n\t}\n\n\tgetVectorFromMatrix( type ) {\n\n\t\treturn type.replace( 'mat', 'vec' );\n\n\t}\n\n\tchangeComponentType( type, newComponentType ) {\n\n\t\treturn this.getTypeFromLength( this.getTypeLength( type ), newComponentType );\n\n\t}\n\n\tgetIntegerType( type ) {\n\n\t\tconst componentType = this.getComponentType( type );\n\n\t\tif ( componentType === 'int' || componentType === 'uint' ) return type;\n\n\t\treturn this.changeComponentType( type, 'int' );\n\n\t}\n\n\taddStack() {\n\n\t\tthis.stack = (0,_StackNode_js__WEBPACK_IMPORTED_MODULE_11__.stack)( this.stack );\n\n\t\tthis.stacks.push( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_12__.getCurrentStack)() || this.stack );\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_12__.setCurrentStack)( this.stack );\n\n\t\treturn this.stack;\n\n\t}\n\n\tremoveStack() {\n\n\t\tconst lastStack = this.stack;\n\t\tthis.stack = lastStack.parent;\n\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_12__.setCurrentStack)( this.stacks.pop() );\n\n\t\treturn lastStack;\n\n\t}\n\n\tgetDataFromNode( node, shaderStage = this.shaderStage, cache = null ) {\n\n\t\tcache = cache === null ? ( node.isGlobal( this ) ? this.globalCache : this.cache ) : cache;\n\n\t\tlet nodeData = cache.getNodeData( node );\n\n\t\tif ( nodeData === undefined ) {\n\n\t\t\tnodeData = {};\n\n\t\t\tcache.setNodeData( node, nodeData );\n\n\t\t}\n\n\t\tif ( nodeData[ shaderStage ] === undefined ) nodeData[ shaderStage ] = {};\n\n\t\treturn nodeData[ shaderStage ];\n\n\t}\n\n\tgetNodeProperties( node, shaderStage = 'any' ) {\n\n\t\tconst nodeData = this.getDataFromNode( node, shaderStage );\n\n\t\treturn nodeData.properties || ( nodeData.properties = { outputNode: null } );\n\n\t}\n\n\tgetBufferAttributeFromNode( node, type ) {\n\n\t\tconst nodeData = this.getDataFromNode( node );\n\n\t\tlet bufferAttribute = nodeData.bufferAttribute;\n\n\t\tif ( bufferAttribute === undefined ) {\n\n\t\t\tconst index = this.uniforms.index ++;\n\n\t\t\tbufferAttribute = new _NodeAttribute_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]( 'nodeAttribute' + index, type, node );\n\n\t\t\tthis.bufferAttributes.push( bufferAttribute );\n\n\t\t\tnodeData.bufferAttribute = bufferAttribute;\n\n\t\t}\n\n\t\treturn bufferAttribute;\n\n\t}\n\n\tgetStructTypeFromNode( node, shaderStage = this.shaderStage ) {\n\n\t\tconst nodeData = this.getDataFromNode( node, shaderStage );\n\n\t\tif ( nodeData.structType === undefined ) {\n\n\t\t\tconst index = this.structs.index ++;\n\n\t\t\tnode.name = `StructType${ index }`;\n\t\t\tthis.structs[ shaderStage ].push( node );\n\n\t\t\tnodeData.structType = node;\n\n\t\t}\n\n\t\treturn node;\n\n\t}\n\n\tgetUniformFromNode( node, type, shaderStage = this.shaderStage, name = null ) {\n\n\t\tconst nodeData = this.getDataFromNode( node, shaderStage, this.globalCache );\n\n\t\tlet nodeUniform = nodeData.uniform;\n\n\t\tif ( nodeUniform === undefined ) {\n\n\t\t\tconst index = this.uniforms.index ++;\n\n\t\t\tnodeUniform = new _NodeUniform_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]( name || ( 'nodeUniform' + index ), type, node );\n\n\t\t\tthis.uniforms[ shaderStage ].push( nodeUniform );\n\n\t\t\tnodeData.uniform = nodeUniform;\n\n\t\t}\n\n\t\treturn nodeUniform;\n\n\t}\n\n\tgetVarFromNode( node, name = null, type = node.getNodeType( this ), shaderStage = this.shaderStage ) {\n\n\t\tconst nodeData = this.getDataFromNode( node, shaderStage );\n\n\t\tlet nodeVar = nodeData.variable;\n\n\t\tif ( nodeVar === undefined ) {\n\n\t\t\tconst vars = this.vars[ shaderStage ] || ( this.vars[ shaderStage ] = [] );\n\n\t\t\tif ( name === null ) name = 'nodeVar' + vars.length;\n\n\t\t\tnodeVar = new _NodeVar_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]( name, type );\n\n\t\t\tvars.push( nodeVar );\n\n\t\t\tnodeData.variable = nodeVar;\n\n\t\t}\n\n\t\treturn nodeVar;\n\n\t}\n\n\tgetVaryingFromNode( node, name = null, type = node.getNodeType( this ) ) {\n\n\t\tconst nodeData = this.getDataFromNode( node, 'any' );\n\n\t\tlet nodeVarying = nodeData.varying;\n\n\t\tif ( nodeVarying === undefined ) {\n\n\t\t\tconst varyings = this.varyings;\n\t\t\tconst index = varyings.length;\n\n\t\t\tif ( name === null ) name = 'nodeVarying' + index;\n\n\t\t\tnodeVarying = new _NodeVarying_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]( name, type );\n\n\t\t\tvaryings.push( nodeVarying );\n\n\t\t\tnodeData.varying = nodeVarying;\n\n\t\t}\n\n\t\treturn nodeVarying;\n\n\t}\n\n\tgetCodeFromNode( node, type, shaderStage = this.shaderStage ) {\n\n\t\tconst nodeData = this.getDataFromNode( node );\n\n\t\tlet nodeCode = nodeData.code;\n\n\t\tif ( nodeCode === undefined ) {\n\n\t\t\tconst codes = this.codes[ shaderStage ] || ( this.codes[ shaderStage ] = [] );\n\t\t\tconst index = codes.length;\n\n\t\t\tnodeCode = new _NodeCode_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]( 'nodeCode' + index, type );\n\n\t\t\tcodes.push( nodeCode );\n\n\t\t\tnodeData.code = nodeCode;\n\n\t\t}\n\n\t\treturn nodeCode;\n\n\t}\n\n\taddLineFlowCode( code ) {\n\n\t\tif ( code === '' ) return this;\n\n\t\tcode = this.tab + code;\n\n\t\tif ( ! /;\\s*$/.test( code ) ) {\n\n\t\t\tcode = code + ';\\n';\n\n\t\t}\n\n\t\tthis.flow.code += code;\n\n\t\treturn this;\n\n\t}\n\n\taddFlowCode( code ) {\n\n\t\tthis.flow.code += code;\n\n\t\treturn this;\n\n\t}\n\n\taddFlowTab() {\n\n\t\tthis.tab += '\\t';\n\n\t\treturn this;\n\n\t}\n\n\tremoveFlowTab() {\n\n\t\tthis.tab = this.tab.slice( 0, - 1 );\n\n\t\treturn this;\n\n\t}\n\n\tgetFlowData( node/*, shaderStage*/ ) {\n\n\t\treturn this.flowsData.get( node );\n\n\t}\n\n\tflowNode( node ) {\n\n\t\tconst output = node.getNodeType( this );\n\n\t\tconst flowData = this.flowChildNode( node, output );\n\n\t\tthis.flowsData.set( node, flowData );\n\n\t\treturn flowData;\n\n\t}\n\n\tbuildFunctionNode( shaderNode ) {\n\n\t\tconst fn = new _code_FunctionNode_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]();\n\n\t\tconst previous = this.currentFunctionNode;\n\n\t\tthis.currentFunctionNode = fn;\n\n\t\tfn.code = this.buildFunctionCode( shaderNode );\n\n\t\tthis.currentFunctionNode = previous;\n\n\t\treturn fn;\n\n\t}\n\n\tflowShaderNode( shaderNode ) {\n\n\t\tconst layout = shaderNode.layout;\n\n\t\tlet inputs;\n\n\t\tif ( shaderNode.isArrayInput ) {\n\n\t\t\tinputs = [];\n\n\t\t\tfor ( const input of layout.inputs ) {\n\n\t\t\t\tinputs.push( new _ParameterNode_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]( input.type, input.name ) );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tinputs = {};\n\n\t\t\tfor ( const input of layout.inputs ) {\n\n\t\t\t\tinputs[ input.name ] = new _ParameterNode_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]( input.type, input.name );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tshaderNode.layout = null;\n\n\t\tconst callNode = shaderNode.call( inputs );\n\t\tconst flowData = this.flowStagesNode( callNode, layout.type );\n\n\t\tshaderNode.layout = layout;\n\n\t\treturn flowData;\n\n\t}\n\n\tflowStagesNode( node, output = null ) {\n\n\t\tconst previousFlow = this.flow;\n\t\tconst previousVars = this.vars;\n\t\tconst previousBuildStage = this.buildStage;\n\n\t\tconst flow = {\n\t\t\tcode: ''\n\t\t};\n\n\t\tthis.flow = flow;\n\t\tthis.vars = {};\n\n\t\tfor ( const buildStage of _constants_js__WEBPACK_IMPORTED_MODULE_10__.defaultBuildStages ) {\n\n\t\t\tthis.setBuildStage( buildStage );\n\n\t\t\tflow.result = node.build( this, output );\n\n\t\t}\n\n\t\tflow.vars = this.getVars( this.shaderStage );\n\n\t\tthis.flow = previousFlow;\n\t\tthis.vars = previousVars;\n\t\tthis.setBuildStage( previousBuildStage );\n\n\t\treturn flow;\n\n\t}\n\n\tgetFunctionOperator() {\n\n\t\treturn null;\n\n\t}\n\n\tflowChildNode( node, output = null ) {\n\n\t\tconst previousFlow = this.flow;\n\n\t\tconst flow = {\n\t\t\tcode: ''\n\t\t};\n\n\t\tthis.flow = flow;\n\n\t\tflow.result = node.build( this, output );\n\n\t\tthis.flow = previousFlow;\n\n\t\treturn flow;\n\n\t}\n\n\tflowNodeFromShaderStage( shaderStage, node, output = null, propertyName = null ) {\n\n\t\tconst previousShaderStage = this.shaderStage;\n\n\t\tthis.setShaderStage( shaderStage );\n\n\t\tconst flowData = this.flowChildNode( node, output );\n\n\t\tif ( propertyName !== null ) {\n\n\t\t\tflowData.code += `${ this.tab + propertyName } = ${ flowData.result };\\n`;\n\n\t\t}\n\n\t\tthis.flowCode[ shaderStage ] = this.flowCode[ shaderStage ] + flowData.code;\n\n\t\tthis.setShaderStage( previousShaderStage );\n\n\t\treturn flowData;\n\n\t}\n\n\tgetAttributesArray() {\n\n\t\treturn this.attributes.concat( this.bufferAttributes );\n\n\t}\n\n\tgetAttributes( /*shaderStage*/ ) {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n\tgetVaryings( /*shaderStage*/ ) {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n\tgetVar( type, name ) {\n\n\t\treturn `${ this.getType( type ) } ${ name }`;\n\n\t}\n\n\tgetVars( shaderStage ) {\n\n\t\tlet snippet = '';\n\n\t\tconst vars = this.vars[ shaderStage ];\n\n\t\tif ( vars !== undefined ) {\n\n\t\t\tfor ( const variable of vars ) {\n\n\t\t\t\tsnippet += `${ this.getVar( variable.type, variable.name ) }; `;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn snippet;\n\n\t}\n\n\tgetUniforms( /*shaderStage*/ ) {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n\tgetCodes( shaderStage ) {\n\n\t\tconst codes = this.codes[ shaderStage ];\n\n\t\tlet code = '';\n\n\t\tif ( codes !== undefined ) {\n\n\t\t\tfor ( const nodeCode of codes ) {\n\n\t\t\t\tcode += nodeCode.code + '\\n';\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn code;\n\n\t}\n\n\tgetHash() {\n\n\t\treturn this.vertexShader + this.fragmentShader + this.computeShader;\n\n\t}\n\n\tsetShaderStage( shaderStage ) {\n\n\t\tthis.shaderStage = shaderStage;\n\n\t}\n\n\tgetShaderStage() {\n\n\t\treturn this.shaderStage;\n\n\t}\n\n\tsetBuildStage( buildStage ) {\n\n\t\tthis.buildStage = buildStage;\n\n\t}\n\n\tgetBuildStage() {\n\n\t\treturn this.buildStage;\n\n\t}\n\n\tbuildCode() {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n\tbuild( convertMaterial = true ) {\n\n\t\tconst { object, material } = this;\n\n\t\tif ( convertMaterial ) {\n\n\t\t\tif ( material !== null ) {\n\n\t\t\t\t_materials_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"].fromMaterial( material ).build( this );\n\n\t\t\t} else {\n\n\t\t\t\tthis.addFlow( 'compute', object );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// setup() -> stage 1: create possible new nodes and returns an output reference node\n\t\t// analyze() -> stage 2: analyze nodes to possible optimization and validation\n\t\t// generate() -> stage 3: generate shader\n\n\t\tfor ( const buildStage of _constants_js__WEBPACK_IMPORTED_MODULE_10__.defaultBuildStages ) {\n\n\t\t\tthis.setBuildStage( buildStage );\n\n\t\t\tif ( this.context.vertex && this.context.vertex.isNode ) {\n\n\t\t\t\tthis.flowNodeFromShaderStage( 'vertex', this.context.vertex );\n\n\t\t\t}\n\n\t\t\tfor ( const shaderStage of _constants_js__WEBPACK_IMPORTED_MODULE_10__.shaderStages ) {\n\n\t\t\t\tthis.setShaderStage( shaderStage );\n\n\t\t\t\tconst flowNodes = this.flowNodes[ shaderStage ];\n\n\t\t\t\tfor ( const node of flowNodes ) {\n\n\t\t\t\t\tif ( buildStage === 'generate' ) {\n\n\t\t\t\t\t\tthis.flowNode( node );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tnode.build( this );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.setBuildStage( null );\n\t\tthis.setShaderStage( null );\n\n\t\t// stage 4: build code for a specific output\n\n\t\tthis.buildCode();\n\t\tthis.buildUpdateNodes();\n\n\t\treturn this;\n\n\t}\n\n\tgetNodeUniform( uniformNode, type ) {\n\n\t\tif ( type === 'float' ) return new _renderers_common_nodes_NodeUniform_js__WEBPACK_IMPORTED_MODULE_17__.FloatNodeUniform( uniformNode );\n\t\tif ( type === 'vec2' ) return new _renderers_common_nodes_NodeUniform_js__WEBPACK_IMPORTED_MODULE_17__.Vector2NodeUniform( uniformNode );\n\t\tif ( type === 'vec3' ) return new _renderers_common_nodes_NodeUniform_js__WEBPACK_IMPORTED_MODULE_17__.Vector3NodeUniform( uniformNode );\n\t\tif ( type === 'vec4' ) return new _renderers_common_nodes_NodeUniform_js__WEBPACK_IMPORTED_MODULE_17__.Vector4NodeUniform( uniformNode );\n\t\tif ( type === 'color' ) return new _renderers_common_nodes_NodeUniform_js__WEBPACK_IMPORTED_MODULE_17__.ColorNodeUniform( uniformNode );\n\t\tif ( type === 'mat3' ) return new _renderers_common_nodes_NodeUniform_js__WEBPACK_IMPORTED_MODULE_17__.Matrix3NodeUniform( uniformNode );\n\t\tif ( type === 'mat4' ) return new _renderers_common_nodes_NodeUniform_js__WEBPACK_IMPORTED_MODULE_17__.Matrix4NodeUniform( uniformNode );\n\n\t\tthrow new Error( `Uniform \"${type}\" not declared.` );\n\n\t}\n\n\tcreateNodeMaterial( type = 'NodeMaterial' ) {\n\n\t\t// TODO: Move Materials.js to outside of the Nodes.js in order to remove this function and improve tree-shaking support\n\n\t\treturn (0,_materials_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_9__.createNodeMaterialFromType)( type );\n\n\t}\n\n\tformat( snippet, fromType, toType ) {\n\n\t\tfromType = this.getVectorType( fromType );\n\t\ttoType = this.getVectorType( toType );\n\n\t\tif ( fromType === toType || toType === null || this.isReference( toType ) ) {\n\n\t\t\treturn snippet;\n\n\t\t}\n\n\t\tconst fromTypeLength = this.getTypeLength( fromType );\n\t\tconst toTypeLength = this.getTypeLength( toType );\n\n\t\tif ( fromTypeLength > 4 ) { // fromType is matrix-like\n\n\t\t\t// @TODO: ignore for now\n\n\t\t\treturn snippet;\n\n\t\t}\n\n\t\tif ( toTypeLength > 4 || toTypeLength === 0 ) { // toType is matrix-like or unknown\n\n\t\t\t// @TODO: ignore for now\n\n\t\t\treturn snippet;\n\n\t\t}\n\n\t\tif ( fromTypeLength === toTypeLength ) {\n\n\t\t\treturn `${ this.getType( toType ) }( ${ snippet } )`;\n\n\t\t}\n\n\t\tif ( fromTypeLength > toTypeLength ) {\n\n\t\t\treturn this.format( `${ snippet }.${ 'xyz'.slice( 0, toTypeLength ) }`, this.getTypeFromLength( toTypeLength, this.getComponentType( fromType ) ), toType );\n\n\t\t}\n\n\t\tif ( toTypeLength === 4 && fromTypeLength > 1 ) { // toType is vec4-like\n\n\t\t\treturn `${ this.getType( toType ) }( ${ this.format( snippet, fromType, 'vec3' ) }, 1.0 )`;\n\n\t\t}\n\n\t\tif ( fromTypeLength === 2 ) { // fromType is vec2-like and toType is vec3-like\n\n\t\t\treturn `${ this.getType( toType ) }( ${ this.format( snippet, fromType, 'vec2' ) }, 0.0 )`;\n\n\t\t}\n\n\t\tif ( fromTypeLength === 1 && toTypeLength > 1 && fromType[ 0 ] !== toType[ 0 ] ) { // fromType is float-like\n\n\t\t\t// convert a number value to vector type, e.g:\n\t\t\t// vec3( 1u ) -> vec3( float( 1u ) )\n\n\t\t\tsnippet = `${ this.getType( this.getComponentType( toType ) ) }( ${ snippet } )`;\n\n\t\t}\n\n\t\treturn `${ this.getType( toType ) }( ${ snippet } )`; // fromType is float-like\n\n\t}\n\n\tgetSignature() {\n\n\t\treturn `// Three.js r${ three__WEBPACK_IMPORTED_MODULE_14__.REVISION } - NodeMaterial System\\n`;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeBuilder);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeBuilder.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeCache.js": +/*!*****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeCache.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nlet id = 0;\n\nclass NodeCache {\n\n\tconstructor() {\n\n\t\tthis.id = id ++;\n\t\tthis.nodesData = new WeakMap();\n\n\t}\n\n\tgetNodeData( node ) {\n\n\t\treturn this.nodesData.get( node );\n\n\t}\n\n\tsetNodeData( node, data ) {\n\n\t\tthis.nodesData.set( node, data );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeCache);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeCache.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeCode.js": +/*!****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeCode.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nclass NodeCode {\n\n\tconstructor( name, type, code = '' ) {\n\n\t\tthis.name = name;\n\t\tthis.type = type;\n\t\tthis.code = code;\n\n\t\tObject.defineProperty( this, 'isNodeCode', { value: true } );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeCode);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeCode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeFrame.js": +/*!*****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeFrame.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n\n\nclass NodeFrame {\n\n\tconstructor() {\n\n\t\tthis.time = 0;\n\t\tthis.deltaTime = 0;\n\n\t\tthis.frameId = 0;\n\t\tthis.renderId = 0;\n\n\t\tthis.startTime = null;\n\n\t\tthis.updateMap = new WeakMap();\n\t\tthis.updateBeforeMap = new WeakMap();\n\n\t\tthis.renderer = null;\n\t\tthis.material = null;\n\t\tthis.camera = null;\n\t\tthis.object = null;\n\t\tthis.scene = null;\n\n\t}\n\n\t_getMaps( referenceMap, nodeRef ) {\n\n\t\tlet maps = referenceMap.get( nodeRef );\n\n\t\tif ( maps === undefined ) {\n\n\t\t\tmaps = {\n\t\t\t\trenderMap: new WeakMap(),\n\t\t\t\tframeMap: new WeakMap()\n\t\t\t};\n\n\t\t\treferenceMap.set( nodeRef, maps );\n\n\t\t}\n\n\t\treturn maps;\n\n\t}\n\n\tupdateBeforeNode( node ) {\n\n\t\tconst updateType = node.getUpdateBeforeType();\n\t\tconst reference = node.updateReference( this );\n\n\t\tif ( updateType === _constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeUpdateType.FRAME ) {\n\n\t\t\tconst { frameMap } = this._getMaps( this.updateBeforeMap, reference );\n\n\t\t\tif ( frameMap.get( reference ) !== this.frameId ) {\n\n\t\t\t\tif ( node.updateBefore( this ) !== false ) {\n\n\t\t\t\t\tframeMap.set( reference, this.frameId );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( updateType === _constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeUpdateType.RENDER ) {\n\n\t\t\tconst { renderMap } = this._getMaps( this.updateBeforeMap, reference );\n\n\t\t\tif ( renderMap.get( reference ) !== this.renderId ) {\n\n\t\t\t\tif ( node.updateBefore( this ) !== false ) {\n\n\t\t\t\t\trenderMap.set( reference, this.renderId );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( updateType === _constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeUpdateType.OBJECT ) {\n\n\t\t\tnode.updateBefore( this );\n\n\t\t}\n\n\t}\n\n\tupdateNode( node ) {\n\n\t\tconst updateType = node.getUpdateType();\n\t\tconst reference = node.updateReference( this );\n\n\t\tif ( updateType === _constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeUpdateType.FRAME ) {\n\n\t\t\tconst { frameMap } = this._getMaps( this.updateMap, reference );\n\n\t\t\tif ( frameMap.get( reference ) !== this.frameId ) {\n\n\t\t\t\tif ( node.update( this ) !== false ) {\n\n\t\t\t\t\tframeMap.set( reference, this.frameId );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( updateType === _constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeUpdateType.RENDER ) {\n\n\t\t\tconst { renderMap } = this._getMaps( this.updateMap, reference );\n\n\t\t\tif ( renderMap.get( reference ) !== this.renderId ) {\n\n\t\t\t\tif ( node.update( this ) !== false ) {\n\n\t\t\t\t\trenderMap.set( reference, this.renderId );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( updateType === _constants_js__WEBPACK_IMPORTED_MODULE_0__.NodeUpdateType.OBJECT ) {\n\n\t\t\tnode.update( this );\n\n\t\t}\n\n\t}\n\n\tupdate() {\n\n\t\tthis.frameId ++;\n\n\t\tif ( this.lastTime === undefined ) this.lastTime = performance.now();\n\n\t\tthis.deltaTime = ( performance.now() - this.lastTime ) / 1000;\n\n\t\tthis.lastTime = performance.now();\n\n\t\tthis.time += this.deltaTime;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeFrame);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeFrame.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeFunction.js": +/*!********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeFunction.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nclass NodeFunction {\n\n\tconstructor( type, inputs, name = '', presicion = '' ) {\n\n\t\tthis.type = type;\n\t\tthis.inputs = inputs;\n\t\tthis.name = name;\n\t\tthis.presicion = presicion;\n\n\t}\n\n\tgetCode( /*name = this.name*/ ) {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n}\n\nNodeFunction.isNodeFunction = true;\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeFunction);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeFunction.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeFunctionInput.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeFunctionInput.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nclass NodeFunctionInput {\n\n\tconstructor( type, name, count = null, qualifier = '', isConst = false ) {\n\n\t\tthis.type = type;\n\t\tthis.name = name;\n\t\tthis.count = count;\n\t\tthis.qualifier = qualifier;\n\t\tthis.isConst = isConst;\n\n\t}\n\n}\n\nNodeFunctionInput.isNodeFunctionInput = true;\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeFunctionInput);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeFunctionInput.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeKeywords.js": +/*!********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeKeywords.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nclass NodeKeywords {\n\n\tconstructor() {\n\n\t\tthis.keywords = [];\n\t\tthis.nodes = [];\n\t\tthis.keywordsCallback = {};\n\n\t}\n\n\tgetNode( name ) {\n\n\t\tlet node = this.nodes[ name ];\n\n\t\tif ( node === undefined && this.keywordsCallback[ name ] !== undefined ) {\n\n\t\t\tnode = this.keywordsCallback[ name ]( name );\n\n\t\t\tthis.nodes[ name ] = node;\n\n\t\t}\n\n\t\treturn node;\n\n\t}\n\n\taddKeyword( name, callback ) {\n\n\t\tthis.keywords.push( name );\n\t\tthis.keywordsCallback[ name ] = callback;\n\n\t\treturn this;\n\n\t}\n\n\tparse( code ) {\n\n\t\tconst keywordNames = this.keywords;\n\n\t\tconst regExp = new RegExp( `\\\\b${keywordNames.join( '\\\\b|\\\\b' )}\\\\b`, 'g' );\n\n\t\tconst codeKeywords = code.match( regExp );\n\n\t\tconst keywordNodes = [];\n\n\t\tif ( codeKeywords !== null ) {\n\n\t\t\tfor ( const keyword of codeKeywords ) {\n\n\t\t\t\tconst node = this.getNode( keyword );\n\n\t\t\t\tif ( node !== undefined && keywordNodes.indexOf( node ) === - 1 ) {\n\n\t\t\t\t\tkeywordNodes.push( node );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn keywordNodes;\n\n\t}\n\n\tinclude( builder, code ) {\n\n\t\tconst keywordNodes = this.parse( code );\n\n\t\tfor ( const keywordNode of keywordNodes ) {\n\n\t\t\tkeywordNode.build( builder );\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeKeywords);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeKeywords.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeParser.js": +/*!******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeParser.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nclass NodeParser {\n\n\tparseFunction( /*source*/ ) {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeParser);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeParser.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeUniform.js": +/*!*******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeUniform.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nclass NodeUniform {\n\n\tconstructor( name, type, node, needsUpdate = undefined ) {\n\n\t\tthis.isNodeUniform = true;\n\n\t\tthis.name = name;\n\t\tthis.type = type;\n\t\tthis.node = node.getSelf();\n\t\tthis.needsUpdate = needsUpdate;\n\n\t}\n\n\tget value() {\n\n\t\treturn this.node.value;\n\n\t}\n\n\tset value( val ) {\n\n\t\tthis.node.value = val;\n\n\t}\n\n\tget id() {\n\n\t\treturn this.node.id;\n\n\t}\n\n\tget groupNode() {\n\n\t\treturn this.node.groupNode;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeUniform);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeUniform.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeUtils.js": +/*!*****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeUtils.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ arrayBufferToBase64: () => (/* binding */ arrayBufferToBase64),\n/* harmony export */ base64ToArrayBuffer: () => (/* binding */ base64ToArrayBuffer),\n/* harmony export */ getCacheKey: () => (/* binding */ getCacheKey),\n/* harmony export */ getNodeChildren: () => (/* binding */ getNodeChildren),\n/* harmony export */ getValueFromType: () => (/* binding */ getValueFromType),\n/* harmony export */ getValueType: () => (/* binding */ getValueType)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\nfunction getCacheKey( object, force = false ) {\n\n\tlet cacheKey = '{';\n\n\tif ( object.isNode === true ) {\n\n\t\tcacheKey += object.id;\n\n\t}\n\n\tfor ( const { property, childNode } of getNodeChildren( object ) ) {\n\n\t\tcacheKey += ',' + property.slice( 0, - 4 ) + ':' + childNode.getCacheKey( force );\n\n\t}\n\n\tcacheKey += '}';\n\n\treturn cacheKey;\n\n}\n\nfunction* getNodeChildren( node, toJSON = false ) {\n\n\tfor ( const property in node ) {\n\n\t\t// Ignore private properties.\n\t\tif ( property.startsWith( '_' ) === true ) continue;\n\n\t\tconst object = node[ property ];\n\n\t\tif ( Array.isArray( object ) === true ) {\n\n\t\t\tfor ( let i = 0; i < object.length; i ++ ) {\n\n\t\t\t\tconst child = object[ i ];\n\n\t\t\t\tif ( child && ( child.isNode === true || toJSON && typeof child.toJSON === 'function' ) ) {\n\n\t\t\t\t\tyield { property, index: i, childNode: child };\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( object && object.isNode === true ) {\n\n\t\t\tyield { property, childNode: object };\n\n\t\t} else if ( typeof object === 'object' ) {\n\n\t\t\tfor ( const subProperty in object ) {\n\n\t\t\t\tconst child = object[ subProperty ];\n\n\t\t\t\tif ( child && ( child.isNode === true || toJSON && typeof child.toJSON === 'function' ) ) {\n\n\t\t\t\t\tyield { property, index: subProperty, childNode: child };\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction getValueType( value ) {\n\n\tif ( value === undefined || value === null ) return null;\n\n\tconst typeOf = typeof value;\n\n\tif ( value.isNode === true ) {\n\n\t\treturn 'node';\n\n\t} else if ( typeOf === 'number' ) {\n\n\t\treturn 'float';\n\n\t} else if ( typeOf === 'boolean' ) {\n\n\t\treturn 'bool';\n\n\t} else if ( typeOf === 'string' ) {\n\n\t\treturn 'string';\n\n\t} else if ( typeOf === 'function' ) {\n\n\t\treturn 'shader';\n\n\t} else if ( value.isVector2 === true ) {\n\n\t\treturn 'vec2';\n\n\t} else if ( value.isVector3 === true ) {\n\n\t\treturn 'vec3';\n\n\t} else if ( value.isVector4 === true ) {\n\n\t\treturn 'vec4';\n\n\t} else if ( value.isMatrix3 === true ) {\n\n\t\treturn 'mat3';\n\n\t} else if ( value.isMatrix4 === true ) {\n\n\t\treturn 'mat4';\n\n\t} else if ( value.isColor === true ) {\n\n\t\treturn 'color';\n\n\t} else if ( value instanceof ArrayBuffer ) {\n\n\t\treturn 'ArrayBuffer';\n\n\t}\n\n\treturn null;\n\n}\n\nfunction getValueFromType( type, ...params ) {\n\n\tconst last4 = type ? type.slice( - 4 ) : undefined;\n\n\tif ( params.length === 1 ) { // ensure same behaviour as in NodeBuilder.format()\n\n\t\tif ( last4 === 'vec2' ) params = [ params[ 0 ], params[ 0 ] ];\n\t\telse if ( last4 === 'vec3' ) params = [ params[ 0 ], params[ 0 ], params[ 0 ] ];\n\t\telse if ( last4 === 'vec4' ) params = [ params[ 0 ], params[ 0 ], params[ 0 ], params[ 0 ] ];\n\n\t}\n\n\tif ( type === 'color' ) {\n\n\t\treturn new three__WEBPACK_IMPORTED_MODULE_0__.Color( ...params );\n\n\t} else if ( last4 === 'vec2' ) {\n\n\t\treturn new three__WEBPACK_IMPORTED_MODULE_0__.Vector2( ...params );\n\n\t} else if ( last4 === 'vec3' ) {\n\n\t\treturn new three__WEBPACK_IMPORTED_MODULE_0__.Vector3( ...params );\n\n\t} else if ( last4 === 'vec4' ) {\n\n\t\treturn new three__WEBPACK_IMPORTED_MODULE_0__.Vector4( ...params );\n\n\t} else if ( last4 === 'mat3' ) {\n\n\t\treturn new three__WEBPACK_IMPORTED_MODULE_0__.Matrix3( ...params );\n\n\t} else if ( last4 === 'mat4' ) {\n\n\t\treturn new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4( ...params );\n\n\t} else if ( type === 'bool' ) {\n\n\t\treturn params[ 0 ] || false;\n\n\t} else if ( ( type === 'float' ) || ( type === 'int' ) || ( type === 'uint' ) ) {\n\n\t\treturn params[ 0 ] || 0;\n\n\t} else if ( type === 'string' ) {\n\n\t\treturn params[ 0 ] || '';\n\n\t} else if ( type === 'ArrayBuffer' ) {\n\n\t\treturn base64ToArrayBuffer( params[ 0 ] );\n\n\t}\n\n\treturn null;\n\n}\n\nfunction arrayBufferToBase64( arrayBuffer ) {\n\n\tlet chars = '';\n\n\tconst array = new Uint8Array( arrayBuffer );\n\n\tfor ( let i = 0; i < array.length; i ++ ) {\n\n\t\tchars += String.fromCharCode( array[ i ] );\n\n\t}\n\n\treturn btoa( chars );\n\n}\n\nfunction base64ToArrayBuffer( base64 ) {\n\n\treturn Uint8Array.from( atob( base64 ), c => c.charCodeAt( 0 ) ).buffer;\n\n}\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeUtils.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeVar.js": +/*!***************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeVar.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nclass NodeVar {\n\n\tconstructor( name, type ) {\n\n\t\tthis.isNodeVar = true;\n\n\t\tthis.name = name;\n\t\tthis.type = type;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeVar);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeVar.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/NodeVarying.js": +/*!*******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/NodeVarying.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeVar_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeVar.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeVar.js\");\n\n\nclass NodeVarying extends _NodeVar_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( name, type ) {\n\n\t\tsuper( name, type );\n\n\t\tthis.needsInterpolation = false;\n\n\t\tthis.isNodeVarying = true;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeVarying);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/NodeVarying.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/OutputStructNode.js": +/*!************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/OutputStructNode.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ outputStruct: () => (/* binding */ outputStruct)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _StructTypeNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./StructTypeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/StructTypeNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass OutputStructNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( ...members ) {\n\n\t\tsuper();\n\n\t\tthis.isOutputStructNode = true;\n\t\tthis.members = members;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tsuper.setup( builder );\n\n\t\tconst members = this.members;\n\t\tconst types = [];\n\n\t\tfor ( let i = 0; i < members.length; i ++ ) {\n\n\t\t\ttypes.push( members[ i ].getNodeType( builder ) );\n\n\t\t}\n\n\t\tthis.nodeType = builder.getStructTypeFromNode( new _StructTypeNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]( types ) ).name;\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst nodeVar = builder.getVarFromNode( this );\n\t\tnodeVar.isOutputStructVar = true;\n\n\t\tconst propertyName = builder.getPropertyName( nodeVar );\n\n\t\tconst members = this.members;\n\n\t\tconst structPrefix = propertyName !== '' ? propertyName + '.' : '';\n\n\t\tfor ( let i = 0; i < members.length; i ++ ) {\n\n\t\t\tconst snippet = members[ i ].build( builder, output );\n\n\t\t\tbuilder.addLineFlowCode( `${ structPrefix }m${ i } = ${ snippet }` );\n\n\t\t}\n\n\t\treturn propertyName;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (OutputStructNode);\n\nconst outputStruct = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OutputStructNode );\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'OutputStructNode', OutputStructNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/OutputStructNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/ParameterNode.js": +/*!*********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/ParameterNode.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ parameter: () => (/* binding */ parameter)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n\n\n\n\nclass ParameterNode extends _PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n\n\tconstructor( nodeType, name = null ) {\n\n\t\tsuper( nodeType, name );\n\n\t\tthis.isParameterNode = true;\n\n\t}\n\n\tgetHash() {\n\n\t\treturn this.uuid;\n\n\t}\n\n\tgenerate() {\n\n\t\treturn this.name;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ParameterNode);\n\nconst parameter = ( type, name ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( new ParameterNode( type, name ) );\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ParameterNode', ParameterNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/ParameterNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/PropertyNode.js": +/*!********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/PropertyNode.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ clearcoat: () => (/* binding */ clearcoat),\n/* harmony export */ clearcoatRoughness: () => (/* binding */ clearcoatRoughness),\n/* harmony export */ dashSize: () => (/* binding */ dashSize),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ diffuseColor: () => (/* binding */ diffuseColor),\n/* harmony export */ gapSize: () => (/* binding */ gapSize),\n/* harmony export */ iridescence: () => (/* binding */ iridescence),\n/* harmony export */ iridescenceIOR: () => (/* binding */ iridescenceIOR),\n/* harmony export */ iridescenceThickness: () => (/* binding */ iridescenceThickness),\n/* harmony export */ metalness: () => (/* binding */ metalness),\n/* harmony export */ output: () => (/* binding */ output),\n/* harmony export */ pointWidth: () => (/* binding */ pointWidth),\n/* harmony export */ property: () => (/* binding */ property),\n/* harmony export */ roughness: () => (/* binding */ roughness),\n/* harmony export */ sheen: () => (/* binding */ sheen),\n/* harmony export */ sheenRoughness: () => (/* binding */ sheenRoughness),\n/* harmony export */ shininess: () => (/* binding */ shininess),\n/* harmony export */ specularColor: () => (/* binding */ specularColor),\n/* harmony export */ varyingProperty: () => (/* binding */ varyingProperty)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nclass PropertyNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( nodeType, name = null, varying = false ) {\n\n\t\tsuper( nodeType );\n\n\t\tthis.name = name;\n\t\tthis.varying = varying;\n\n\t\tthis.isPropertyNode = true;\n\n\t}\n\n\tgetHash( builder ) {\n\n\t\treturn this.name || super.getHash( builder );\n\n\t}\n\n\tisGlobal( /*builder*/ ) {\n\n\t\treturn true;\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tlet nodeVar;\n\n\t\tif ( this.varying === true ) {\n\n\t\t\tnodeVar = builder.getVaryingFromNode( this, this.name );\n\t\t\tnodeVar.needsInterpolation = true;\n\n\t\t} else {\n\n\t\t\tnodeVar = builder.getVarFromNode( this, this.name );\n\n\t\t}\n\n\t\treturn builder.getPropertyName( nodeVar );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PropertyNode);\n\nconst property = ( type, name ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( new PropertyNode( type, name ) );\nconst varyingProperty = ( type, name ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( new PropertyNode( type, name, true ) );\n\nconst diffuseColor = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'vec4', 'DiffuseColor' );\nconst roughness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'float', 'Roughness' );\nconst metalness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'float', 'Metalness' );\nconst clearcoat = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'float', 'Clearcoat' );\nconst clearcoatRoughness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'float', 'ClearcoatRoughness' );\nconst sheen = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'vec3', 'Sheen' );\nconst sheenRoughness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'float', 'SheenRoughness' );\nconst iridescence = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'float', 'Iridescence' );\nconst iridescenceIOR = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'float', 'IridescenceIOR' );\nconst iridescenceThickness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'float', 'IridescenceThickness' );\nconst specularColor = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'color', 'SpecularColor' );\nconst shininess = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'float', 'Shininess' );\nconst output = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'vec4', 'Output' );\nconst dashSize = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'float', 'dashSize' );\nconst gapSize = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'float', 'gapSize' );\nconst pointWidth = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( PropertyNode, 'float', 'pointWidth' );\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'PropertyNode', PropertyNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/PropertyNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/StackNode.js": +/*!*****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/StackNode.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ stack: () => (/* binding */ stack)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _math_CondNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../math/CondNode.js */ \"./node_modules/three/examples/jsm/nodes/math/CondNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass StackNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( parent = null ) {\n\n\t\tsuper();\n\n\t\tthis.nodes = [];\n\t\tthis.outputNode = null;\n\n\t\tthis.parent = parent;\n\n\t\tthis._currentCond = null;\n\n\t\tthis.isStackNode = true;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.outputNode ? this.outputNode.getNodeType( builder ) : 'void';\n\n\t}\n\n\tadd( node ) {\n\n\t\tthis.nodes.push( node );\n\n\t\treturn this;\n\n\t}\n\n\tif( boolNode, method ) {\n\n\t\tconst methodNode = new _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.ShaderNode( method );\n\t\tthis._currentCond = (0,_math_CondNode_js__WEBPACK_IMPORTED_MODULE_1__.cond)( boolNode, methodNode );\n\n\t\treturn this.add( this._currentCond );\n\n\t}\n\n\telseif( boolNode, method ) {\n\n\t\tconst methodNode = new _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.ShaderNode( method );\n\t\tconst ifNode = (0,_math_CondNode_js__WEBPACK_IMPORTED_MODULE_1__.cond)( boolNode, methodNode );\n\n\t\tthis._currentCond.elseNode = ifNode;\n\t\tthis._currentCond = ifNode;\n\n\t\treturn this;\n\n\t}\n\n\telse( method ) {\n\n\t\tthis._currentCond.elseNode = new _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.ShaderNode( method );\n\n\t\treturn this;\n\n\t}\n\n\tbuild( builder, ...params ) {\n\n\t\tconst previousStack = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.getCurrentStack)();\n\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.setCurrentStack)( this );\n\n\t\tfor ( const node of this.nodes ) {\n\n\t\t\tnode.build( builder, 'void' );\n\n\t\t}\n\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.setCurrentStack)( previousStack );\n\n\t\treturn this.outputNode ? this.outputNode.build( builder, ...params ) : super.build( builder, ...params );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StackNode);\n\nconst stack = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( StackNode );\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'StackNode', StackNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/StackNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/StructTypeNode.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/StructTypeNode.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n\n\nclass StructTypeNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( types ) {\n\n\t\tsuper();\n\n\t\tthis.types = types;\n\t\tthis.isStructTypeNode = true;\n\n\t}\n\n\tgetMemberTypes() {\n\n\t\treturn this.types;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StructTypeNode);\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'StructTypeNode', StructTypeNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/StructTypeNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/TempNode.js": +/*!****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/TempNode.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n\n\nclass TempNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( type ) {\n\n\t\tsuper( type );\n\n\t\tthis.isTempNode = true;\n\n\t}\n\n\thasDependencies( builder ) {\n\n\t\treturn builder.getDataFromNode( this ).usageCount > 1;\n\n\t}\n\n\tbuild( builder, output ) {\n\n\t\tconst buildStage = builder.getBuildStage();\n\n\t\tif ( buildStage === 'generate' ) {\n\n\t\t\tconst type = builder.getVectorType( this.getNodeType( builder, output ) );\n\t\t\tconst nodeData = builder.getDataFromNode( this );\n\n\t\t\tif ( builder.context.tempRead !== false && nodeData.propertyName !== undefined ) {\n\n\t\t\t\treturn builder.format( nodeData.propertyName, type, output );\n\n\t\t\t} else if ( builder.context.tempWrite !== false && type !== 'void' && output !== 'void' && this.hasDependencies( builder ) ) {\n\n\t\t\t\tconst snippet = super.build( builder, type );\n\n\t\t\t\tconst nodeVar = builder.getVarFromNode( this, null, type );\n\t\t\t\tconst propertyName = builder.getPropertyName( nodeVar );\n\n\t\t\t\tbuilder.addLineFlowCode( `${propertyName} = ${snippet}` );\n\n\t\t\t\tnodeData.snippet = snippet;\n\t\t\t\tnodeData.propertyName = propertyName;\n\n\t\t\t\treturn builder.format( nodeData.propertyName, type, output );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn super.build( builder, output );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TempNode);\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'TempNode', TempNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/TempNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/UniformGroupNode.js": +/*!************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/UniformGroupNode.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ frameGroup: () => (/* binding */ frameGroup),\n/* harmony export */ objectGroup: () => (/* binding */ objectGroup),\n/* harmony export */ renderGroup: () => (/* binding */ renderGroup),\n/* harmony export */ sharedUniformGroup: () => (/* binding */ sharedUniformGroup),\n/* harmony export */ uniformGroup: () => (/* binding */ uniformGroup)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n\n\n\nclass UniformGroupNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( name, shared = false ) {\n\n\t\tsuper( 'string' );\n\n\t\tthis.name = name;\n\t\tthis.version = 0;\n\n\t\tthis.shared = shared;\n\n\t\tthis.isUniformGroup = true;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n}\n\nconst uniformGroup = ( name ) => new UniformGroupNode( name );\nconst sharedUniformGroup = ( name ) => new UniformGroupNode( name, true );\n\nconst frameGroup = sharedUniformGroup( 'frame' );\nconst renderGroup = sharedUniformGroup( 'render' );\nconst objectGroup = uniformGroup( 'object' );\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (UniformGroupNode);\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'UniformGroupNode', UniformGroupNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/UniformGroupNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/UniformNode.js": +/*!*******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/UniformNode.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ uniform: () => (/* binding */ uniform)\n/* harmony export */ });\n/* harmony import */ var _InputNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./InputNode.js */ \"./node_modules/three/examples/jsm/nodes/core/InputNode.js\");\n/* harmony import */ var _UniformGroupNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./UniformGroupNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformGroupNode.js\");\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\nclass UniformNode extends _InputNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( value, nodeType = null ) {\n\n\t\tsuper( value, nodeType );\n\n\t\tthis.isUniformNode = true;\n\n\t\tthis.groupNode = _UniformGroupNode_js__WEBPACK_IMPORTED_MODULE_1__.objectGroup;\n\n\t}\n\n\tsetGroup( group ) {\n\n\t\tthis.groupNode = group;\n\n\t\treturn this;\n\n\t}\n\n\tgetGroup() {\n\n\t\treturn this.groupNode;\n\n\t}\n\n\tgetUniformHash( builder ) {\n\n\t\treturn this.getHash( builder );\n\n\t}\n\n\tonUpdate( callback, updateType ) {\n\n\t\tconst self = this.getSelf();\n\n\t\tcallback = callback.bind( self );\n\n\t\treturn super.onUpdate( ( frame ) => {\n\n\t\t\tconst value = callback( frame, self );\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\tthis.value = value;\n\n\t\t\t}\n\n\t \t}, updateType );\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst type = this.getNodeType( builder );\n\n\t\tconst hash = this.getUniformHash( builder );\n\n\t\tlet sharedNode = builder.getNodeFromHash( hash );\n\n\t\tif ( sharedNode === undefined ) {\n\n\t\t\tbuilder.setHashNode( this, hash );\n\n\t\t\tsharedNode = this;\n\n\t\t}\n\n\t\tconst sharedNodeType = sharedNode.getInputType( builder );\n\n\t\tconst nodeUniform = builder.getUniformFromNode( sharedNode, sharedNodeType, builder.shaderStage, builder.context.label );\n\t\tconst propertyName = builder.getPropertyName( nodeUniform );\n\n\t\tif ( builder.context.label !== undefined ) delete builder.context.label;\n\n\t\treturn builder.format( propertyName, type, output );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (UniformNode);\n\nconst uniform = ( arg1, arg2 ) => {\n\n\tconst nodeType = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.getConstNodeType)( arg2 || arg1 );\n\n\t// @TODO: get ConstNode from .traverse() in the future\n\tconst value = ( arg1 && arg1.isNode === true ) ? ( arg1.node && arg1.node.value ) || arg1.value : arg1;\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeObject)( new UniformNode( value, nodeType ) );\n\n};\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_2__.addNodeClass)( 'UniformNode', UniformNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/UniformNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/VarNode.js": +/*!***************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/VarNode.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ temp: () => (/* binding */ temp)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nclass VarNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( node, name = null ) {\n\n\t\tsuper();\n\n\t\tthis.node = node;\n\t\tthis.name = name;\n\n\t\tthis.isVarNode = true;\n\n\t}\n\n\tisGlobal() {\n\n\t\treturn true;\n\n\t}\n\n\tgetHash( builder ) {\n\n\t\treturn this.name || super.getHash( builder );\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.node.getNodeType( builder );\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst { node, name } = this;\n\n\t\tconst nodeVar = builder.getVarFromNode( this, name, builder.getVectorType( this.getNodeType( builder ) ) );\n\n\t\tconst propertyName = builder.getPropertyName( nodeVar );\n\n\t\tconst snippet = node.build( builder, nodeVar.type );\n\n\t\tbuilder.addLineFlowCode( `${propertyName} = ${snippet}` );\n\n\t\treturn propertyName;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (VarNode);\n\nconst temp = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( VarNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'temp', temp ); // @TODO: Will be removed in the future\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'toVar', ( ...params ) => temp( ...params ).append() );\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'VarNode', VarNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/VarNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/VaryingNode.js": +/*!*******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/VaryingNode.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ varying: () => (/* binding */ varying)\n/* harmony export */ });\n/* harmony import */ var _Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass VaryingNode extends _Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( node, name = null ) {\n\n\t\tsuper();\n\n\t\tthis.node = node;\n\t\tthis.name = name;\n\n\t\tthis.isVaryingNode = true;\n\n\t}\n\n\tisGlobal() {\n\n\t\treturn true;\n\n\t}\n\n\tgetHash( builder ) {\n\n\t\treturn this.name || super.getHash( builder );\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\t// VaryingNode is auto type\n\n\t\treturn this.node.getNodeType( builder );\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst { name, node } = this;\n\t\tconst type = this.getNodeType( builder );\n\n\t\tconst nodeVarying = builder.getVaryingFromNode( this, name, type );\n\n\t\t// this property can be used to check if the varying can be optimized for a var\n\t\tnodeVarying.needsInterpolation || ( nodeVarying.needsInterpolation = ( builder.shaderStage === 'fragment' ) );\n\n\t\tconst propertyName = builder.getPropertyName( nodeVarying, _constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeShaderStage.VERTEX );\n\n\t\t// force node run in vertex stage\n\t\tbuilder.flowNodeFromShaderStage( _constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeShaderStage.VERTEX, node, type, propertyName );\n\n\t\treturn builder.getPropertyName( nodeVarying );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (VaryingNode);\n\nconst varying = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( VaryingNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'varying', varying );\n\n(0,_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'VaryingNode', VaryingNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/VaryingNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/core/constants.js": +/*!*****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/core/constants.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ NodeShaderStage: () => (/* binding */ NodeShaderStage),\n/* harmony export */ NodeType: () => (/* binding */ NodeType),\n/* harmony export */ NodeUpdateType: () => (/* binding */ NodeUpdateType),\n/* harmony export */ defaultBuildStages: () => (/* binding */ defaultBuildStages),\n/* harmony export */ defaultShaderStages: () => (/* binding */ defaultShaderStages),\n/* harmony export */ shaderStages: () => (/* binding */ shaderStages),\n/* harmony export */ vectorComponents: () => (/* binding */ vectorComponents)\n/* harmony export */ });\nconst NodeShaderStage = {\n\tVERTEX: 'vertex',\n\tFRAGMENT: 'fragment'\n};\n\nconst NodeUpdateType = {\n\tNONE: 'none',\n\tFRAME: 'frame',\n\tRENDER: 'render',\n\tOBJECT: 'object'\n};\n\nconst NodeType = {\n\tBOOLEAN: 'bool',\n\tINTEGER: 'int',\n\tFLOAT: 'float',\n\tVECTOR2: 'vec2',\n\tVECTOR3: 'vec3',\n\tVECTOR4: 'vec4',\n\tMATRIX2: 'mat2',\n\tMATRIX3: 'mat3',\n\tMATRIX4: 'mat4'\n};\n\nconst defaultShaderStages = [ 'fragment', 'vertex' ];\nconst defaultBuildStages = [ 'setup', 'analyze', 'generate' ];\nconst shaderStages = [ ...defaultShaderStages, 'compute' ];\nconst vectorComponents = [ 'x', 'y', 'z', 'w' ];\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/core/constants.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/AfterImageNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/AfterImageNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ afterImage: () => (/* binding */ afterImage),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _PassNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./PassNode.js */ \"./node_modules/three/examples/jsm/nodes/display/PassNode.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _objects_QuadMesh_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../objects/QuadMesh.js */ \"./node_modules/three/examples/jsm/objects/QuadMesh.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst quadMeshComp = new _objects_QuadMesh_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]();\n\nclass AfterImageNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( textureNode, damp = 0.96 ) {\n\n\t\tsuper( textureNode );\n\n\t\tthis.textureNode = textureNode;\n\t\tthis.textureNodeOld = (0,_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_4__.texture)();\n\t\tthis.damp = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_6__.uniform)( damp );\n\n\t\tthis._compRT = new three__WEBPACK_IMPORTED_MODULE_9__.RenderTarget();\n\t\tthis._compRT.texture.name = 'AfterImageNode.comp';\n\n\t\tthis._oldRT = new three__WEBPACK_IMPORTED_MODULE_9__.RenderTarget();\n\t\tthis._oldRT.texture.name = 'AfterImageNode.old';\n\n\t\tthis._textureNode = (0,_PassNode_js__WEBPACK_IMPORTED_MODULE_5__.texturePass)( this, this._compRT.texture );\n\n\t\tthis.updateBeforeType = _core_constants_js__WEBPACK_IMPORTED_MODULE_2__.NodeUpdateType.RENDER;\n\n\t}\n\n\tgetTextureNode() {\n\n\t\treturn this._textureNode;\n\n\t}\n\n\tsetSize( width, height ) {\n\n\t\tthis._compRT.setSize( width, height );\n\t\tthis._oldRT.setSize( width, height );\n\n\t}\n\n\tupdateBefore( frame ) {\n\n\t\tconst { renderer } = frame;\n\n\t\tconst textureNode = this.textureNode;\n\t\tconst map = textureNode.value;\n\n\t\tconst textureType = map.type;\n\n\t\tthis._compRT.texture.type = textureType;\n\t\tthis._oldRT.texture.type = textureType;\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\t\tconst currentTexture = textureNode.value;\n\n\t\tthis.textureNodeOld.value = this._oldRT.texture;\n\n\t\t// comp\n\t\trenderer.setRenderTarget( this._compRT );\n\t\tquadMeshComp.render( renderer );\n\n\t\t// Swap the textures\n\t\tconst temp = this._oldRT;\n\t\tthis._oldRT = this._compRT;\n\t\tthis._compRT = temp;\n\n\t\t// set size before swapping fails\n\t\tthis.setSize( map.image.width, map.image.height );\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\t\ttextureNode.value = currentTexture;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst textureNode = this.textureNode;\n\t\tconst textureNodeOld = this.textureNodeOld;\n\n\t\tif ( textureNode.isTextureNode !== true ) {\n\n\t\t\tconsole.error( 'AfterImageNode requires a TextureNode.' );\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec4)();\n\n\t\t}\n\n\t\t//\n\n\t\tconst uvNode = textureNode.uvNode || (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_3__.uv)();\n\n\t\ttextureNodeOld.uvNode = uvNode;\n\n\t\tconst sampleTexture = ( uv ) => textureNode.cache().context( { getUV: () => uv, forceUVContext: true } );\n\n\t\tconst when_gt = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.tslFn)( ( [ x_immutable, y_immutable ] ) => {\n\n\t\t\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( y_immutable ).toVar();\n\t\t\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec4)( x_immutable ).toVar();\n\n\t\t\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_7__.max)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_7__.sign)( x.sub( y ) ), 0.0 );\n\n\t\t} );\n\n\t\tconst afterImg = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.tslFn)( () => {\n\n\t\t\tconst texelOld = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec4)( textureNodeOld );\n\t\t\tconst texelNew = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec4)( sampleTexture( uvNode ) );\n\n\t\t\ttexelOld.mulAssign( this.damp.mul( when_gt( texelOld, 0.1 ) ) );\n\t\t\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_7__.max)( texelNew, texelOld );\n\n\t\t} );\n\n\t\t//\n\n\t\tconst materialComposed = this._materialComposed || ( this._materialComposed = builder.createNodeMaterial() );\n\t\tmaterialComposed.fragmentNode = afterImg();\n\n\t\tquadMeshComp.material = materialComposed;\n\n\t\t//\n\n\t\tconst properties = builder.getNodeProperties( this );\n\t\tproperties.textureNode = textureNode;\n\n\t\t//\n\n\t\treturn this._textureNode;\n\n\t}\n\n}\n\nconst afterImage = ( node, damp ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( new AfterImageNode( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( node ), damp ) );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'afterImage', afterImage );\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AfterImageNode);\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/AfterImageNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/AnamorphicNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/AnamorphicNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ anamorphic: () => (/* binding */ anamorphic),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/LoopNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/LoopNode.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _ColorAdjustmentNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ColorAdjustmentNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ColorAdjustmentNode.js\");\n/* harmony import */ var _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../accessors/UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _PassNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./PassNode.js */ \"./node_modules/three/examples/jsm/nodes/display/PassNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _objects_QuadMesh_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../objects/QuadMesh.js */ \"./node_modules/three/examples/jsm/objects/QuadMesh.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst quadMesh = new _objects_QuadMesh_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]();\n\nclass AnamorphicNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( textureNode, tresholdNode, scaleNode, samples ) {\n\n\t\tsuper( 'vec4' );\n\n\t\tthis.textureNode = textureNode;\n\t\tthis.tresholdNode = tresholdNode;\n\t\tthis.scaleNode = scaleNode;\n\t\tthis.colorNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec3)( 0.1, 0.0, 1.0 );\n\t\tthis.samples = samples;\n\t\tthis.resolution = new three__WEBPACK_IMPORTED_MODULE_9__.Vector2( 1, 1 );\n\n\t\tthis._renderTarget = new three__WEBPACK_IMPORTED_MODULE_9__.RenderTarget();\n\t\tthis._renderTarget.texture.name = 'anamorphic';\n\n\t\tthis._invSize = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__.uniform)( new three__WEBPACK_IMPORTED_MODULE_9__.Vector2() );\n\n\t\tthis._textureNode = (0,_PassNode_js__WEBPACK_IMPORTED_MODULE_7__.texturePass)( this, this._renderTarget.texture );\n\n\t\tthis.updateBeforeType = _core_constants_js__WEBPACK_IMPORTED_MODULE_4__.NodeUpdateType.RENDER;\n\n\t}\n\n\tgetTextureNode() {\n\n\t\treturn this._textureNode;\n\n\t}\n\n\tsetSize( width, height ) {\n\n\t\tthis._invSize.value.set( 1 / width, 1 / height );\n\n\t\twidth = Math.max( Math.round( width * this.resolution.x ), 1 );\n\t\theight = Math.max( Math.round( height * this.resolution.y ), 1 );\n\n\t\tthis._renderTarget.setSize( width, height );\n\n\t}\n\n\tupdateBefore( frame ) {\n\n\t\tconst { renderer } = frame;\n\n\t\tconst textureNode = this.textureNode;\n\t\tconst map = textureNode.value;\n\n\t\tthis._renderTarget.texture.type = map.type;\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\t\tconst currentTexture = textureNode.value;\n\n\t\tquadMesh.material = this._material;\n\n\t\tthis.setSize( map.image.width, map.image.height );\n\n\t\t// render\n\n\t\trenderer.setRenderTarget( this._renderTarget );\n\n\t\tquadMesh.render( renderer );\n\n\t\t// restore\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\t\ttextureNode.value = currentTexture;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst textureNode = this.textureNode;\n\n\t\tif ( textureNode.isTextureNode !== true ) {\n\n\t\t\tconsole.error( 'AnamorphNode requires a TextureNode.' );\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec4)();\n\n\t\t}\n\n\t\t//\n\n\t\tconst uvNode = textureNode.uvNode || (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_6__.uv)();\n\n\t\tconst sampleTexture = ( uv ) => textureNode.cache().context( { getUV: () => uv, forceUVContext: true } );\n\n\t\tconst anamorph = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.tslFn)( () => {\n\n\t\t\tconst samples = this.samples;\n\t\t\tconst halfSamples = Math.floor( samples / 2 );\n\n\t\t\tconst total = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec3)( 0 ).toVar();\n\n\t\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_2__.loop)( { start: - halfSamples, end: halfSamples }, ( { i } ) => {\n\n\t\t\t\tconst softness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( i ).abs().div( halfSamples ).oneMinus();\n\n\t\t\t\tconst uv = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec2)( uvNode.x.add( this._invSize.x.mul( i ).mul( this.scaleNode ) ), uvNode.y );\n\t\t\t\tconst color = sampleTexture( uv );\n\t\t\t\tconst pass = (0,_ColorAdjustmentNode_js__WEBPACK_IMPORTED_MODULE_5__.threshold)( color, this.tresholdNode ).mul( softness );\n\n\t\t\t\ttotal.addAssign( pass );\n\n\t\t\t} );\n\n\t\t\treturn total.mul( this.colorNode );\n\n\t\t} );\n\n\t\t//\n\n\t\tconst material = this._material || ( this._material = builder.createNodeMaterial() );\n\t\tmaterial.fragmentNode = anamorph();\n\n\t\t//\n\n\t\tconst properties = builder.getNodeProperties( this );\n\t\tproperties.textureNode = textureNode;\n\n\t\t//\n\n\t\treturn this._textureNode;\n\n\t}\n\n}\n\nconst anamorphic = ( node, threshold = .9, scale = 3, samples = 32 ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( new AnamorphicNode( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( node ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( threshold ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( scale ), samples ) );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'anamorphic', anamorphic );\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AnamorphicNode);\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/AnamorphicNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/BlendModeNode.js": +/*!************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/BlendModeNode.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BurnNode: () => (/* binding */ BurnNode),\n/* harmony export */ DodgeNode: () => (/* binding */ DodgeNode),\n/* harmony export */ OverlayNode: () => (/* binding */ OverlayNode),\n/* harmony export */ ScreenNode: () => (/* binding */ ScreenNode),\n/* harmony export */ burn: () => (/* binding */ burn),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ dodge: () => (/* binding */ dodge),\n/* harmony export */ overlay: () => (/* binding */ overlay),\n/* harmony export */ screen: () => (/* binding */ screen)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\nconst BurnNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.tslFn)( ( { base, blend } ) => {\n\n\tconst fn = ( c ) => blend[ c ].lessThan( _math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.EPSILON ).cond( blend[ c ], base[ c ].oneMinus().div( blend[ c ] ).oneMinus().max( 0 ) );\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec3)( fn( 'x' ), fn( 'y' ), fn( 'z' ) );\n\n} ).setLayout( {\n\tname: 'burnColor',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'base', type: 'vec3' },\n\t\t{ name: 'blend', type: 'vec3' }\n\t]\n} );\n\nconst DodgeNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.tslFn)( ( { base, blend } ) => {\n\n\tconst fn = ( c ) => blend[ c ].equal( 1.0 ).cond( blend[ c ], base[ c ].div( blend[ c ].oneMinus() ).max( 0 ) );\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec3)( fn( 'x' ), fn( 'y' ), fn( 'z' ) );\n\n} ).setLayout( {\n\tname: 'dodgeColor',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'base', type: 'vec3' },\n\t\t{ name: 'blend', type: 'vec3' }\n\t]\n} );\n\nconst ScreenNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.tslFn)( ( { base, blend } ) => {\n\n\tconst fn = ( c ) => base[ c ].oneMinus().mul( blend[ c ].oneMinus() ).oneMinus();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec3)( fn( 'x' ), fn( 'y' ), fn( 'z' ) );\n\n} ).setLayout( {\n\tname: 'screenColor',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'base', type: 'vec3' },\n\t\t{ name: 'blend', type: 'vec3' }\n\t]\n} );\n\nconst OverlayNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.tslFn)( ( { base, blend } ) => {\n\n\tconst fn = ( c ) => base[ c ].lessThan( 0.5 ).cond( base[ c ].mul( blend[ c ], 2.0 ), base[ c ].oneMinus().mul( blend[ c ].oneMinus() ).oneMinus() );\n\t//const fn = ( c ) => mix( base[ c ].oneMinus().mul( blend[ c ].oneMinus() ).oneMinus(), base[ c ].mul( blend[ c ], 2.0 ), step( base[ c ], 0.5 ) );\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec3)( fn( 'x' ), fn( 'y' ), fn( 'z' ) );\n\n} ).setLayout( {\n\tname: 'overlayColor',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'base', type: 'vec3' },\n\t\t{ name: 'blend', type: 'vec3' }\n\t]\n} );\n\nclass BlendModeNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( blendMode, baseNode, blendNode ) {\n\n\t\tsuper();\n\n\t\tthis.blendMode = blendMode;\n\n\t\tthis.baseNode = baseNode;\n\t\tthis.blendNode = blendNode;\n\n\t}\n\n\tsetup() {\n\n\t\tconst { blendMode, baseNode, blendNode } = this;\n\t\tconst params = { base: baseNode, blend: blendNode };\n\n\t\tlet outputNode = null;\n\n\t\tif ( blendMode === BlendModeNode.BURN ) {\n\n\t\t\toutputNode = BurnNode( params );\n\n\t\t} else if ( blendMode === BlendModeNode.DODGE ) {\n\n\t\t\toutputNode = DodgeNode( params );\n\n\t\t} else if ( blendMode === BlendModeNode.SCREEN ) {\n\n\t\t\toutputNode = ScreenNode( params );\n\n\t\t} else if ( blendMode === BlendModeNode.OVERLAY ) {\n\n\t\t\toutputNode = OverlayNode( params );\n\n\t\t}\n\n\t\treturn outputNode;\n\n\t}\n\n}\n\nBlendModeNode.BURN = 'burn';\nBlendModeNode.DODGE = 'dodge';\nBlendModeNode.SCREEN = 'screen';\nBlendModeNode.OVERLAY = 'overlay';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BlendModeNode);\n\nconst burn = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( BlendModeNode, BlendModeNode.BURN );\nconst dodge = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( BlendModeNode, BlendModeNode.DODGE );\nconst overlay = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( BlendModeNode, BlendModeNode.OVERLAY );\nconst screen = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( BlendModeNode, BlendModeNode.SCREEN );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'burn', burn );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'dodge', dodge );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'overlay', overlay );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'screen', screen );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_2__.addNodeClass)( 'BlendModeNode', BlendModeNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/BlendModeNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/BumpMapNode.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/BumpMapNode.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bumpMap: () => (/* binding */ bumpMap),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _FrontFacingNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./FrontFacingNode.js */ \"./node_modules/three/examples/jsm/nodes/display/FrontFacingNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\n\n\n// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf\n\n// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\nconst dHdxy_fwd = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.tslFn)( ( { textureNode, bumpScale } ) => {\n\n\tlet texNode = textureNode;\n\n\tif ( texNode.isTextureNode !== true ) {\n\n\t\ttexNode.traverse( ( node ) => {\n\n\t\t\tif ( node.isTextureNode === true ) texNode = node;\n\n\t\t} );\n\n\t}\n\n\tif ( texNode.isTextureNode !== true ) {\n\n\t\tthrow new Error( 'THREE.TSL: dHdxy_fwd() requires a TextureNode.' );\n\n\t}\n\n\tconst Hll = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.float)( textureNode );\n\tconst uvNode = texNode.uvNode || (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_2__.uv)();\n\n\t// It's used to preserve the same TextureNode instance\n\tconst sampleTexture = ( uv ) => textureNode.cache().context( { getUV: () => uv, forceUVContext: true } );\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.vec2)(\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.float)( sampleTexture( uvNode.add( uvNode.dFdx() ) ) ).sub( Hll ),\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.float)( sampleTexture( uvNode.add( uvNode.dFdy() ) ) ).sub( Hll )\n\t).mul( bumpScale );\n\n} );\n\nconst perturbNormalArb = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.tslFn)( ( inputs ) => {\n\n\tconst { surf_pos, surf_norm, dHdxy } = inputs;\n\n\t// normalize is done to ensure that the bump map looks the same regardless of the texture's scale\n\tconst vSigmaX = surf_pos.dFdx().normalize();\n\tconst vSigmaY = surf_pos.dFdy().normalize();\n\tconst vN = surf_norm; // normalized\n\n\tconst R1 = vSigmaY.cross( vN );\n\tconst R2 = vN.cross( vSigmaX );\n\n\tconst fDet = vSigmaX.dot( R1 ).mul( _FrontFacingNode_js__WEBPACK_IMPORTED_MODULE_5__.faceDirection );\n\n\tconst vGrad = fDet.sign().mul( dHdxy.x.mul( R1 ).add( dHdxy.y.mul( R2 ) ) );\n\n\treturn fDet.abs().mul( surf_norm ).sub( vGrad ).normalize();\n\n} );\n\nclass BumpMapNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( textureNode, scaleNode = null ) {\n\n\t\tsuper( 'vec3' );\n\n\t\tthis.textureNode = textureNode;\n\t\tthis.scaleNode = scaleNode;\n\n\t}\n\n\tsetup() {\n\n\t\tconst bumpScale = this.scaleNode !== null ? this.scaleNode : 1;\n\t\tconst dHdxy = dHdxy_fwd( { textureNode: this.textureNode, bumpScale } );\n\n\t\treturn perturbNormalArb( {\n\t\t\tsurf_pos: _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_4__.positionView,\n\t\t\tsurf_norm: _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_3__.normalView,\n\t\t\tdHdxy\n\t\t} );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BumpMapNode);\n\nconst bumpMap = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.nodeProxy)( BumpMapNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.addNodeElement)( 'bumpMap', bumpMap );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'BumpMapNode', BumpMapNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/BumpMapNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/ColorAdjustmentNode.js": +/*!******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/ColorAdjustmentNode.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ hue: () => (/* binding */ hue),\n/* harmony export */ lumaCoeffs: () => (/* binding */ lumaCoeffs),\n/* harmony export */ luminance: () => (/* binding */ luminance),\n/* harmony export */ saturation: () => (/* binding */ saturation),\n/* harmony export */ threshold: () => (/* binding */ threshold),\n/* harmony export */ vibrance: () => (/* binding */ vibrance)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\nconst saturationNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.tslFn)( ( { color, adjustment } ) => {\n\n\treturn adjustment.mix( luminance( color.rgb ), color.rgb );\n\n} );\n\nconst vibranceNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.tslFn)( ( { color, adjustment } ) => {\n\n\tconst average = (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.add)( color.r, color.g, color.b ).div( 3.0 );\n\n\tconst mx = color.r.max( color.g.max( color.b ) );\n\tconst amt = mx.sub( average ).mul( adjustment ).mul( - 3.0 );\n\n\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.mix)( color.rgb, mx, amt );\n\n} );\n\nconst hueNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.tslFn)( ( { color, adjustment } ) => {\n\n\tconst k = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec3)( 0.57735, 0.57735, 0.57735 );\n\n\tconst cosAngle = adjustment.cos();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec3)( color.rgb.mul( cosAngle ).add( k.cross( color.rgb ).mul( adjustment.sin() ).add( k.mul( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.dot)( k, color.rgb ).mul( cosAngle.oneMinus() ) ) ) ) );\n\n} );\n\nclass ColorAdjustmentNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( method, colorNode, adjustmentNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.float)( 1 ) ) {\n\n\t\tsuper( 'vec3' );\n\n\t\tthis.method = method;\n\n\t\tthis.colorNode = colorNode;\n\t\tthis.adjustmentNode = adjustmentNode;\n\n\t}\n\n\tsetup() {\n\n\t\tconst { method, colorNode, adjustmentNode } = this;\n\n\t\tconst callParams = { color: colorNode, adjustment: adjustmentNode };\n\n\t\tlet outputNode = null;\n\n\t\tif ( method === ColorAdjustmentNode.SATURATION ) {\n\n\t\t\toutputNode = saturationNode( callParams );\n\n\t\t} else if ( method === ColorAdjustmentNode.VIBRANCE ) {\n\n\t\t\toutputNode = vibranceNode( callParams );\n\n\t\t} else if ( method === ColorAdjustmentNode.HUE ) {\n\n\t\t\toutputNode = hueNode( callParams );\n\n\t\t} else {\n\n\t\t\tconsole.error( `${ this.type }: Method \"${ this.method }\" not supported!` );\n\n\t\t}\n\n\t\treturn outputNode;\n\n\t}\n\n}\n\nColorAdjustmentNode.SATURATION = 'saturation';\nColorAdjustmentNode.VIBRANCE = 'vibrance';\nColorAdjustmentNode.HUE = 'hue';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ColorAdjustmentNode);\n\nconst saturation = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeProxy)( ColorAdjustmentNode, ColorAdjustmentNode.SATURATION );\nconst vibrance = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeProxy)( ColorAdjustmentNode, ColorAdjustmentNode.VIBRANCE );\nconst hue = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeProxy)( ColorAdjustmentNode, ColorAdjustmentNode.HUE );\n\nconst lumaCoeffs = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec3)( 0.2125, 0.7154, 0.0721 );\nconst luminance = ( color, luma = lumaCoeffs ) => (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.dot)( color, luma );\n\nconst threshold = ( color, threshold ) => (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.mix)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec3)( 0.0 ), color, luminance( color ).sub( threshold ).max( 0 ) );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.addNodeElement)( 'saturation', saturation );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.addNodeElement)( 'vibrance', vibrance );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.addNodeElement)( 'hue', hue );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.addNodeElement)( 'threshold', threshold );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_3__.addNodeClass)( 'ColorAdjustmentNode', ColorAdjustmentNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/ColorAdjustmentNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/ColorSpaceNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/ColorSpaceNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ colorSpaceToLinear: () => (/* binding */ colorSpaceToLinear),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ linearToColorSpace: () => (/* binding */ linearToColorSpace),\n/* harmony export */ linearTosRGB: () => (/* binding */ linearTosRGB),\n/* harmony export */ sRGBToLinear: () => (/* binding */ sRGBToLinear)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\nconst sRGBToLinearShader = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.tslFn)( ( inputs ) => {\n\n\tconst { value } = inputs;\n\tconst { rgb } = value;\n\n\tconst a = rgb.mul( 0.9478672986 ).add( 0.0521327014 ).pow( 2.4 );\n\tconst b = rgb.mul( 0.0773993808 );\n\tconst factor = rgb.lessThanEqual( 0.04045 );\n\n\tconst rgbResult = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.mix)( a, b, factor );\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec4)( rgbResult, value.a );\n\n} );\n\nconst LinearTosRGBShader = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.tslFn)( ( inputs ) => {\n\n\tconst { value } = inputs;\n\tconst { rgb } = value;\n\n\tconst a = rgb.pow( 0.41666 ).mul( 1.055 ).sub( 0.055 );\n\tconst b = rgb.mul( 12.92 );\n\tconst factor = rgb.lessThanEqual( 0.0031308 );\n\n\tconst rgbResult = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.mix)( a, b, factor );\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec4)( rgbResult, value.a );\n\n} );\n\nconst getColorSpaceMethod = ( colorSpace ) => {\n\n\tlet method = null;\n\n\tif ( colorSpace === three__WEBPACK_IMPORTED_MODULE_4__.LinearSRGBColorSpace ) {\n\n\t\tmethod = 'Linear';\n\n\t} else if ( colorSpace === three__WEBPACK_IMPORTED_MODULE_4__.SRGBColorSpace ) {\n\n\t\tmethod = 'sRGB';\n\n\t}\n\n\treturn method;\n\n};\n\nconst getMethod = ( source, target ) => {\n\n\treturn getColorSpaceMethod( source ) + 'To' + getColorSpaceMethod( target );\n\n};\n\nclass ColorSpaceNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( method, node ) {\n\n\t\tsuper( 'vec4' );\n\n\t\tthis.method = method;\n\t\tthis.node = node;\n\n\t}\n\n\tsetup() {\n\n\t\tconst { method, node } = this;\n\n\t\tif ( method === ColorSpaceNode.LINEAR_TO_LINEAR )\n\t\t\treturn node;\n\n\t\treturn Methods[ method ]( { value: node } );\n\n\t}\n\n}\n\nColorSpaceNode.LINEAR_TO_LINEAR = 'LinearToLinear';\nColorSpaceNode.LINEAR_TO_sRGB = 'LinearTosRGB';\nColorSpaceNode.sRGB_TO_LINEAR = 'sRGBToLinear';\n\nconst Methods = {\n\t[ ColorSpaceNode.LINEAR_TO_sRGB ]: LinearTosRGBShader,\n\t[ ColorSpaceNode.sRGB_TO_LINEAR ]: sRGBToLinearShader\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ColorSpaceNode);\n\nconst linearToColorSpace = ( node, colorSpace ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeObject)( new ColorSpaceNode( getMethod( three__WEBPACK_IMPORTED_MODULE_4__.LinearSRGBColorSpace, colorSpace ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeObject)( node ) ) );\nconst colorSpaceToLinear = ( node, colorSpace ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeObject)( new ColorSpaceNode( getMethod( colorSpace, three__WEBPACK_IMPORTED_MODULE_4__.LinearSRGBColorSpace ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeObject)( node ) ) );\n\nconst linearTosRGB = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( ColorSpaceNode, ColorSpaceNode.LINEAR_TO_sRGB );\nconst sRGBToLinear = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( ColorSpaceNode, ColorSpaceNode.sRGB_TO_LINEAR );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'linearTosRGB', linearTosRGB );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'sRGBToLinear', sRGBToLinear );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'linearToColorSpace', linearToColorSpace );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'colorSpaceToLinear', colorSpaceToLinear );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_2__.addNodeClass)( 'ColorSpaceNode', ColorSpaceNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/ColorSpaceNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/FrontFacingNode.js": +/*!**************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/FrontFacingNode.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ faceDirection: () => (/* binding */ faceDirection),\n/* harmony export */ frontFacing: () => (/* binding */ frontFacing)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nclass FrontFacingNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor() {\n\n\t\tsuper( 'bool' );\n\n\t\tthis.isFrontFacingNode = true;\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\treturn builder.getFrontFacing();\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FrontFacingNode);\n\nconst frontFacing = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( FrontFacingNode );\nconst faceDirection = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( frontFacing ).mul( 2.0 ).sub( 1.0 );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'FrontFacingNode', FrontFacingNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/FrontFacingNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/GaussianBlurNode.js": +/*!***************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/GaussianBlurNode.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ gaussianBlur: () => (/* binding */ gaussianBlur)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _PassNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./PassNode.js */ \"./node_modules/three/examples/jsm/nodes/display/PassNode.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _objects_QuadMesh_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../objects/QuadMesh.js */ \"./node_modules/three/examples/jsm/objects/QuadMesh.js\");\n\n\n\n\n\n\n\n\n\n\n// WebGPU: The use of a single QuadMesh for both gaussian blur passes results in a single RenderObject with a SampledTexture binding that\n// alternates between source textures and triggers creation of new BindGroups and BindGroupLayouts every frame.\n\nconst quadMesh1 = new _objects_QuadMesh_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]();\nconst quadMesh2 = new _objects_QuadMesh_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]();\n\nclass GaussianBlurNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( textureNode, sigma = 2 ) {\n\n\t\tsuper( 'vec4' );\n\n\t\tthis.textureNode = textureNode;\n\t\tthis.sigma = sigma;\n\n\t\tthis.directionNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec2)( 1 );\n\n\t\tthis._invSize = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_6__.uniform)( new three__WEBPACK_IMPORTED_MODULE_8__.Vector2() );\n\t\tthis._passDirection = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_6__.uniform)( new three__WEBPACK_IMPORTED_MODULE_8__.Vector2() );\n\n\t\tthis._horizontalRT = new three__WEBPACK_IMPORTED_MODULE_8__.RenderTarget();\n\t\tthis._horizontalRT.texture.name = 'GaussianBlurNode.horizontal';\n\t\tthis._verticalRT = new three__WEBPACK_IMPORTED_MODULE_8__.RenderTarget();\n\t\tthis._verticalRT.texture.name = 'GaussianBlurNode.vertical';\n\n\t\tthis._textureNode = (0,_PassNode_js__WEBPACK_IMPORTED_MODULE_5__.texturePass)( this, this._verticalRT.texture );\n\n\t\tthis.updateBeforeType = _core_constants_js__WEBPACK_IMPORTED_MODULE_2__.NodeUpdateType.RENDER;\n\n\t\tthis.resolution = new three__WEBPACK_IMPORTED_MODULE_8__.Vector2( 1, 1 );\n\n\t}\n\n\tsetSize( width, height ) {\n\n\t\twidth = Math.max( Math.round( width * this.resolution.x ), 1 );\n\t\theight = Math.max( Math.round( height * this.resolution.y ), 1 );\n\n\t\tthis._invSize.value.set( 1 / width, 1 / height );\n\t\tthis._horizontalRT.setSize( width, height );\n\t\tthis._verticalRT.setSize( width, height );\n\n\t}\n\n\tupdateBefore( frame ) {\n\n\t\tconst { renderer } = frame;\n\n\t\tconst textureNode = this.textureNode;\n\t\tconst map = textureNode.value;\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\t\tconst currentTexture = textureNode.value;\n\n\t\tquadMesh1.material = this._material;\n\t\tquadMesh2.material = this._material;\n\n\t\tthis.setSize( map.image.width, map.image.height );\n\n\t\tconst textureType = map.type;\n\n\t\tthis._horizontalRT.texture.type = textureType;\n\t\tthis._verticalRT.texture.type = textureType;\n\n\t\t// horizontal\n\n\t\trenderer.setRenderTarget( this._horizontalRT );\n\n\t\tthis._passDirection.value.set( 1, 0 );\n\n\t\tquadMesh1.render( renderer );\n\n\t\t// vertical\n\n\t\ttextureNode.value = this._horizontalRT.texture;\n\t\trenderer.setRenderTarget( this._verticalRT );\n\n\t\tthis._passDirection.value.set( 0, 1 );\n\n\t\tquadMesh2.render( renderer );\n\n\t\t// restore\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\t\ttextureNode.value = currentTexture;\n\n\t}\n\n\tgetTextureNode() {\n\n\t\treturn this._textureNode;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst textureNode = this.textureNode;\n\n\t\tif ( textureNode.isTextureNode !== true ) {\n\n\t\t\tconsole.error( 'GaussianBlurNode requires a TextureNode.' );\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec4)();\n\n\t\t}\n\n\t\t//\n\n\t\tconst uvNode = textureNode.uvNode || (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)();\n\n\t\tconst sampleTexture = ( uv ) => textureNode.cache().context( { getUV: () => uv, forceUVContext: true } );\n\n\t\tconst blur = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.tslFn)( () => {\n\n\t\t\tconst kernelSize = 3 + ( 2 * this.sigma );\n\t\t\tconst gaussianCoefficients = this._getCoefficients( kernelSize );\n\n\t\t\tconst invSize = this._invSize;\n\t\t\tconst direction = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec2)( this.directionNode ).mul( this._passDirection );\n\n\t\t\tconst weightSum = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( gaussianCoefficients[ 0 ] ).toVar();\n\t\t\tconst diffuseSum = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec4)( sampleTexture( uvNode ).mul( weightSum ) ).toVar();\n\n\t\t\tfor ( let i = 1; i < kernelSize; i ++ ) {\n\n\t\t\t\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( i );\n\t\t\t\tconst w = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( gaussianCoefficients[ i ] );\n\n\t\t\t\tconst uvOffset = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec2)( direction.mul( invSize.mul( x ) ) ).toVar();\n\n\t\t\t\tconst sample1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec4)( sampleTexture( uvNode.add( uvOffset ) ) );\n\t\t\t\tconst sample2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec4)( sampleTexture( uvNode.sub( uvOffset ) ) );\n\n\t\t\t\tdiffuseSum.addAssign( sample1.add( sample2 ).mul( w ) );\n\t\t\t\tweightSum.addAssign( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_3__.mul)( 2.0, w ) );\n\n\t\t\t}\n\n\t\t\treturn diffuseSum.div( weightSum );\n\n\t\t} );\n\n\t\t//\n\n\t\tconst material = this._material || ( this._material = builder.createNodeMaterial() );\n\t\tmaterial.fragmentNode = blur();\n\n\t\t//\n\n\t\tconst properties = builder.getNodeProperties( this );\n\t\tproperties.textureNode = textureNode;\n\n\t\t//\n\n\t\treturn this._textureNode;\n\n\t}\n\n\t_getCoefficients( kernelRadius ) {\n\n\t\tconst coefficients = [];\n\n\t\tfor ( let i = 0; i < kernelRadius; i ++ ) {\n\n\t\t\tcoefficients.push( 0.39894 * Math.exp( - 0.5 * i * i / ( kernelRadius * kernelRadius ) ) / kernelRadius );\n\n\t\t}\n\n\t\treturn coefficients;\n\n\t}\n\n}\n\nconst gaussianBlur = ( node, sigma ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( new GaussianBlurNode( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( node ), sigma ) );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'gaussianBlur', gaussianBlur );\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (GaussianBlurNode);\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/GaussianBlurNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/NormalMapNode.js": +/*!************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/NormalMapNode.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ normalMap: () => (/* binding */ normalMap)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/ModelNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ModelNode.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _accessors_AccessorsUtils_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../accessors/AccessorsUtils.js */ \"./node_modules/three/examples/jsm/nodes/accessors/AccessorsUtils.js\");\n/* harmony import */ var _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../accessors/UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _FrontFacingNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./FrontFacingNode.js */ \"./node_modules/three/examples/jsm/nodes/display/FrontFacingNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// Normal Mapping Without Precomputed Tangents\n// http://www.thetenthplanet.de/archives/1180\n\nconst perturbNormal2Arb = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__.tslFn)( ( inputs ) => {\n\n\tconst { eye_pos, surf_norm, mapN, uv } = inputs;\n\n\tconst q0 = eye_pos.dFdx();\n\tconst q1 = eye_pos.dFdy();\n\tconst st0 = uv.dFdx();\n\tconst st1 = uv.dFdy();\n\n\tconst N = surf_norm; // normalized\n\n\tconst q1perp = q1.cross( N );\n\tconst q0perp = N.cross( q0 );\n\n\tconst T = q1perp.mul( st0.x ).add( q0perp.mul( st1.x ) );\n\tconst B = q1perp.mul( st0.y ).add( q0perp.mul( st1.y ) );\n\n\tconst det = T.dot( T ).max( B.dot( B ) );\n\tconst scale = _FrontFacingNode_js__WEBPACK_IMPORTED_MODULE_7__.faceDirection.mul( det.inverseSqrt() );\n\n\treturn (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.add)( T.mul( mapN.x, scale ), B.mul( mapN.y, scale ), N.mul( mapN.z ) ).normalize();\n\n} );\n\nclass NormalMapNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( node, scaleNode = null ) {\n\n\t\tsuper( 'vec3' );\n\n\t\tthis.node = node;\n\t\tthis.scaleNode = scaleNode;\n\n\t\tthis.normalMapType = three__WEBPACK_IMPORTED_MODULE_10__.TangentSpaceNormalMap;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst { normalMapType, scaleNode } = this;\n\n\t\tlet normalMap = this.node.mul( 2.0 ).sub( 1.0 );\n\n\t\tif ( scaleNode !== null ) {\n\n\t\t\tnormalMap = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__.vec3)( normalMap.xy.mul( scaleNode ), normalMap.z );\n\n\t\t}\n\n\t\tlet outputNode = null;\n\n\t\tif ( normalMapType === three__WEBPACK_IMPORTED_MODULE_10__.ObjectSpaceNormalMap ) {\n\n\t\t\toutputNode = _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_2__.modelNormalMatrix.mul( normalMap ).normalize();\n\n\t\t} else if ( normalMapType === three__WEBPACK_IMPORTED_MODULE_10__.TangentSpaceNormalMap ) {\n\n\t\t\tconst tangent = builder.hasGeometryAttribute( 'tangent' );\n\n\t\t\tif ( tangent === true ) {\n\n\t\t\t\toutputNode = _accessors_AccessorsUtils_js__WEBPACK_IMPORTED_MODULE_5__.TBNViewMatrix.mul( normalMap ).normalize();\n\n\t\t\t} else {\n\n\t\t\t\toutputNode = perturbNormal2Arb( {\n\t\t\t\t\teye_pos: _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_4__.positionView,\n\t\t\t\t\tsurf_norm: _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_3__.normalView,\n\t\t\t\t\tmapN: normalMap,\n\t\t\t\t\tuv: (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_6__.uv)()\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn outputNode;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NormalMapNode);\n\nconst normalMap = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__.nodeProxy)( NormalMapNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__.addNodeElement)( 'normalMap', normalMap );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_8__.addNodeClass)( 'NormalMapNode', NormalMapNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/NormalMapNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/PassNode.js": +/*!*******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/PassNode.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ depthPass: () => (/* binding */ depthPass),\n/* harmony export */ pass: () => (/* binding */ pass),\n/* harmony export */ texturePass: () => (/* binding */ texturePass)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ViewportDepthNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportDepthNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\nclass PassTextureNode extends _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n\n\tconstructor( passNode, texture ) {\n\n\t\tsuper( texture );\n\n\t\tthis.passNode = passNode;\n\n\t\tthis.setUpdateMatrix( false );\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tthis.passNode.build( builder );\n\n\t\treturn super.setup( builder );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.passNode, this.value );\n\n\t}\n\n}\n\nclass PassNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n\n\tconstructor( scope, scene, camera ) {\n\n\t\tsuper( 'vec4' );\n\n\t\tthis.scope = scope;\n\t\tthis.scene = scene;\n\t\tthis.camera = camera;\n\n\t\tthis._pixelRatio = 1;\n\t\tthis._width = 1;\n\t\tthis._height = 1;\n\n\t\tconst depthTexture = new three__WEBPACK_IMPORTED_MODULE_7__.DepthTexture();\n\t\tdepthTexture.isRenderTargetTexture = true;\n\t\t//depthTexture.type = FloatType;\n\t\tdepthTexture.name = 'PostProcessingDepth';\n\n\t\tconst renderTarget = new three__WEBPACK_IMPORTED_MODULE_7__.RenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio, { type: three__WEBPACK_IMPORTED_MODULE_7__.HalfFloatType } );\n\t\trenderTarget.texture.name = 'PostProcessing';\n\t\trenderTarget.depthTexture = depthTexture;\n\n\t\tthis.renderTarget = renderTarget;\n\n\t\tthis.updateBeforeType = _core_constants_js__WEBPACK_IMPORTED_MODULE_3__.NodeUpdateType.FRAME;\n\n\t\tthis._textureNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeObject)( new PassTextureNode( this, renderTarget.texture ) );\n\t\tthis._depthTextureNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeObject)( new PassTextureNode( this, depthTexture ) );\n\n\t\tthis._depthNode = null;\n\t\tthis._viewZNode = null;\n\t\tthis._cameraNear = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_5__.uniform)( 0 );\n\t\tthis._cameraFar = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_5__.uniform)( 0 );\n\n\t\tthis.isPassNode = true;\n\n\t}\n\n\tisGlobal() {\n\n\t\treturn true;\n\n\t}\n\n\tgetTextureNode() {\n\n\t\treturn this._textureNode;\n\n\t}\n\n\tgetTextureDepthNode() {\n\n\t\treturn this._depthTextureNode;\n\n\t}\n\n\tgetViewZNode() {\n\n\t\tif ( this._viewZNode === null ) {\n\n\t\t\tconst cameraNear = this._cameraNear;\n\t\t\tconst cameraFar = this._cameraFar;\n\n\t\t\tthis._viewZNode = (0,_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_6__.perspectiveDepthToViewZ)( this._depthTextureNode, cameraNear, cameraFar );\n\n\t\t}\n\n\t\treturn this._viewZNode;\n\n\t}\n\n\tgetDepthNode() {\n\n\t\tif ( this._depthNode === null ) {\n\n\t\t\tconst cameraNear = this._cameraNear;\n\t\t\tconst cameraFar = this._cameraFar;\n\n\t\t\tthis._depthNode = (0,_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_6__.viewZToOrthographicDepth)( this.getViewZNode(), cameraNear, cameraFar );\n\n\t\t}\n\n\t\treturn this._depthNode;\n\n\t}\n\n\tsetup() {\n\n\t\treturn this.scope === PassNode.COLOR ? this.getTextureNode() : this.getDepthNode();\n\n\t}\n\n\tupdateBefore( frame ) {\n\n\t\tconst { renderer } = frame;\n\t\tconst { scene, camera } = this;\n\n\t\tthis._pixelRatio = renderer.getPixelRatio();\n\n\t\tconst size = renderer.getSize( new three__WEBPACK_IMPORTED_MODULE_7__.Vector2() );\n\n\t\tthis.setSize( size.width, size.height );\n\n\t\tconst currentToneMapping = renderer.toneMapping;\n\t\tconst currentToneMappingNode = renderer.toneMappingNode;\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tthis._cameraNear.value = camera.near;\n\t\tthis._cameraFar.value = camera.far;\n\n\t\trenderer.toneMapping = three__WEBPACK_IMPORTED_MODULE_7__.NoToneMapping;\n\t\trenderer.toneMappingNode = null;\n\t\trenderer.setRenderTarget( this.renderTarget );\n\n\t\trenderer.render( scene, camera );\n\n\t\trenderer.toneMapping = currentToneMapping;\n\t\trenderer.toneMappingNode = currentToneMappingNode;\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t}\n\n\tsetSize( width, height ) {\n\n\t\tthis._width = width;\n\t\tthis._height = height;\n\n\t\tconst effectiveWidth = this._width * this._pixelRatio;\n\t\tconst effectiveHeight = this._height * this._pixelRatio;\n\n\t\tthis.renderTarget.setSize( effectiveWidth, effectiveHeight );\n\n\t}\n\n\tsetPixelRatio( pixelRatio ) {\n\n\t\tthis._pixelRatio = pixelRatio;\n\n\t\tthis.setSize( this._width, this._height );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.renderTarget.dispose();\n\n\t}\n\n\n}\n\nPassNode.COLOR = 'color';\nPassNode.DEPTH = 'depth';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PassNode);\n\nconst pass = ( scene, camera ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeObject)( new PassNode( PassNode.COLOR, scene, camera ) );\nconst texturePass = ( pass, texture ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeObject)( new PassTextureNode( pass, texture ) );\nconst depthPass = ( scene, camera ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeObject)( new PassNode( PassNode.DEPTH, scene, camera ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'PassNode', PassNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/PassNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/PosterizeNode.js": +/*!************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/PosterizeNode.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ posterize: () => (/* binding */ posterize)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass PosterizeNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( sourceNode, stepsNode ) {\n\n\t\tsuper();\n\n\t\tthis.sourceNode = sourceNode;\n\t\tthis.stepsNode = stepsNode;\n\n\t}\n\n\tsetup() {\n\n\t\tconst { sourceNode, stepsNode } = this;\n\n\t\treturn sourceNode.mul( stepsNode ).floor().div( stepsNode );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PosterizeNode);\n\nconst posterize = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( PosterizeNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'posterize', posterize );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'PosterizeNode', PosterizeNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/PosterizeNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/ToneMappingNode.js": +/*!**************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/ToneMappingNode.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ toneMapping: () => (/* binding */ toneMapping),\n/* harmony export */ toneMappingExposure: () => (/* binding */ toneMappingExposure)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _accessors_RendererReferenceNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/RendererReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/RendererReferenceNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\n// exposure only\nconst LinearToneMappingNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.tslFn)( ( { color, exposure } ) => {\n\n\treturn color.mul( exposure ).clamp();\n\n} );\n\n// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf\nconst ReinhardToneMappingNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.tslFn)( ( { color, exposure } ) => {\n\n\tcolor = color.mul( exposure );\n\n\treturn color.div( color.add( 1.0 ) ).clamp();\n\n} );\n\n// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/\nconst OptimizedCineonToneMappingNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.tslFn)( ( { color, exposure } ) => {\n\n\t// optimized filmic operator by Jim Hejl and Richard Burgess-Dawson\n\tcolor = color.mul( exposure );\n\tcolor = color.sub( 0.004 ).max( 0.0 );\n\n\tconst a = color.mul( color.mul( 6.2 ).add( 0.5 ) );\n\tconst b = color.mul( color.mul( 6.2 ).add( 1.7 ) ).add( 0.06 );\n\n\treturn a.div( b ).pow( 2.2 );\n\n} );\n\n// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs\nconst RRTAndODTFit = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.tslFn)( ( { color } ) => {\n\n\tconst a = color.mul( color.add( 0.0245786 ) ).sub( 0.000090537 );\n\tconst b = color.mul( color.add( 0.4329510 ).mul( 0.983729 ) ).add( 0.238081 );\n\n\treturn a.div( b );\n\n} );\n\n// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs\nconst ACESFilmicToneMappingNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.tslFn)( ( { color, exposure } ) => {\n\n\t// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n\tconst ACESInputMat = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.mat3)(\n\t\t0.59719, 0.35458, 0.04823,\n\t\t0.07600, 0.90834, 0.01566,\n\t\t0.02840, 0.13383, 0.83777\n\t);\n\n\t// ODT_SAT => XYZ => D60_2_D65 => sRGB\n\tconst ACESOutputMat = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.mat3)(\n\t\t1.60475, - 0.53108, - 0.07367,\n\t\t- 0.10208, 1.10813, - 0.00605,\n\t\t- 0.00327, - 0.07276, 1.07602\n\t);\n\n\tcolor = color.mul( exposure ).div( 0.6 );\n\n\tcolor = ACESInputMat.mul( color );\n\n\t// Apply RRT and ODT\n\tcolor = RRTAndODTFit( { color } );\n\n\tcolor = ACESOutputMat.mul( color );\n\n\t// Clamp to [0, 1]\n\treturn color.clamp();\n\n} );\n\n\n\nconst LINEAR_REC2020_TO_LINEAR_SRGB = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.mat3)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( 1.6605, - 0.1246, - 0.0182 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( - 0.5876, 1.1329, - 0.1006 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( - 0.0728, - 0.0083, 1.1187 ) );\nconst LINEAR_SRGB_TO_LINEAR_REC2020 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.mat3)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( 0.6274, 0.0691, 0.0164 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( 0.3293, 0.9195, 0.0880 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( 0.0433, 0.0113, 0.8956 ) );\n\nconst agxDefaultContrastApprox = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.tslFn)( ( [ x_immutable ] ) => {\n\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( x_immutable ).toVar();\n\tconst x2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( x.mul( x ) ).toVar();\n\tconst x4 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( x2.mul( x2 ) ).toVar();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.float)( 15.5 ).mul( x4.mul( x2 ) ).sub( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_5__.mul)( 40.14, x4.mul( x ) ) ).add( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_5__.mul)( 31.96, x4 ).sub( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_5__.mul)( 6.868, x2.mul( x ) ) ).add( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_5__.mul)( 0.4298, x2 ).add( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_5__.mul)( 0.1191, x ).sub( 0.00232 ) ) ) );\n\n} );\n\nconst AGXToneMappingNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.tslFn)( ( { color, exposure } ) => {\n\n\tconst colortone = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( color ).toVar();\n\tconst AgXInsetMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.mat3)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) );\n\tconst AgXOutsetMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.mat3)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) );\n\tconst AgxMinEv = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.float)( - 12.47393 );\n\tconst AgxMaxEv = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.float)( 4.026069 );\n\tcolortone.mulAssign( exposure );\n\tcolortone.assign( LINEAR_SRGB_TO_LINEAR_REC2020.mul( colortone ) );\n\tcolortone.assign( AgXInsetMatrix.mul( colortone ) );\n\tcolortone.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__.max)( colortone, 1e-10 ) );\n\tcolortone.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__.log2)( colortone ) );\n\tcolortone.assign( colortone.sub( AgxMinEv ).div( AgxMaxEv.sub( AgxMinEv ) ) );\n\tcolortone.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__.clamp)( colortone, 0.0, 1.0 ) );\n\tcolortone.assign( agxDefaultContrastApprox( colortone ) );\n\tcolortone.assign( AgXOutsetMatrix.mul( colortone ) );\n\tcolortone.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__.pow)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__.max)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( 0.0 ), colortone ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( 2.2 ) ) );\n\tcolortone.assign( LINEAR_REC2020_TO_LINEAR_SRGB.mul( colortone ) );\n\tcolortone.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_4__.clamp)( colortone, 0.0, 1.0 ) );\n\n\treturn colortone;\n\n} );\n\n\nconst toneMappingLib = {\n\t[ three__WEBPACK_IMPORTED_MODULE_6__.LinearToneMapping ]: LinearToneMappingNode,\n\t[ three__WEBPACK_IMPORTED_MODULE_6__.ReinhardToneMapping ]: ReinhardToneMappingNode,\n\t[ three__WEBPACK_IMPORTED_MODULE_6__.CineonToneMapping ]: OptimizedCineonToneMappingNode,\n\t[ three__WEBPACK_IMPORTED_MODULE_6__.ACESFilmicToneMapping ]: ACESFilmicToneMappingNode,\n\t[ three__WEBPACK_IMPORTED_MODULE_6__.AgXToneMapping ]: AGXToneMappingNode\n};\n\nclass ToneMappingNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( toneMapping = three__WEBPACK_IMPORTED_MODULE_6__.NoToneMapping, exposureNode = toneMappingExposure, colorNode = null ) {\n\n\t\tsuper( 'vec3' );\n\n\t\tthis.toneMapping = toneMapping;\n\n\t\tthis.exposureNode = exposureNode;\n\t\tthis.colorNode = colorNode;\n\n\t}\n\n\tgetCacheKey() {\n\n\t\tlet cacheKey = super.getCacheKey();\n\t\tcacheKey = '{toneMapping:' + this.toneMapping + ',nodes:' + cacheKey + '}';\n\n\t\treturn cacheKey;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst colorNode = this.colorNode || builder.context.color;\n\t\tconst toneMapping = this.toneMapping;\n\n\t\tif ( toneMapping === three__WEBPACK_IMPORTED_MODULE_6__.NoToneMapping ) return colorNode;\n\n\t\tconst toneMappingParams = { exposure: this.exposureNode, color: colorNode };\n\t\tconst toneMappingNode = toneMappingLib[ toneMapping ];\n\n\t\tlet outputNode = null;\n\n\t\tif ( toneMappingNode ) {\n\n\t\t\toutputNode = toneMappingNode( toneMappingParams );\n\n\t\t} else {\n\n\t\t\tconsole.error( 'ToneMappingNode: Unsupported Tone Mapping configuration.', toneMapping );\n\n\t\t\toutputNode = colorNode;\n\n\t\t}\n\n\t\treturn outputNode;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ToneMappingNode);\n\nconst toneMapping = ( mapping, exposure, color ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new ToneMappingNode( mapping, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( exposure ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( color ) ) );\nconst toneMappingExposure = (0,_accessors_RendererReferenceNode_js__WEBPACK_IMPORTED_MODULE_3__.rendererReference)( 'toneMappingExposure', 'float' );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'toneMapping', ( color, mapping, exposure ) => toneMapping( mapping, exposure, color ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'ToneMappingNode', ToneMappingNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/ToneMappingNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/ViewportDepthNode.js": +/*!****************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/ViewportDepthNode.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ depth: () => (/* binding */ depth),\n/* harmony export */ depthPixel: () => (/* binding */ depthPixel),\n/* harmony export */ depthTexture: () => (/* binding */ depthTexture),\n/* harmony export */ orthographicDepthToViewZ: () => (/* binding */ orthographicDepthToViewZ),\n/* harmony export */ perspectiveDepthToViewZ: () => (/* binding */ perspectiveDepthToViewZ),\n/* harmony export */ viewZToOrthographicDepth: () => (/* binding */ viewZToOrthographicDepth),\n/* harmony export */ viewZToPerspectiveDepth: () => (/* binding */ viewZToPerspectiveDepth)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _ViewportDepthTextureNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ViewportDepthTextureNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportDepthTextureNode.js\");\n\n\n\n\n\n\nclass ViewportDepthNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope, valueNode = null ) {\n\n\t\tsuper( 'float' );\n\n\t\tthis.scope = scope;\n\t\tthis.valueNode = valueNode;\n\n\t\tthis.isViewportDepthNode = true;\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst { scope } = this;\n\n\t\tif ( scope === ViewportDepthNode.DEPTH_PIXEL ) {\n\n\t\t\treturn builder.getFragDepth();\n\n\t\t}\n\n\t\treturn super.generate( builder );\n\n\t}\n\n\tsetup( /*builder*/ ) {\n\n\t\tconst { scope } = this;\n\n\t\tlet node = null;\n\n\t\tif ( scope === ViewportDepthNode.DEPTH ) {\n\n\t\t\tnode = viewZToOrthographicDepth( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_3__.positionView.z, _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_2__.cameraNear, _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_2__.cameraFar );\n\n\t\t} else if ( scope === ViewportDepthNode.DEPTH_TEXTURE ) {\n\n\t\t\tconst texture = this.valueNode || (0,_ViewportDepthTextureNode_js__WEBPACK_IMPORTED_MODULE_4__.viewportDepthTexture)();\n\n\t\t\tconst viewZ = perspectiveDepthToViewZ( texture, _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_2__.cameraNear, _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_2__.cameraFar );\n\t\t\tnode = viewZToOrthographicDepth( viewZ, _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_2__.cameraNear, _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_2__.cameraFar );\n\n\t\t} else if ( scope === ViewportDepthNode.DEPTH_PIXEL ) {\n\n\t\t\tif ( this.valueNode !== null ) {\n\n \t\t\t\tnode = depthPixelBase().assign( this.valueNode );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn node;\n\n\t}\n\n}\n\n// NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera\n\n// -near maps to 0; -far maps to 1\nconst viewZToOrthographicDepth = ( viewZ, near, far ) => viewZ.add( near ).div( near.sub( far ) );\n\n// maps orthographic depth in [ 0, 1 ] to viewZ\nconst orthographicDepthToViewZ = ( depth, near, far ) => near.sub( far ).mul( depth ).sub( near );\n\n// NOTE: https://twitter.com/gonnavis/status/1377183786949959682\n\n// -near maps to 0; -far maps to 1\nconst viewZToPerspectiveDepth = ( viewZ, near, far ) => near.add( viewZ ).mul( far ).div( near.sub( far ).mul( viewZ ) );\n\n// maps perspective depth in [ 0, 1 ] to viewZ\nconst perspectiveDepthToViewZ = ( depth, near, far ) => near.mul( far ).div( far.sub( near ).mul( depth ).sub( far ) );\n\nViewportDepthNode.DEPTH = 'depth';\nViewportDepthNode.DEPTH_TEXTURE = 'depthTexture';\nViewportDepthNode.DEPTH_PIXEL = 'depthPixel';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ViewportDepthNode);\n\nconst depthPixelBase = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( ViewportDepthNode, ViewportDepthNode.DEPTH_PIXEL );\n\nconst depth = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( ViewportDepthNode, ViewportDepthNode.DEPTH );\nconst depthTexture = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( ViewportDepthNode, ViewportDepthNode.DEPTH_TEXTURE );\nconst depthPixel = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeImmutable)( ViewportDepthNode, ViewportDepthNode.DEPTH_PIXEL );\n\ndepthPixel.assign = ( value ) => depthPixelBase( value );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ViewportDepthNode', ViewportDepthNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/ViewportDepthNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/ViewportDepthTextureNode.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/ViewportDepthTextureNode.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ viewportDepthTexture: () => (/* binding */ viewportDepthTexture)\n/* harmony export */ });\n/* harmony import */ var _ViewportTextureNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ViewportTextureNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportTextureNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _ViewportNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ViewportNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\nlet sharedDepthbuffer = null;\n\nclass ViewportDepthTextureNode extends _ViewportTextureNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( uvNode = _ViewportNode_js__WEBPACK_IMPORTED_MODULE_3__.viewportTopLeft, levelNode = null ) {\n\n\t\tif ( sharedDepthbuffer === null ) {\n\n\t\t\tsharedDepthbuffer = new three__WEBPACK_IMPORTED_MODULE_4__.DepthTexture();\n\n\t\t}\n\n\t\tsuper( uvNode, levelNode, sharedDepthbuffer );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ViewportDepthTextureNode);\n\nconst viewportDepthTexture = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( ViewportDepthTextureNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'viewportDepthTexture', viewportDepthTexture );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'ViewportDepthTextureNode', ViewportDepthTextureNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/ViewportDepthTextureNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/ViewportNode.js": +/*!***********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/ViewportNode.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ viewport: () => (/* binding */ viewport),\n/* harmony export */ viewportBottomLeft: () => (/* binding */ viewportBottomLeft),\n/* harmony export */ viewportBottomRight: () => (/* binding */ viewportBottomRight),\n/* harmony export */ viewportCoordinate: () => (/* binding */ viewportCoordinate),\n/* harmony export */ viewportResolution: () => (/* binding */ viewportResolution),\n/* harmony export */ viewportTopLeft: () => (/* binding */ viewportTopLeft),\n/* harmony export */ viewportTopRight: () => (/* binding */ viewportTopRight)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\nlet resolution, viewportResult;\n\nclass ViewportNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope ) {\n\n\t\tsuper();\n\n\t\tthis.scope = scope;\n\n\t\tthis.isViewportNode = true;\n\n\t}\n\n\tgetNodeType() {\n\n\t\treturn this.scope === ViewportNode.VIEWPORT ? 'vec4' : 'vec2';\n\n\t}\n\n\tgetUpdateType() {\n\n\t\tlet updateType = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeUpdateType.NONE;\n\n\t\tif ( this.scope === ViewportNode.RESOLUTION || this.scope === ViewportNode.VIEWPORT ) {\n\n\t\t\tupdateType = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeUpdateType.FRAME;\n\n\t\t}\n\n\t\tthis.updateType = updateType;\n\n\t\treturn updateType;\n\n\t}\n\n\tupdate( { renderer } ) {\n\n\t\tif ( this.scope === ViewportNode.VIEWPORT ) {\n\n\t\t\trenderer.getViewport( viewportResult );\n\n\t\t} else {\n\n\t\t\trenderer.getDrawingBufferSize( resolution );\n\n\t\t}\n\n\t}\n\n\tsetup( /*builder*/ ) {\n\n\t\tconst scope = this.scope;\n\n\t\tlet output = null;\n\n\t\tif ( scope === ViewportNode.RESOLUTION ) {\n\n\t\t\toutput = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_2__.uniform)( resolution || ( resolution = new three__WEBPACK_IMPORTED_MODULE_4__.Vector2() ) );\n\n\t\t} else if ( scope === ViewportNode.VIEWPORT ) {\n\n\t\t\toutput = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_2__.uniform)( viewportResult || ( viewportResult = new three__WEBPACK_IMPORTED_MODULE_4__.Vector4() ) );\n\n\t\t} else {\n\n\t\t\toutput = viewportCoordinate.div( viewportResolution );\n\n\t\t\tlet outX = output.x;\n\t\t\tlet outY = output.y;\n\n\t\t\tif ( /bottom/i.test( scope ) ) outY = outY.oneMinus();\n\t\t\tif ( /right/i.test( scope ) ) outX = outX.oneMinus();\n\n\t\t\toutput = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec2)( outX, outY );\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tif ( this.scope === ViewportNode.COORDINATE ) {\n\n\t\t\tlet coord = builder.getFragCoord();\n\n\t\t\tif ( builder.isFlipY() ) {\n\n\t\t\t\t// follow webgpu standards\n\n\t\t\t\tconst resolution = builder.getNodeProperties( viewportResolution ).outputNode.build( builder );\n\n\t\t\t\tcoord = `${ builder.getType( 'vec2' ) }( ${ coord }.x, ${ resolution }.y - ${ coord }.y )`;\n\n\t\t\t}\n\n\t\t\treturn coord;\n\n\t\t}\n\n\t\treturn super.generate( builder );\n\n\t}\n\n}\n\nViewportNode.COORDINATE = 'coordinate';\nViewportNode.RESOLUTION = 'resolution';\nViewportNode.VIEWPORT = 'viewport';\nViewportNode.TOP_LEFT = 'topLeft';\nViewportNode.BOTTOM_LEFT = 'bottomLeft';\nViewportNode.TOP_RIGHT = 'topRight';\nViewportNode.BOTTOM_RIGHT = 'bottomRight';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ViewportNode);\n\nconst viewportCoordinate = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( ViewportNode, ViewportNode.COORDINATE );\nconst viewportResolution = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( ViewportNode, ViewportNode.RESOLUTION );\nconst viewport = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( ViewportNode, ViewportNode.VIEWPORT );\nconst viewportTopLeft = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( ViewportNode, ViewportNode.TOP_LEFT );\nconst viewportBottomLeft = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( ViewportNode, ViewportNode.BOTTOM_LEFT );\nconst viewportTopRight = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( ViewportNode, ViewportNode.TOP_RIGHT );\nconst viewportBottomRight = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( ViewportNode, ViewportNode.BOTTOM_RIGHT );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ViewportNode', ViewportNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/ViewportNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/ViewportSharedTextureNode.js": +/*!************************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/ViewportSharedTextureNode.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ viewportSharedTexture: () => (/* binding */ viewportSharedTexture)\n/* harmony export */ });\n/* harmony import */ var _ViewportTextureNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ViewportTextureNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportTextureNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _ViewportNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ViewportNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\nlet _sharedFramebuffer = null;\n\nclass ViewportSharedTextureNode extends _ViewportTextureNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( uvNode = _ViewportNode_js__WEBPACK_IMPORTED_MODULE_3__.viewportTopLeft, levelNode = null ) {\n\n\t\tif ( _sharedFramebuffer === null ) {\n\n\t\t\t_sharedFramebuffer = new three__WEBPACK_IMPORTED_MODULE_4__.FramebufferTexture();\n\n\t\t}\n\n\t\tsuper( uvNode, levelNode, _sharedFramebuffer );\n\n\t}\n\n\tupdateReference() {\n\n\t\treturn this;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ViewportSharedTextureNode);\n\nconst viewportSharedTexture = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( ViewportSharedTextureNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'viewportSharedTexture', viewportSharedTexture );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'ViewportSharedTextureNode', ViewportSharedTextureNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/ViewportSharedTextureNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/display/ViewportTextureNode.js": +/*!******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/display/ViewportTextureNode.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ viewportMipTexture: () => (/* binding */ viewportMipTexture),\n/* harmony export */ viewportTexture: () => (/* binding */ viewportTexture)\n/* harmony export */ });\n/* harmony import */ var _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../accessors/TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _ViewportNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ViewportNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\nconst _size = new three__WEBPACK_IMPORTED_MODULE_5__.Vector2();\n\nclass ViewportTextureNode extends _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( uvNode = _ViewportNode_js__WEBPACK_IMPORTED_MODULE_4__.viewportTopLeft, levelNode = null, framebufferTexture = null ) {\n\n\t\tif ( framebufferTexture === null ) {\n\n\t\t\tframebufferTexture = new three__WEBPACK_IMPORTED_MODULE_5__.FramebufferTexture();\n\t\t\tframebufferTexture.minFilter = three__WEBPACK_IMPORTED_MODULE_5__.LinearMipmapLinearFilter;\n\n\t\t}\n\n\t\tsuper( framebufferTexture, uvNode, levelNode );\n\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.isOutputTextureNode = true;\n\n\t\tthis.updateBeforeType = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeUpdateType.FRAME;\n\n\t}\n\n\tupdateBefore( frame ) {\n\n\t\tconst renderer = frame.renderer;\n\t\trenderer.getDrawingBufferSize( _size );\n\n\t\t//\n\n\t\tconst framebufferTexture = this.value;\n\n\t\tif ( framebufferTexture.image.width !== _size.width || framebufferTexture.image.height !== _size.height ) {\n\n\t\t\tframebufferTexture.image.width = _size.width;\n\t\t\tframebufferTexture.image.height = _size.height;\n\t\t\tframebufferTexture.needsUpdate = true;\n\n\t\t}\n\n\t\t//\n\n\t\tconst currentGenerateMipmaps = framebufferTexture.generateMipmaps;\n\t\tframebufferTexture.generateMipmaps = this.generateMipmaps;\n\n\t\trenderer.copyFramebufferToTexture( framebufferTexture );\n\n\t\tframebufferTexture.generateMipmaps = currentGenerateMipmaps;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.uvNode, this.levelNode, this.value );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ViewportTextureNode);\n\nconst viewportTexture = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( ViewportTextureNode );\nconst viewportMipTexture = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( ViewportTextureNode, null, null, { generateMipmaps: true } );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'viewportTexture', viewportTexture );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'viewportMipTexture', viewportMipTexture );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_2__.addNodeClass)( 'ViewportTextureNode', ViewportTextureNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/display/ViewportTextureNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/fog/FogExp2Node.js": +/*!******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/fog/FogExp2Node.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ densityFog: () => (/* binding */ densityFog)\n/* harmony export */ });\n/* harmony import */ var _FogNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FogNode.js */ \"./node_modules/three/examples/jsm/nodes/fog/FogNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass FogExp2Node extends _FogNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( colorNode, densityNode ) {\n\n\t\tsuper( colorNode );\n\n\t\tthis.isFogExp2Node = true;\n\n\t\tthis.densityNode = densityNode;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst viewZ = this.getViewZNode( builder );\n\t\tconst density = this.densityNode;\n\n\t\treturn density.mul( density, viewZ, viewZ ).negate().exp().oneMinus();\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FogExp2Node);\n\nconst densityFog = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( FogExp2Node );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'densityFog', densityFog );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'FogExp2Node', FogExp2Node );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/fog/FogExp2Node.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/fog/FogNode.js": +/*!**************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/fog/FogNode.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ fog: () => (/* binding */ fog)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass FogNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( colorNode, factorNode ) {\n\n\t\tsuper( 'float' );\n\n\t\tthis.isFogNode = true;\n\n\t\tthis.colorNode = colorNode;\n\t\tthis.factorNode = factorNode;\n\n\t}\n\n\tgetViewZNode( builder ) {\n\n\t\tlet viewZ;\n\n\t\tconst getViewZ = builder.context.getViewZ;\n\n\t\tif ( getViewZ !== undefined ) {\n\n\t\t\tviewZ = getViewZ( this );\n\n\t\t}\n\n\t\treturn ( viewZ || _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_1__.positionView.z ).negate();\n\n\t}\n\n\tsetup() {\n\n\t\treturn this.factorNode;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FogNode);\n\nconst fog = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( FogNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'fog', fog );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'FogNode', FogNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/fog/FogNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/fog/FogRangeNode.js": +/*!*******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/fog/FogRangeNode.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ rangeFog: () => (/* binding */ rangeFog)\n/* harmony export */ });\n/* harmony import */ var _FogNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FogNode.js */ \"./node_modules/three/examples/jsm/nodes/fog/FogNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\nclass FogRangeNode extends _FogNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( colorNode, nearNode, farNode ) {\n\n\t\tsuper( colorNode );\n\n\t\tthis.isFogRangeNode = true;\n\n\t\tthis.nearNode = nearNode;\n\t\tthis.farNode = farNode;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst viewZ = this.getViewZNode( builder );\n\n\t\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.smoothstep)( this.nearNode, this.farNode, viewZ );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FogRangeNode);\n\nconst rangeFog = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( FogRangeNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'rangeFog', rangeFog );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_2__.addNodeClass)( 'FogRangeNode', FogRangeNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/fog/FogRangeNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js": +/*!**************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _F_Schlick_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./F_Schlick.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/F_Schlick.js\");\n/* harmony import */ var _V_GGX_SmithCorrelated_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./V_GGX_SmithCorrelated.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js\");\n/* harmony import */ var _D_GGX_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./D_GGX.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/D_GGX.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\n\n\n// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\nconst BRDF_GGX = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.tslFn)( ( inputs ) => {\n\n\tconst { lightDirection, f0, f90, roughness, iridescenceFresnel } = inputs;\n\n\tconst normalView = inputs.normalView || _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_3__.transformedNormalView;\n\n\tconst alpha = roughness.pow2(); // UE4's roughness\n\n\tconst halfDir = lightDirection.add( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_4__.positionViewDirection ).normalize();\n\n\tconst dotNL = normalView.dot( lightDirection ).clamp();\n\tconst dotNV = normalView.dot( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_4__.positionViewDirection ).clamp(); // @ TODO: Move to core dotNV\n\tconst dotNH = normalView.dot( halfDir ).clamp();\n\tconst dotVH = _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_4__.positionViewDirection.dot( halfDir ).clamp();\n\n\tlet F = (0,_F_Schlick_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])( { f0, f90, dotVH } );\n\n\tif ( iridescenceFresnel ) {\n\n\t\tF = _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_5__.iridescence.mix( F, iridescenceFresnel );\n\n\t}\n\n\tconst V = (0,_V_GGX_SmithCorrelated_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])( { alpha, dotNL, dotNV } );\n\tconst D = (0,_D_GGX_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])( { alpha, dotNH } );\n\n\treturn F.mul( V ).mul( D );\n\n} ); // validated\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BRDF_GGX);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js": +/*!******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\nconst BRDF_Lambert = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( inputs ) => {\n\n\treturn inputs.diffuseColor.mul( 1 / Math.PI ); // punctual light\n\n} ); // validated\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BRDF_Lambert);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js": +/*!****************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nconst D_Charlie = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.tslFn)( ( { roughness, dotNH } ) => {\n\n\tconst alpha = roughness.pow2();\n\n\t// Estevez and Kulla 2017, \"Production Friendly Microfacet Sheen BRDF\"\n\tconst invAlpha = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.float)( 1.0 ).div( alpha );\n\tconst cos2h = dotNH.pow2();\n\tconst sin2h = cos2h.oneMinus().max( 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.float)( 2.0 ).add( invAlpha ).mul( sin2h.pow( invAlpha.mul( 0.5 ) ) ).div( 2.0 * Math.PI );\n\n} ).setLayout( {\n\tname: 'D_Charlie',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'roughness', type: 'float' },\n\t\t{ name: 'dotNH', type: 'float' }\n\t]\n} );\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nconst V_Neubelt = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.tslFn)( ( { dotNV, dotNL } ) => {\n\n\t// Neubelt and Pettineo 2013, \"Crafting a Next-gen Material Pipeline for The Order: 1886\"\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.float)( 1.0 ).div( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.float)( 4.0 ).mul( dotNL.add( dotNV ).sub( dotNL.mul( dotNV ) ) ) );\n\n} ).setLayout( {\n\tname: 'V_Neubelt',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'dotNV', type: 'float' },\n\t\t{ name: 'dotNL', type: 'float' }\n\t]\n} );\n\nconst BRDF_Sheen = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.tslFn)( ( { lightDirection } ) => {\n\n\tconst halfDir = lightDirection.add( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_1__.positionViewDirection ).normalize();\n\n\tconst dotNL = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_0__.transformedNormalView.dot( lightDirection ).clamp();\n\tconst dotNV = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_0__.transformedNormalView.dot( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_1__.positionViewDirection ).clamp();\n\tconst dotNH = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_0__.transformedNormalView.dot( halfDir ).clamp();\n\n\tconst D = D_Charlie( { roughness: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.sheenRoughness, dotNH } );\n\tconst V = V_Neubelt( { dotNV, dotNL } );\n\n\treturn _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.sheen.mul( D ).mul( V );\n\n} );\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BRDF_Sheen);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/BSDF/DFGApprox.js": +/*!***************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/BSDF/DFGApprox.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via 'environmentBRDF' from \"Physically Based Shading on Mobile\"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nconst DFGApprox = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( { roughness, dotNV } ) => {\n\n\tconst c0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec4)( - 1, - 0.0275, - 0.572, 0.022 );\n\n\tconst c1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec4)( 1, 0.0425, 1.04, - 0.04 );\n\n\tconst r = roughness.mul( c0 ).add( c1 );\n\n\tconst a004 = r.x.mul( r.x ).min( dotNV.mul( - 9.28 ).exp2() ).mul( r.x ).add( r.y );\n\n\tconst fab = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( - 1.04, 1.04 ).mul( a004 ).add( r.zw );\n\n\treturn fab;\n\n} ).setLayout( {\n\tname: 'DFGApprox',\n\ttype: 'vec2',\n\tinputs: [\n\t\t{ name: 'roughness', type: 'float' },\n\t\t{ name: 'dotNV', type: 'vec3' }\n\t]\n} );\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DFGApprox);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/BSDF/DFGApprox.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/BSDF/D_GGX.js": +/*!***********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/BSDF/D_GGX.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney’s reparameterization\nconst D_GGX = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( { alpha, dotNH } ) => {\n\n\tconst a2 = alpha.pow2();\n\n\tconst denom = dotNH.pow2().mul( a2.oneMinus() ).oneMinus(); // avoid alpha = 0 with dotNH = 1\n\n\treturn a2.div( denom.pow2() ).mul( 1 / Math.PI );\n\n} ).setLayout( {\n\tname: 'D_GGX',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'alpha', type: 'float' },\n\t\t{ name: 'dotNH', type: 'float' }\n\t]\n} ); // validated\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (D_GGX);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/BSDF/D_GGX.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _DFGApprox_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DFGApprox.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/DFGApprox.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nconst EnvironmentBRDF = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.tslFn)( ( inputs ) => {\n\n\tconst { dotNV, specularColor, specularF90, roughness } = inputs;\n\n\tconst fab = (0,_DFGApprox_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])( { dotNV, roughness } );\n\treturn specularColor.mul( fab.x ).add( specularF90.mul( fab.y ) );\n\n} );\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EnvironmentBRDF);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/BSDF/F_Schlick.js": +/*!***************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/BSDF/F_Schlick.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\nconst F_Schlick = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( { f0, f90, dotVH } ) => {\n\n\t// Original approximation by Christophe Schlick '94\n\t// float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tconst fresnel = dotVH.mul( - 5.55473 ).sub( 6.98316 ).mul( dotVH ).exp2();\n\n\treturn f0.mul( fresnel.oneMinus() ).add( f90.mul( fresnel ) );\n\n} ); // validated\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (F_Schlick);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/BSDF/F_Schlick.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\nconst Schlick_to_F0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( { f, f90, dotVH } ) => {\n\n\tconst x = dotVH.oneMinus().saturate();\n\tconst x2 = x.mul( x );\n\tconst x5 = x.mul( x2, x2 ).clamp( 0, .9999 );\n\n\treturn f.sub( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( f90 ).mul( x5 ) ).div( x5.oneMinus() );\n\n} ).setLayout( {\n\tname: 'Schlick_to_F0',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'f', type: 'vec3' },\n\t\t{ name: 'f90', type: 'float' },\n\t\t{ name: 'dotVH', type: 'float' }\n\t]\n} );\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Schlick_to_F0);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js": +/*!***************************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js ***! + \***************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nconst V_GGX_SmithCorrelated = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.tslFn)( ( inputs ) => {\n\n\tconst { alpha, dotNL, dotNV } = inputs;\n\n\tconst a2 = alpha.pow2();\n\n\tconst gv = dotNL.mul( a2.add( a2.oneMinus().mul( dotNV.pow2() ) ).sqrt() );\n\tconst gl = dotNV.mul( a2.add( a2.oneMinus().mul( dotNL.pow2() ) ).sqrt() );\n\n\treturn (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_0__.div)( 0.5, gv.add( gl ).max( _math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.EPSILON ) );\n\n} ).setLayout( {\n\tname: 'V_GGX_SmithCorrelated',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'alpha', type: 'float' },\n\t\t{ name: 'dotNL', type: 'float' },\n\t\t{ name: 'dotNV', type: 'float' }\n\t]\n} ); // validated\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (V_GGX_SmithCorrelated);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/PhongLightingModel.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/PhongLightingModel.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_LightingModel_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/LightingModel.js */ \"./node_modules/three/examples/jsm/nodes/core/LightingModel.js\");\n/* harmony import */ var _BSDF_F_Schlick_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BSDF/F_Schlick.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/F_Schlick.js\");\n/* harmony import */ var _BSDF_BRDF_Lambert_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BSDF/BRDF_Lambert.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../accessors/MaterialNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\n\n\n\n\nconst G_BlinnPhong_Implicit = () => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.float)( 0.25 );\n\nconst D_BlinnPhong = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.tslFn)( ( { dotNH } ) => {\n\n\treturn _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.shininess.mul( 0.5 / Math.PI ).add( 1.0 ).mul( dotNH.pow( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.shininess ) );\n\n} );\n\nconst BRDF_BlinnPhong = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.tslFn)( ( { lightDirection } ) => {\n\n\tconst halfDir = lightDirection.add( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_6__.positionViewDirection ).normalize();\n\n\tconst dotNH = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_4__.transformedNormalView.dot( halfDir ).clamp();\n\tconst dotVH = _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_6__.positionViewDirection.dot( halfDir ).clamp();\n\n\tconst F = (0,_BSDF_F_Schlick_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])( { f0: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.specularColor, f90: 1.0, dotVH } );\n\tconst G = G_BlinnPhong_Implicit();\n\tconst D = D_BlinnPhong( { dotNH } );\n\n\treturn F.mul( G ).mul( D );\n\n} );\n\nclass PhongLightingModel extends _core_LightingModel_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( specular = true ) {\n\n\t\tsuper();\n\n\t\tthis.specular = specular;\n\n\t}\n\n\tdirect( { lightDirection, lightColor, reflectedLight } ) {\n\n\t\tconst dotNL = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_4__.transformedNormalView.dot( lightDirection ).clamp();\n\t\tconst irradiance = dotNL.mul( lightColor );\n\n\t\treflectedLight.directDiffuse.addAssign( irradiance.mul( (0,_BSDF_BRDF_Lambert_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])( { diffuseColor: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.diffuseColor.rgb } ) ) );\n\n\t\tif ( this.specular === true ) {\n\n\t\t\treflectedLight.directSpecular.addAssign( irradiance.mul( BRDF_BlinnPhong( { lightDirection } ) ).mul( _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_5__.materialSpecularStrength ) );\n\n\t\t}\n\n\t}\n\n\tindirectDiffuse( { irradiance, reflectedLight } ) {\n\n\t\treflectedLight.indirectDiffuse.addAssign( irradiance.mul( (0,_BSDF_BRDF_Lambert_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])( { diffuseColor: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.diffuseColor } ) ) );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PhongLightingModel);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/PhongLightingModel.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/PhysicalLightingModel.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/PhysicalLightingModel.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _BSDF_BRDF_Lambert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BSDF/BRDF_Lambert.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js\");\n/* harmony import */ var _BSDF_BRDF_GGX_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BSDF/BRDF_GGX.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js\");\n/* harmony import */ var _BSDF_DFGApprox_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BSDF/DFGApprox.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/DFGApprox.js\");\n/* harmony import */ var _BSDF_EnvironmentBRDF_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./BSDF/EnvironmentBRDF.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js\");\n/* harmony import */ var _BSDF_F_Schlick_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./BSDF/F_Schlick.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/F_Schlick.js\");\n/* harmony import */ var _BSDF_Schlick_to_F0_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BSDF/Schlick_to_F0.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js\");\n/* harmony import */ var _BSDF_BRDF_Sheen_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BSDF/BRDF_Sheen.js */ \"./node_modules/three/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js\");\n/* harmony import */ var _core_LightingModel_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../core/LightingModel.js */ \"./node_modules/three/examples/jsm/nodes/core/LightingModel.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _math_CondNode_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../math/CondNode.js */ \"./node_modules/three/examples/jsm/nodes/math/CondNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//\n// Iridescence\n//\n\n// XYZ to linear-sRGB color space\nconst XYZ_TO_REC709 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.mat3)(\n\t3.2404542, - 0.9692660, 0.0556434,\n\t- 1.5371385, 1.8760108, - 0.2040259,\n\t- 0.4985314, 0.0415560, 1.0572252\n);\n\n// Assume air interface for top\n// Note: We don't handle the case fresnel0 == 1\nconst Fresnel0ToIor = ( fresnel0 ) => {\n\n\tconst sqrtF0 = fresnel0.sqrt();\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)( 1.0 ).add( sqrtF0 ).div( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)( 1.0 ).sub( sqrtF0 ) );\n\n};\n\n// ior is a value between 1.0 and 3.0. 1.0 is air interface\nconst IorToFresnel0 = ( transmittedIor, incidentIor ) => {\n\n\treturn transmittedIor.sub( incidentIor ).div( transmittedIor.add( incidentIor ) ).pow2();\n\n};\n\n// Fresnel equations for dielectric/dielectric interfaces.\n// Ref: https://belcour.github.io/blog/research/2017/05/01/brdf-thin-film.html\n// Evaluation XYZ sensitivity curves in Fourier space\nconst evalSensitivity = ( OPD, shift ) => {\n\n\tconst phase = OPD.mul( 2.0 * Math.PI * 1.0e-9 );\n\tconst val = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\tconst pos = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\tconst VAR = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( 9.7470e-14 * Math.sqrt( 2.0 * Math.PI * 4.5282e+09 ) ).mul( phase.mul( 2.2399e+06 ).add( shift.x ).cos() ).mul( phase.pow2().mul( - 4.5282e+09 ).exp() );\n\n\tlet xyz = val.mul( VAR.mul( 2.0 * Math.PI ).sqrt() ).mul( pos.mul( phase ).add( shift ).cos() ).mul( phase.pow2().negate().mul( VAR ).exp() );\n\txyz = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)( xyz.x.add( x ), xyz.y, xyz.z ).div( 1.0685e-7 );\n\n\tconst rgb = XYZ_TO_REC709.mul( xyz );\n\n\treturn rgb;\n\n};\n\nconst evalIridescence = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.tslFn)( ( { outsideIOR, eta2, cosTheta1, thinFilmThickness, baseF0 } ) => {\n\n\t// Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0\n\tconst iridescenceIOR = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_13__.mix)( outsideIOR, eta2, (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_13__.smoothstep)( 0.0, 0.03, thinFilmThickness ) );\n\t// Evaluate the cosTheta on the base layer (Snell law)\n\tconst sinTheta2Sq = outsideIOR.div( iridescenceIOR ).pow2().mul( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( 1 ).sub( cosTheta1.pow2() ) );\n\n\t// Handle TIR:\n\tconst cosTheta2Sq = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( 1 ).sub( sinTheta2Sq );\n\t/*if ( cosTheta2Sq < 0.0 ) {\n\n\t\t\treturn vec3( 1.0 );\n\n\t}*/\n\n\tconst cosTheta2 = cosTheta2Sq.sqrt();\n\n\t// First interface\n\tconst R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\tconst R12 = (0,_BSDF_F_Schlick_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"])( { f0: R0, f90: 1.0, dotVH: cosTheta1 } );\n\t//const R21 = R12;\n\tconst T121 = R12.oneMinus();\n\tconst phi12 = iridescenceIOR.lessThan( outsideIOR ).cond( Math.PI, 0.0 );\n\tconst phi21 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( Math.PI ).sub( phi12 );\n\n\t// Second interface\n\tconst baseIOR = Fresnel0ToIor( baseF0.clamp( 0.0, 0.9999 ) ); // guard against 1.0\n\tconst R1 = IorToFresnel0( baseIOR, iridescenceIOR.vec3() );\n\tconst R23 = (0,_BSDF_F_Schlick_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"])( { f0: R1, f90: 1.0, dotVH: cosTheta2 } );\n\tconst phi23 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)(\n\t\tbaseIOR.x.lessThan( iridescenceIOR ).cond( Math.PI, 0.0 ),\n\t\tbaseIOR.y.lessThan( iridescenceIOR ).cond( Math.PI, 0.0 ),\n\t\tbaseIOR.z.lessThan( iridescenceIOR ).cond( Math.PI, 0.0 )\n\t);\n\n\t// Phase shift\n\tconst OPD = iridescenceIOR.mul( thinFilmThickness, cosTheta2, 2.0 );\n\tconst phi = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)( phi21 ).add( phi23 );\n\n\t// Compound terms\n\tconst R123 = R12.mul( R23 ).clamp( 1e-5, 0.9999 );\n\tconst r123 = R123.sqrt();\n\tconst Rs = T121.pow2().mul( R23 ).div( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)( 1.0 ).sub( R123 ) );\n\n\t// Reflectance term for m = 0 (DC term amplitude)\n\tconst C0 = R12.add( Rs );\n\tlet I = C0;\n\n\t// Reflectance term for m > 0 (pairs of diracs)\n\tlet Cm = Rs.sub( T121 );\n\tfor ( let m = 1; m <= 2; ++ m ) {\n\n\t\tCm = Cm.mul( r123 );\n\t\tconst Sm = evalSensitivity( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( m ).mul( OPD ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( m ).mul( phi ) ).mul( 2.0 );\n\t\tI = I.add( Cm.mul( Sm ) );\n\n\t}\n\n\t// Since out of gamut colors might be produced, negative color values are clamped to 0.\n\treturn I.max( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)( 0.0 ) );\n\n} ).setLayout( {\n\tname: 'evalIridescence',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'outsideIOR', type: 'float' },\n\t\t{ name: 'eta2', type: 'float' },\n\t\t{ name: 'cosTheta1', type: 'float' },\n\t\t{ name: 'thinFilmThickness', type: 'float' },\n\t\t{ name: 'baseF0', type: 'vec3' }\n\t]\n} );\n\n//\n//\tSheen\n//\n\n// This is a curve-fit approxmation to the \"Charlie sheen\" BRDF integrated over the hemisphere from\n// Estevez and Kulla 2017, \"Production Friendly Microfacet Sheen BRDF\". The analysis can be found\n// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\nconst IBLSheenBRDF = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.tslFn)( ( { normal, viewDir, roughness } ) => {\n\n\tconst dotNV = normal.dot( viewDir ).saturate();\n\n\tconst r2 = roughness.pow2();\n\n\tconst a = (0,_math_CondNode_js__WEBPACK_IMPORTED_MODULE_12__.cond)(\n\t\troughness.lessThan( 0.25 ),\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( - 339.2 ).mul( r2 ).add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( 161.4 ).mul( roughness ) ).sub( 25.9 ),\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( - 8.48 ).mul( r2 ).add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( 14.3 ).mul( roughness ) ).sub( 9.95 )\n\t);\n\n\tconst b = (0,_math_CondNode_js__WEBPACK_IMPORTED_MODULE_12__.cond)(\n\t\troughness.lessThan( 0.25 ),\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( 44.0 ).mul( r2 ).sub( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( 23.7 ).mul( roughness ) ).add( 3.26 ),\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( 1.97 ).mul( r2 ).sub( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( 3.27 ).mul( roughness ) ).add( 0.72 )\n\t);\n\n\tconst DG = (0,_math_CondNode_js__WEBPACK_IMPORTED_MODULE_12__.cond)( roughness.lessThan( 0.25 ), 0.0, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( 0.1 ).mul( roughness ).sub( 0.025 ) ).add( a.mul( dotNV ).add( b ).exp() );\n\n\treturn DG.mul( 1.0 / Math.PI ).saturate();\n\n} );\n\nconst clearcoatF0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)( 0.04 );\nconst clearcoatF90 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)( 1 );\n\n//\n\nclass PhysicalLightingModel extends _core_LightingModel_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"] {\n\n\tconstructor( clearcoat = false, sheen = false, iridescence = false ) {\n\n\t\tsuper();\n\n\t\tthis.clearcoat = clearcoat;\n\t\tthis.sheen = sheen;\n\t\tthis.iridescence = iridescence;\n\n\t\tthis.clearcoatRadiance = null;\n\t\tthis.clearcoatSpecularDirect = null;\n\t\tthis.clearcoatSpecularIndirect = null;\n\t\tthis.sheenSpecularDirect = null;\n\t\tthis.sheenSpecularIndirect = null;\n\t\tthis.iridescenceFresnel = null;\n\t\tthis.iridescenceF0 = null;\n\n\t}\n\n\tstart( /*context*/ ) {\n\n\t\tif ( this.clearcoat === true ) {\n\n\t\t\tthis.clearcoatRadiance = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)().temp( 'clearcoatRadiance' );\n\t\t\tthis.clearcoatSpecularDirect = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)().temp( 'clearcoatSpecularDirect' );\n\t\t\tthis.clearcoatSpecularIndirect = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)().temp( 'clearcoatSpecularIndirect' );\n\n\t\t}\n\n\t\tif ( this.sheen === true ) {\n\n\t\t\tthis.sheenSpecularDirect = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)().temp( 'sheenSpecularDirect' );\n\t\t\tthis.sheenSpecularIndirect = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)().temp( 'sheenSpecularIndirect' );\n\n\t\t}\n\n\t\tif ( this.iridescence === true ) {\n\n\t\t\tconst dotNVi = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_9__.transformedNormalView.dot( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_10__.positionViewDirection ).clamp();\n\n\t\t\tthis.iridescenceFresnel = evalIridescence( {\n\t\t\t\toutsideIOR: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( 1.0 ),\n\t\t\t\teta2: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.iridescenceIOR,\n\t\t\t\tcosTheta1: dotNVi,\n\t\t\t\tthinFilmThickness: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.iridescenceThickness,\n\t\t\t\tbaseF0: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.specularColor\n\t\t\t} );\n\n\t\t\tthis.iridescenceF0 = (0,_BSDF_Schlick_to_F0_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"])( { f: this.iridescenceFresnel, f90: 1.0, dotVH: dotNVi } );\n\n\t\t}\n\n\t}\n\n\t// Fdez-Agüera's \"Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting\"\n\t// Approximates multiscattering in order to preserve energy.\n\t// http://www.jcgt.org/published/0008/01/03/\n\n\tcomputeMultiscattering( singleScatter, multiScatter, specularF90 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.float)( 1 ) ) {\n\n\t\tconst dotNV = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_9__.transformedNormalView.dot( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_10__.positionViewDirection ).clamp(); // @ TODO: Move to core dotNV\n\n\t\tconst fab = (0,_BSDF_DFGApprox_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])( { roughness: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.roughness, dotNV } );\n\n\t\tconst Fr = this.iridescenceF0 ? _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.iridescence.mix( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.specularColor, this.iridescenceF0 ) : _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.specularColor;\n\n\t\tconst FssEss = Fr.mul( fab.x ).add( specularF90.mul( fab.y ) );\n\n\t\tconst Ess = fab.x.add( fab.y );\n\t\tconst Ems = Ess.oneMinus();\n\n\t\tconst Favg = _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.specularColor.add( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.specularColor.oneMinus().mul( 0.047619 ) ); // 1/21\n\t\tconst Fms = FssEss.mul( Favg ).div( Ems.mul( Favg ).oneMinus() );\n\n\t\tsingleScatter.addAssign( FssEss );\n\t\tmultiScatter.addAssign( Fms.mul( Ems ) );\n\n\t}\n\n\tdirect( { lightDirection, lightColor, reflectedLight } ) {\n\n\t\tconst dotNL = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_9__.transformedNormalView.dot( lightDirection ).clamp();\n\t\tconst irradiance = dotNL.mul( lightColor );\n\n\t\tif ( this.sheen === true ) {\n\n\t\t\tthis.sheenSpecularDirect.addAssign( irradiance.mul( (0,_BSDF_BRDF_Sheen_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"])( { lightDirection } ) ) );\n\n\t\t}\n\n\t\tif ( this.clearcoat === true ) {\n\n\t\t\tconst dotNLcc = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_9__.transformedClearcoatNormalView.dot( lightDirection ).clamp();\n\t\t\tconst ccIrradiance = dotNLcc.mul( lightColor );\n\n\t\t\tthis.clearcoatSpecularDirect.addAssign( ccIrradiance.mul( (0,_BSDF_BRDF_GGX_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])( { lightDirection, f0: clearcoatF0, f90: clearcoatF90, roughness: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.clearcoatRoughness, normalView: _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_9__.transformedClearcoatNormalView } ) ) );\n\n\t\t}\n\n\t\treflectedLight.directDiffuse.addAssign( irradiance.mul( (0,_BSDF_BRDF_Lambert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])( { diffuseColor: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.diffuseColor.rgb } ) ) );\n\n\t\treflectedLight.directSpecular.addAssign( irradiance.mul( (0,_BSDF_BRDF_GGX_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])( { lightDirection, f0: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.specularColor, f90: 1, roughness: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.roughness, iridescence: this.iridescence, iridescenceFresnel: this.iridescenceFresnel } ) ) );\n\n\t}\n\n\tindirectDiffuse( { irradiance, reflectedLight } ) {\n\n\t\treflectedLight.indirectDiffuse.addAssign( irradiance.mul( (0,_BSDF_BRDF_Lambert_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])( { diffuseColor: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.diffuseColor } ) ) );\n\n\t}\n\n\tindirectSpecular( { radiance, iblIrradiance, reflectedLight } ) {\n\n\t\tif ( this.sheen === true ) {\n\n\t\t\tthis.sheenSpecularIndirect.addAssign( iblIrradiance.mul(\n\t\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.sheen,\n\t\t\t\tIBLSheenBRDF( {\n\t\t\t\t\tnormal: _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_9__.transformedNormalView,\n\t\t\t\t\tviewDir: _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_10__.positionViewDirection,\n\t\t\t\t\troughness: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.sheenRoughness\n\t\t\t\t} )\n\t\t\t) );\n\n\t\t}\n\n\t\tif ( this.clearcoat === true ) {\n\n\t\t\tconst dotNVcc = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_9__.transformedClearcoatNormalView.dot( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_10__.positionViewDirection ).clamp();\n\n\t\t\tconst clearcoatEnv = (0,_BSDF_EnvironmentBRDF_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"])( {\n\t\t\t\tdotNV: dotNVcc,\n\t\t\t\tspecularColor: clearcoatF0,\n\t\t\t\tspecularF90: clearcoatF90,\n\t\t\t\troughness: _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.clearcoatRoughness\n\t\t\t} );\n\n\t\t\tthis.clearcoatSpecularIndirect.addAssign( this.clearcoatRadiance.mul( clearcoatEnv ) );\n\n\t\t}\n\n\t\t// Both indirect specular and indirect diffuse light accumulate here\n\n\t\tconst singleScattering = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)().temp( 'singleScattering' );\n\t\tconst multiScattering = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_11__.vec3)().temp( 'multiScattering' );\n\t\tconst cosineWeightedIrradiance = iblIrradiance.mul( 1 / Math.PI );\n\n\t\tthis.computeMultiscattering( singleScattering, multiScattering );\n\n\t\tconst totalScattering = singleScattering.add( multiScattering );\n\n\t\tconst diffuse = _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.diffuseColor.mul( totalScattering.r.max( totalScattering.g ).max( totalScattering.b ).oneMinus() );\n\n\t\treflectedLight.indirectSpecular.addAssign( radiance.mul( singleScattering ) );\n\t\treflectedLight.indirectSpecular.addAssign( multiScattering.mul( cosineWeightedIrradiance ) );\n\n\t\treflectedLight.indirectDiffuse.addAssign( diffuse.mul( cosineWeightedIrradiance ) );\n\n\t}\n\n\tambientOcclusion( { ambientOcclusion, reflectedLight } ) {\n\n\t\tconst dotNV = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_9__.transformedNormalView.dot( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_10__.positionViewDirection ).clamp(); // @ TODO: Move to core dotNV\n\n\t\tconst aoNV = dotNV.add( ambientOcclusion );\n\t\tconst aoExp = _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.roughness.mul( - 16.0 ).oneMinus().negate().exp2();\n\n\t\tconst aoNode = ambientOcclusion.sub( aoNV.pow( aoExp ).oneMinus() ).clamp();\n\n\t\tif ( this.clearcoat === true ) {\n\n\t\t\tthis.clearcoatSpecularIndirect.mulAssign( ambientOcclusion );\n\n\t\t}\n\n\t\tif ( this.sheen === true ) {\n\n\t\t\tthis.sheenSpecularIndirect.mulAssign( ambientOcclusion );\n\n\t\t}\n\n\t\treflectedLight.indirectDiffuse.mulAssign( ambientOcclusion );\n\t\treflectedLight.indirectSpecular.mulAssign( aoNode );\n\n\t}\n\n\tfinish( context ) {\n\n\t\tconst { outgoingLight } = context;\n\n\t\tif ( this.clearcoat === true ) {\n\n\t\t\tconst dotNVcc = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_9__.transformedClearcoatNormalView.dot( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_10__.positionViewDirection ).clamp();\n\n\t\t\tconst Fcc = (0,_BSDF_F_Schlick_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"])( {\n\t\t\t\tdotVH: dotNVcc,\n\t\t\t\tf0: clearcoatF0,\n\t\t\t\tf90: clearcoatF90\n\t\t\t} );\n\n\t\t\tconst clearcoatLight = outgoingLight.mul( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.clearcoat.mul( Fcc ).oneMinus() ).add( this.clearcoatSpecularDirect.add( this.clearcoatSpecularIndirect ).mul( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.clearcoat ) );\n\n\t\t\toutgoingLight.assign( clearcoatLight );\n\n\t\t}\n\n\t\tif ( this.sheen === true ) {\n\n\t\t\tconst sheenEnergyComp = _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.sheen.r.max( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.sheen.g ).max( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_8__.sheen.b ).mul( 0.157 ).oneMinus();\n\t\t\tconst sheenLight = outgoingLight.mul( sheenEnergyComp ).add( this.sheenSpecularDirect, this.sheenSpecularIndirect );\n\n\t\t\toutgoingLight.assign( sheenLight );\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PhysicalLightingModel);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/PhysicalLightingModel.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/material/getGeometryRoughness.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/material/getGeometryRoughness.js ***! + \******************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nconst getGeometryRoughness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.tslFn)( () => {\n\n\tconst dxy = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_0__.normalGeometry.dFdx().abs().max( _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_0__.normalGeometry.dFdy().abs() );\n\tconst geometryRoughness = dxy.x.max( dxy.y ).max( dxy.z );\n\n\treturn geometryRoughness;\n\n} );\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getGeometryRoughness);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/material/getGeometryRoughness.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/functions/material/getRoughness.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/functions/material/getRoughness.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _getGeometryRoughness_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getGeometryRoughness.js */ \"./node_modules/three/examples/jsm/nodes/functions/material/getGeometryRoughness.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nconst getRoughness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.tslFn)( ( inputs ) => {\n\n\tconst { roughness } = inputs;\n\n\tconst geometryRoughness = (0,_getGeometryRoughness_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n\n\tlet roughnessFactor = roughness.max( 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.\n\troughnessFactor = roughnessFactor.add( geometryRoughness );\n\troughnessFactor = roughnessFactor.min( 1.0 );\n\n\treturn roughnessFactor;\n\n} );\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getRoughness);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/functions/material/getRoughness.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/geometry/RangeNode.js": +/*!*********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/geometry/RangeNode.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ range: () => (/* binding */ range)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/NodeUtils.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeUtils.js\");\n/* harmony import */ var _accessors_BufferNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/BufferNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BufferNode.js\");\n/* harmony import */ var _core_IndexNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/IndexNode.js */ \"./node_modules/three/examples/jsm/nodes/core/IndexNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n//import { bufferAttribute } from '../accessors/BufferAttributeNode.js';\n\n\n\n\n\nlet min = null;\nlet max = null;\n\nclass RangeNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( minNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.float)(), maxNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.float)() ) {\n\n\t\tsuper();\n\n\t\tthis.minNode = minNode;\n\t\tthis.maxNode = maxNode;\n\n\t}\n\n\tgetVectorLength( builder ) {\n\n\t\tconst minLength = builder.getTypeLength( (0,_core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.getValueType)( this.minNode.value ) );\n\t\tconst maxLength = builder.getTypeLength( (0,_core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.getValueType)( this.maxNode.value ) );\n\n\t\treturn minLength > maxLength ? minLength : maxLength;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn builder.object.isInstancedMesh === true ? builder.getTypeFromLength( this.getVectorLength( builder ) ) : 'float';\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst object = builder.object;\n\n\t\tlet output = null;\n\n\t\tif ( object.isInstancedMesh === true ) {\n\n\t\t\tconst minValue = this.minNode.value;\n\t\t\tconst maxValue = this.maxNode.value;\n\n\t\t\tconst minLength = builder.getTypeLength( (0,_core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.getValueType)( minValue ) );\n\t\t\tconst maxLength = builder.getTypeLength( (0,_core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_1__.getValueType)( maxValue ) );\n\n\t\t\tmin = min || new three__WEBPACK_IMPORTED_MODULE_5__.Vector4();\n\t\t\tmax = max || new three__WEBPACK_IMPORTED_MODULE_5__.Vector4();\n\n\t\t\tmin.setScalar( 0 );\n\t\t\tmax.setScalar( 0 );\n\n\t\t\tif ( minLength === 1 ) min.setScalar( minValue );\n\t\t\telse if ( minValue.isColor ) min.set( minValue.r, minValue.g, minValue.b );\n\t\t\telse min.set( minValue.x, minValue.y, minValue.z || 0, minValue.w || 0 );\n\n\t\t\tif ( maxLength === 1 ) max.setScalar( maxValue );\n\t\t\telse if ( maxValue.isColor ) max.set( maxValue.r, maxValue.g, maxValue.b );\n\t\t\telse max.set( maxValue.x, maxValue.y, maxValue.z || 0, maxValue.w || 0 );\n\n\t\t\tconst stride = 4;\n\n\t\t\tconst length = stride * object.count;\n\t\t\tconst array = new Float32Array( length );\n\n\t\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\t\tconst index = i % stride;\n\n\t\t\t\tconst minElementValue = min.getComponent( index );\n\t\t\t\tconst maxElementValue = max.getComponent( index );\n\n\t\t\t\tarray[ i ] = three__WEBPACK_IMPORTED_MODULE_5__.MathUtils.lerp( minElementValue, maxElementValue, Math.random() );\n\n\t\t\t}\n\n\t\t\tconst nodeType = this.getNodeType( builder );\n\n\t\t\toutput = (0,_accessors_BufferNode_js__WEBPACK_IMPORTED_MODULE_2__.buffer)( array, 'vec4', object.count ).element( _core_IndexNode_js__WEBPACK_IMPORTED_MODULE_3__.instanceIndex ).convert( nodeType );\n\t\t\t//output = bufferAttribute( array, 'vec4', 4, 0 ).convert( nodeType );\n\n\t\t} else {\n\n\t\t\toutput = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.float)( 0 );\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RangeNode);\n\nconst range = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeProxy)( RangeNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'RangeNode', RangeNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/geometry/RangeNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/gpgpu/ComputeNode.js": +/*!********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/gpgpu/ComputeNode.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ compute: () => (/* binding */ compute),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass ComputeNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( computeNode, count, workgroupSize = [ 64 ] ) {\n\n\t\tsuper( 'void' );\n\n\t\tthis.isComputeNode = true;\n\n\t\tthis.computeNode = computeNode;\n\n\t\tthis.count = count;\n\t\tthis.workgroupSize = workgroupSize;\n\t\tthis.dispatchCount = 0;\n\n\t\tthis.version = 1;\n\t\tthis.updateBeforeType = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeUpdateType.OBJECT;\n\n\t\tthis.updateDispatchCount();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tupdateDispatchCount() {\n\n\t\tconst { count, workgroupSize } = this;\n\n\t\tlet size = workgroupSize[ 0 ];\n\n\t\tfor ( let i = 1; i < workgroupSize.length; i ++ )\n\t\t\tsize *= workgroupSize[ i ];\n\n\t\tthis.dispatchCount = Math.ceil( count / size );\n\n\t}\n\n\tonInit() { }\n\n\tupdateBefore( { renderer } ) {\n\n\t\trenderer.compute( this );\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst { shaderStage } = builder;\n\n\t\tif ( shaderStage === 'compute' ) {\n\n\t\t\tconst snippet = this.computeNode.build( builder, 'void' );\n\n\t\t\tif ( snippet !== '' ) {\n\n\t\t\t\tbuilder.addLineFlowCode( snippet );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ComputeNode);\n\nconst compute = ( node, count, workgroupSize ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new ComputeNode( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( node ), count, workgroupSize ) );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'compute', compute );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ComputeNode', ComputeNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/gpgpu/ComputeNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/AONode.js": +/*!******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/AONode.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _LightingNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LightingNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightingNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n\n\n\nclass AONode extends _LightingNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( aoNode = null ) {\n\n\t\tsuper();\n\n\t\tthis.aoNode = aoNode;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst aoIntensity = 1;\n\t\tconst aoNode = this.aoNode.x.sub( 1.0 ).mul( aoIntensity ).add( 1.0 );\n\n\t\tbuilder.context.ambientOcclusion.mulAssign( aoNode );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AONode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'AONode', AONode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/AONode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/AmbientLightNode.js": +/*!****************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/AmbientLightNode.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AnalyticLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/AnalyticLightNode.js\");\n/* harmony import */ var _LightsNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LightsNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightsNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\nclass AmbientLightNode extends _AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( light = null ) {\n\n\t\tsuper( light );\n\n\t}\n\n\tsetup( { context } ) {\n\n\t\tcontext.irradiance.addAssign( this.colorNode );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AmbientLightNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_2__.addNodeClass)( 'AmbientLightNode', AmbientLightNode );\n\n(0,_LightsNode_js__WEBPACK_IMPORTED_MODULE_1__.addLightNode)( three__WEBPACK_IMPORTED_MODULE_3__.AmbientLight, AmbientLightNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/AmbientLightNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/AnalyticLightNode.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/AnalyticLightNode.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _LightingNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LightingNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightingNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _accessors_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../accessors/ReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js\");\n/* harmony import */ var _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../accessors/TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\n\n//import { add } from '../math/OperatorNode.js';\n\n\n\nlet overrideMaterial = null;\n\nclass AnalyticLightNode extends _LightingNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( light = null ) {\n\n\t\tsuper();\n\n\t\tthis.updateType = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeUpdateType.FRAME;\n\n\t\tthis.light = light;\n\n\t\tthis.rtt = null;\n\t\tthis.shadowNode = null;\n\n\t\tthis.color = new three__WEBPACK_IMPORTED_MODULE_9__.Color();\n\t\tthis._defaultColorNode = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_2__.uniform)( this.color );\n\n\t\tthis.colorNode = this._defaultColorNode;\n\n\t\tthis.isAnalyticLightNode = true;\n\n\t}\n\n\tgetCacheKey() {\n\n\t\treturn super.getCacheKey() + '-' + ( this.light.id + '-' + ( this.light.castShadow ? '1' : '0' ) );\n\n\t}\n\n\tgetHash() {\n\n\t\treturn this.light.uuid;\n\n\t}\n\n\tsetupShadow( builder ) {\n\n\t\tlet shadowNode = this.shadowNode;\n\n\t\tif ( shadowNode === null ) {\n\n\t\t\tif ( overrideMaterial === null ) {\n\n\t\t\t\toverrideMaterial = builder.createNodeMaterial();\n\t\t\t\toverrideMaterial.fragmentNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec4)( 0, 0, 0, 1 );\n\t\t\t\toverrideMaterial.isShadowNodeMaterial = true; // Use to avoid other overrideMaterial override material.fragmentNode unintentionally when using material.shadowNode\n\n\t\t\t}\n\n\t\t\tconst shadow = this.light.shadow;\n\t\t\tconst rtt = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height );\n\n\t\t\tconst depthTexture = new three__WEBPACK_IMPORTED_MODULE_9__.DepthTexture();\n\t\t\tdepthTexture.minFilter = three__WEBPACK_IMPORTED_MODULE_9__.NearestFilter;\n\t\t\tdepthTexture.magFilter = three__WEBPACK_IMPORTED_MODULE_9__.NearestFilter;\n\t\t\tdepthTexture.image.width = shadow.mapSize.width;\n\t\t\tdepthTexture.image.height = shadow.mapSize.height;\n\t\t\tdepthTexture.compareFunction = three__WEBPACK_IMPORTED_MODULE_9__.LessCompare;\n\n\t\t\trtt.depthTexture = depthTexture;\n\n\t\t\tshadow.camera.updateProjectionMatrix();\n\n\t\t\t//\n\n\t\t\tconst bias = (0,_accessors_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_5__.reference)( 'bias', 'float', shadow );\n\t\t\tconst normalBias = (0,_accessors_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_5__.reference)( 'normalBias', 'float', shadow );\n\n\t\t\tlet shadowCoord = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_2__.uniform)( shadow.matrix ).mul( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_7__.positionWorld.add( _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_8__.normalWorld.mul( normalBias ) ) );\n\t\t\tshadowCoord = shadowCoord.xyz.div( shadowCoord.w );\n\n\t\t\tconst frustumTest = shadowCoord.x.greaterThanEqual( 0 )\n\t\t\t\t.and( shadowCoord.x.lessThanEqual( 1 ) )\n\t\t\t\t.and( shadowCoord.y.greaterThanEqual( 0 ) )\n\t\t\t\t.and( shadowCoord.y.lessThanEqual( 1 ) )\n\t\t\t\t.and( shadowCoord.z.lessThanEqual( 1 ) );\n\n\t\t\tlet coordZ = shadowCoord.z.add( bias );\n\n\t\t\tif ( builder.renderer.coordinateSystem === three__WEBPACK_IMPORTED_MODULE_9__.WebGPUCoordinateSystem ) {\n\n\t\t\t\tcoordZ = coordZ.mul( 2 ).sub( 1 ); // WebGPU: Convertion [ 0, 1 ] to [ - 1, 1 ]\n\n\t\t\t}\n\n\t\t\tshadowCoord = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec3)(\n\t\t\t\tshadowCoord.x,\n\t\t\t\tshadowCoord.y.oneMinus(), // follow webgpu standards\n\t\t\t\tcoordZ\n\t\t\t);\n\n\t\t\tconst textureCompare = ( depthTexture, shadowCoord, compare ) => (0,_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_6__.texture)( depthTexture, shadowCoord ).compare( compare );\n\t\t\t//const textureCompare = ( depthTexture, shadowCoord, compare ) => compare.step( texture( depthTexture, shadowCoord ) );\n\n\t\t\t// BasicShadowMap\n\n\t\t\tshadowNode = textureCompare( depthTexture, shadowCoord.xy, shadowCoord.z );\n\n\t\t\t// PCFShadowMap\n\t\t\t/*\n\t\t\tconst mapSize = reference( 'mapSize', 'vec2', shadow );\n\t\t\tconst radius = reference( 'radius', 'float', shadow );\n\n\t\t\tconst texelSize = vec2( 1 ).div( mapSize );\n\t\t\tconst dx0 = texelSize.x.negate().mul( radius );\n\t\t\tconst dy0 = texelSize.y.negate().mul( radius );\n\t\t\tconst dx1 = texelSize.x.mul( radius );\n\t\t\tconst dy1 = texelSize.y.mul( radius );\n\t\t\tconst dx2 = dx0.mul( 2 );\n\t\t\tconst dy2 = dy0.mul( 2 );\n\t\t\tconst dx3 = dx1.mul( 2 );\n\t\t\tconst dy3 = dy1.mul( 2 );\n\n\t\t\tshadowNode = add(\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( dx0, dy0 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( 0, dy0 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( dx1, dy0 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( dx2, dy2 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( 0, dy2 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( dx3, dy2 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( dx0, 0 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( dx2, 0 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy, shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( dx3, 0 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( dx1, 0 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( dx2, dy3 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( 0, dy3 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( dx3, dy3 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( dx0, dy1 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( 0, dy1 ) ), shadowCoord.z ),\n\t\t\t\ttextureCompare( depthTexture, shadowCoord.xy.add( vec2( dx1, dy1 ) ), shadowCoord.z )\n\t\t\t).mul( 1 / 17 );\n\t\t\t*/\n\t\t\t//\n\n\t\t\tconst shadowColor = (0,_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_6__.texture)( rtt.texture, shadowCoord );\n\n\t\t\tthis.rtt = rtt;\n\t\t\tthis.colorNode = this.colorNode.mul( frustumTest.mix( 1, shadowNode.mix( shadowColor.a.mix( 1, shadowColor ), 1 ) ) );\n\n\t\t\tthis.shadowNode = shadowNode;\n\n\t\t\t//\n\n\t\t\tthis.updateBeforeType = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeUpdateType.RENDER;\n\n\t\t}\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tif ( this.light.castShadow ) this.setupShadow( builder );\n\t\telse if ( this.shadowNode !== null ) this.disposeShadow();\n\n\t}\n\n\tupdateShadow( frame ) {\n\n\t\tconst { rtt, light } = this;\n\t\tconst { renderer, scene } = frame;\n\n\t\tconst currentOverrideMaterial = scene.overrideMaterial;\n\n\t\tscene.overrideMaterial = overrideMaterial;\n\n\t\trtt.setSize( light.shadow.mapSize.width, light.shadow.mapSize.height );\n\n\t\tlight.shadow.updateMatrices( light );\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\t\tconst currentRenderObjectFunction = renderer.getRenderObjectFunction();\n\n\t\trenderer.setRenderObjectFunction( ( object, ...params ) => {\n\n\t\t\tif ( object.castShadow === true ) {\n\n\t\t\t\trenderer.renderObject( object, ...params );\n\n\t\t\t}\n\n\t\t} );\n\n\t\trenderer.setRenderTarget( rtt );\n\n\t\trenderer.render( scene, light.shadow.camera );\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\t\trenderer.setRenderObjectFunction( currentRenderObjectFunction );\n\n\t\tscene.overrideMaterial = currentOverrideMaterial;\n\n\t}\n\n\tdisposeShadow() {\n\n\t\tthis.rtt.dispose();\n\n\t\tthis.shadowNode = null;\n\t\tthis.rtt = null;\n\n\t\tthis.colorNode = this._defaultColorNode;\n\n\t}\n\n\tupdateBefore( frame ) {\n\n\t\tconst { light } = this;\n\n\t\tif ( light.castShadow ) this.updateShadow( frame );\n\n\t}\n\n\tupdate( /*frame*/ ) {\n\n\t\tconst { light } = this;\n\n\t\tthis.color.copy( light.color ).multiplyScalar( light.intensity );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AnalyticLightNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_3__.addNodeClass)( 'AnalyticLightNode', AnalyticLightNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/AnalyticLightNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/DirectionalLightNode.js": +/*!********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/DirectionalLightNode.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AnalyticLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/AnalyticLightNode.js\");\n/* harmony import */ var _LightNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightNode.js\");\n/* harmony import */ var _LightsNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LightsNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightsNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\nclass DirectionalLightNode extends _AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( light = null ) {\n\n\t\tsuper( light );\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tsuper.setup( builder );\n\n\t\tconst lightingModel = builder.context.lightingModel;\n\n\t\tconst lightColor = this.colorNode;\n\t\tconst lightDirection = (0,_LightNode_js__WEBPACK_IMPORTED_MODULE_1__.lightTargetDirection)( this.light );\n\t\tconst reflectedLight = builder.context.reflectedLight;\n\n\t\tlightingModel.direct( {\n\t\t\tlightDirection,\n\t\t\tlightColor,\n\t\t\treflectedLight\n\t\t}, builder.stack, builder );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DirectionalLightNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_3__.addNodeClass)( 'DirectionalLightNode', DirectionalLightNode );\n\n(0,_LightsNode_js__WEBPACK_IMPORTED_MODULE_2__.addLightNode)( three__WEBPACK_IMPORTED_MODULE_4__.DirectionalLight, DirectionalLightNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/DirectionalLightNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/EnvironmentNode.js": +/*!***************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/EnvironmentNode.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _LightingNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LightingNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightingNode.js\");\n/* harmony import */ var _core_CacheNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/CacheNode.js */ \"./node_modules/three/examples/jsm/nodes/core/CacheNode.js\");\n/* harmony import */ var _core_ContextNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/ContextNode.js */ \"./node_modules/three/examples/jsm/nodes/core/ContextNode.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _accessors_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../accessors/ReferenceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ReferenceNode.js\");\n/* harmony import */ var _pmrem_PMREMNode_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../pmrem/PMREMNode.js */ \"./node_modules/three/examples/jsm/nodes/pmrem/PMREMNode.js\");\n\n\n\n\n\n\n\n\n\n\n\n\nconst envNodeCache = new WeakMap();\n\nclass EnvironmentNode extends _LightingNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( envNode = null ) {\n\n\t\tsuper();\n\n\t\tthis.envNode = envNode;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tlet envNode = this.envNode;\n\n\t\tif ( envNode.isTextureNode ) {\n\n\t\t\tlet cacheEnvNode = envNodeCache.get( envNode.value );\n\n\t\t\tif ( cacheEnvNode === undefined ) {\n\n\t\t\t\tcacheEnvNode = (0,_pmrem_PMREMNode_js__WEBPACK_IMPORTED_MODULE_10__.pmremTexture)( envNode.value );\n\n\t\t\t\tenvNodeCache.set( envNode.value, cacheEnvNode );\n\n\t\t\t}\n\n\t\t\tenvNode\t= cacheEnvNode;\n\n\t\t}\n\n\t\t//\n\n\t\tconst envMap = builder.material.envMap;\n\t\tconst intensity = envMap ? (0,_accessors_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_9__.reference)( 'envMapIntensity', 'float', builder.material ) : (0,_accessors_ReferenceNode_js__WEBPACK_IMPORTED_MODULE_9__.reference)( 'environmentIntensity', 'float', builder.scene ); // @TODO: Add materialEnvIntensity in MaterialNode\n\n\t\tconst radiance = (0,_core_ContextNode_js__WEBPACK_IMPORTED_MODULE_2__.context)( envNode, createRadianceContext( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.roughness, _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_5__.transformedNormalView ) ).mul( intensity );\n\t\tconst irradiance = (0,_core_ContextNode_js__WEBPACK_IMPORTED_MODULE_2__.context)( envNode, createIrradianceContext( _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_5__.transformedNormalWorld ) ).mul( Math.PI ).mul( intensity );\n\n\t\tconst isolateRadiance = (0,_core_CacheNode_js__WEBPACK_IMPORTED_MODULE_1__.cache)( radiance );\n\n\t\t//\n\n\t\tbuilder.context.radiance.addAssign( isolateRadiance );\n\n\t\tbuilder.context.iblIrradiance.addAssign( irradiance );\n\n\t\t//\n\n\t\tconst clearcoatRadiance = builder.context.lightingModel.clearcoatRadiance;\n\n\t\tif ( clearcoatRadiance ) {\n\n\t\t\tconst clearcoatRadianceContext = (0,_core_ContextNode_js__WEBPACK_IMPORTED_MODULE_2__.context)( envNode, createRadianceContext( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.clearcoatRoughness, _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_5__.transformedClearcoatNormalView ) ).mul( intensity );\n\t\t\tconst isolateClearcoatRadiance = (0,_core_CacheNode_js__WEBPACK_IMPORTED_MODULE_1__.cache)( clearcoatRadianceContext );\n\n\t\t\tclearcoatRadiance.addAssign( isolateClearcoatRadiance );\n\n\t\t}\n\n\t}\n\n}\n\nconst createRadianceContext = ( roughnessNode, normalViewNode ) => {\n\n\tlet reflectVec = null;\n\n\treturn {\n\t\tgetUV: () => {\n\n\t\t\tif ( reflectVec === null ) {\n\n\t\t\t\treflectVec = _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_6__.positionViewDirection.negate().reflect( normalViewNode );\n\t\t\t\treflectVec = roughnessNode.mul( roughnessNode ).mix( reflectVec, normalViewNode ).normalize();\n\t\t\t\treflectVec = reflectVec.transformDirection( _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_4__.cameraViewMatrix );\n\n\t\t\t}\n\n\t\t\treturn reflectVec;\n\n\t\t},\n\t\tgetTextureLevel: () => {\n\n\t\t\treturn roughnessNode;\n\n\t\t}\n\t};\n\n};\n\nconst createIrradianceContext = ( normalWorldNode ) => {\n\n\treturn {\n\t\tgetUV: () => {\n\n\t\t\treturn normalWorldNode;\n\n\t\t},\n\t\tgetTextureLevel: () => {\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_8__.float)( 1.0 );\n\n\t\t}\n\t};\n\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EnvironmentNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_7__.addNodeClass)( 'EnvironmentNode', EnvironmentNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/EnvironmentNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/HemisphereLightNode.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/HemisphereLightNode.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AnalyticLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/AnalyticLightNode.js\");\n/* harmony import */ var _LightsNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LightsNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightsNode.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../accessors/Object3DNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/Object3DNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\n\nclass HemisphereLightNode extends _AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( light = null ) {\n\n\t\tsuper( light );\n\n\t\tthis.lightPositionNode = (0,_accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_5__.objectPosition)( light );\n\t\tthis.lightDirectionNode = this.lightPositionNode.normalize();\n\n\t\tthis.groundColorNode = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_2__.uniform)( new three__WEBPACK_IMPORTED_MODULE_7__.Color() );\n\n\t}\n\n\tupdate( frame ) {\n\n\t\tconst { light } = this;\n\n\t\tsuper.update( frame );\n\n\t\tthis.lightPositionNode.object3d = light;\n\n\t\tthis.groundColorNode.value.copy( light.groundColor ).multiplyScalar( light.intensity );\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst { colorNode, groundColorNode, lightDirectionNode } = this;\n\n\t\tconst dotNL = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_4__.normalView.dot( lightDirectionNode );\n\t\tconst hemiDiffuseWeight = dotNL.mul( 0.5 ).add( 0.5 );\n\n\t\tconst irradiance = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.mix)( groundColorNode, colorNode, hemiDiffuseWeight );\n\n\t\tbuilder.context.irradiance.addAssign( irradiance );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (HemisphereLightNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_6__.addNodeClass)( 'HemisphereLightNode', HemisphereLightNode );\n\n(0,_LightsNode_js__WEBPACK_IMPORTED_MODULE_1__.addLightNode)( three__WEBPACK_IMPORTED_MODULE_7__.HemisphereLight, HemisphereLightNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/HemisphereLightNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/IESSpotLightNode.js": +/*!****************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/IESSpotLightNode.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _SpotLightNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SpotLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/SpotLightNode.js\");\n/* harmony import */ var _LightsNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LightsNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightsNode.js\");\n/* harmony import */ var _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _lights_IESSpotLight_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../lights/IESSpotLight.js */ \"./node_modules/three/examples/jsm/lights/IESSpotLight.js\");\n\n\n\n\n\n\n\n\nclass IESSpotLightNode extends _SpotLightNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tgetSpotAttenuation( angleCosine ) {\n\n\t\tconst iesMap = this.light.iesMap;\n\n\t\tlet spotAttenuation = null;\n\n\t\tif ( iesMap && iesMap.isTexture === true ) {\n\n\t\t\tconst angle = angleCosine.acos().mul( 1.0 / Math.PI );\n\n\t\t\tspotAttenuation = (0,_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_2__.texture)( iesMap, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec2)( angle, 0 ), 0 ).r;\n\n\t\t} else {\n\n\t\t\tspotAttenuation = super.getSpotAttenuation( angleCosine );\n\n\t\t}\n\n\t\treturn spotAttenuation;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (IESSpotLightNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_4__.addNodeClass)( 'IESSpotLightNode', IESSpotLightNode );\n\n(0,_LightsNode_js__WEBPACK_IMPORTED_MODULE_1__.addLightNode)( _lights_IESSpotLight_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"], IESSpotLightNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/IESSpotLightNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/LightNode.js": +/*!*********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/LightNode.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ lightTargetDirection: () => (/* binding */ lightTargetDirection)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/Object3DNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/Object3DNode.js\");\n/* harmony import */ var _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n\n\n\n\n\nclass LightNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope = LightNode.TARGET_DIRECTION, light = null ) {\n\n\t\tsuper();\n\n\t\tthis.scope = scope;\n\t\tthis.light = light;\n\n\t}\n\n\tsetup() {\n\n\t\tconst { scope, light } = this;\n\n\t\tlet output = null;\n\n\t\tif ( scope === LightNode.TARGET_DIRECTION ) {\n\n\t\t\toutput = _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_3__.cameraViewMatrix.transformDirection( (0,_accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_2__.objectPosition)( light ).sub( (0,_accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_2__.objectPosition)( light.target ) ) );\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.scope = this.scope;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.scope = data.scope;\n\n\t}\n\n}\n\nLightNode.TARGET_DIRECTION = 'targetDirection';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LightNode);\n\nconst lightTargetDirection = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( LightNode, LightNode.TARGET_DIRECTION );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'LightNode', LightNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/LightNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/LightUtils.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/LightUtils.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getDistanceAttenuation: () => (/* binding */ getDistanceAttenuation)\n/* harmony export */ });\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\nconst getDistanceAttenuation = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( inputs ) => {\n\n\tconst { lightDistance, cutoffDistance, decayExponent } = inputs;\n\n\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t// page 32, equation 26: E[window1]\n\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\tconst distanceFalloff = lightDistance.pow( decayExponent ).max( 0.01 ).reciprocal();\n\n\treturn cutoffDistance.greaterThan( 0 ).cond(\n\t\tdistanceFalloff.mul( lightDistance.div( cutoffDistance ).pow4().oneMinus().clamp().pow2() ),\n\t\tdistanceFalloff\n\t);\n\n} ); // validated\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/LightUtils.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/LightingContextNode.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/LightingContextNode.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ lightingContext: () => (/* binding */ lightingContext)\n/* harmony export */ });\n/* harmony import */ var _core_ContextNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/ContextNode.js */ \"./node_modules/three/examples/jsm/nodes/core/ContextNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass LightingContextNode extends _core_ContextNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( node, lightingModel = null, backdropNode = null, backdropAlphaNode = null ) {\n\n\t\tsuper( node );\n\n\t\tthis.lightingModel = lightingModel;\n\t\tthis.backdropNode = backdropNode;\n\t\tthis.backdropAlphaNode = backdropAlphaNode;\n\n\t\tthis._context = null;\n\n\t}\n\n\tgetContext() {\n\n\t\tconst { backdropNode, backdropAlphaNode } = this;\n\n\t\tconst directDiffuse = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)().temp( 'directDiffuse' ),\n\t\t\tdirectSpecular = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)().temp( 'directSpecular' ),\n\t\t\tindirectDiffuse = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)().temp( 'indirectDiffuse' ),\n\t\t\tindirectSpecular = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)().temp( 'indirectSpecular' );\n\n\t\tconst reflectedLight = {\n\t\t\tdirectDiffuse,\n\t\t\tdirectSpecular,\n\t\t\tindirectDiffuse,\n\t\t\tindirectSpecular\n\t\t};\n\n\t\tconst context = {\n\t\t\tradiance: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)().temp( 'radiance' ),\n\t\t\tirradiance: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)().temp( 'irradiance' ),\n\t\t\tiblIrradiance: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)().temp( 'iblIrradiance' ),\n\t\t\tambientOcclusion: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.float)( 1 ).temp( 'ambientOcclusion' ),\n\t\t\treflectedLight,\n\t\t\tbackdrop: backdropNode,\n\t\t\tbackdropAlpha: backdropAlphaNode\n\t\t};\n\n\t\treturn context;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tthis.context = this._context || ( this._context = this.getContext() );\n\t\tthis.context.lightingModel = this.lightingModel || builder.context.lightingModel;\n\n\t\treturn super.setup( builder );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LightingContextNode);\n\nconst lightingContext = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( LightingContextNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'lightingContext', lightingContext );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'LightingContextNode', LightingContextNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/LightingContextNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/LightingNode.js": +/*!************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/LightingNode.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n\n\nclass LightingNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor() {\n\n\t\tsuper( 'vec3' );\n\n\t}\n\n\tgenerate( /*builder*/ ) {\n\n\t\tconsole.warn( 'Abstract function.' );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LightingNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'LightingNode', LightingNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/LightingNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/LightsNode.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/LightsNode.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addLightNode: () => (/* binding */ addLightNode),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ lights: () => (/* binding */ lights),\n/* harmony export */ lightsNode: () => (/* binding */ lightsNode)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AnalyticLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/AnalyticLightNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nconst LightNodes = new WeakMap();\n\nconst sortLights = ( lights ) => {\n\n\treturn lights.sort( ( a, b ) => a.id - b.id );\n\n};\n\nclass LightsNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( lightNodes = [] ) {\n\n\t\tsuper( 'vec3' );\n\n\t\tthis.totalDiffuseNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)().temp( 'totalDiffuse' );\n\t\tthis.totalSpecularNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)().temp( 'totalSpecular' );\n\n\t\tthis.outgoingLightNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)().temp( 'outgoingLight' );\n\n\t\tthis.lightNodes = lightNodes;\n\n\t\tthis._hash = null;\n\n\t}\n\n\tget hasLight() {\n\n\t\treturn this.lightNodes.length > 0;\n\n\t}\n\n\tgetHash() {\n\n\t\tif ( this._hash === null ) {\n\n\t\t\tconst hash = [];\n\n\t\t\tfor ( const lightNode of this.lightNodes ) {\n\n\t\t\t\thash.push( lightNode.getHash() );\n\n\t\t\t}\n\n\t\t\tthis._hash = 'lights-' + hash.join( ',' );\n\n\t\t}\n\n\t\treturn this._hash;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst context = builder.context;\n\t\tconst lightingModel = context.lightingModel;\n\n\t\tlet outgoingLightNode = this.outgoingLightNode;\n\n\t\tif ( lightingModel ) {\n\n\t\t\tconst { lightNodes, totalDiffuseNode, totalSpecularNode } = this;\n\n\t\t\tcontext.outgoingLight = outgoingLightNode;\n\n\t\t\tconst stack = builder.addStack();\n\n\t\t\t//\n\n\t\t\tlightingModel.start( context, stack, builder );\n\n\t\t\t// lights\n\n\t\t\tfor ( const lightNode of lightNodes ) {\n\n\t\t\t\tlightNode.build( builder );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlightingModel.indirectDiffuse( context, stack, builder );\n\t\t\tlightingModel.indirectSpecular( context, stack, builder );\n\t\t\tlightingModel.ambientOcclusion( context, stack, builder );\n\n\t\t\t//\n\n\t\t\tconst { backdrop, backdropAlpha } = context;\n\t\t\tconst { directDiffuse, directSpecular, indirectDiffuse, indirectSpecular } = context.reflectedLight;\n\n\t\t\tlet totalDiffuse = directDiffuse.add( indirectDiffuse );\n\n\t\t\tif ( backdrop !== null ) {\n\n\t\t\t\ttotalDiffuse = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec3)( backdropAlpha !== null ? backdropAlpha.mix( totalDiffuse, backdrop ) : backdrop );\n\n\t\t\t}\n\n\t\t\ttotalDiffuseNode.assign( totalDiffuse );\n\t\t\ttotalSpecularNode.assign( directSpecular.add( indirectSpecular ) );\n\n\t\t\toutgoingLightNode.assign( totalDiffuseNode.add( totalSpecularNode ) );\n\n\t\t\t//\n\n\t\t\tlightingModel.finish( context, stack, builder );\n\n\t\t\t//\n\n\t\t\toutgoingLightNode = outgoingLightNode.bypass( builder.removeStack() );\n\n\t\t}\n\n\t\treturn outgoingLightNode;\n\n\t}\n\n\t_getLightNodeById( id ) {\n\n\t\tfor ( const lightNode of this.lightNodes ) {\n\n\t\t\tif ( lightNode.isAnalyticLightNode && lightNode.light.id === id ) {\n\n\t\t\t\treturn lightNode;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\tfromLights( lights = [] ) {\n\n\t\tconst lightNodes = [];\n\n\t\tlights = sortLights( lights );\n\n\t\tfor ( const light of lights ) {\n\n\t\t\tlet lightNode = this._getLightNodeById( light.id );\n\n\t\t\tif ( lightNode === null ) {\n\n\t\t\t\tconst lightClass = light.constructor;\n\t\t\t\tconst lightNodeClass = LightNodes.has( lightClass ) ? LightNodes.get( lightClass ) : _AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"];\n\n\t\t\t\tlightNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new lightNodeClass( light ) );\n\n\t\t\t}\n\n\t\t\tlightNodes.push( lightNode );\n\n\t\t}\n\n\t\tthis.lightNodes = lightNodes;\n\t\tthis._hash = null;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LightsNode);\n\nconst lights = ( lights ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new LightsNode().fromLights( lights ) );\nconst lightsNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( LightsNode );\n\nfunction addLightNode( lightClass, lightNodeClass ) {\n\n\tif ( LightNodes.has( lightClass ) ) {\n\n\t\tconsole.warn( `Redefinition of light node ${ lightNodeClass.type }` );\n\t\treturn;\n\n\t}\n\n\tif ( typeof lightClass !== 'function' ) throw new Error( `Light ${ lightClass.name } is not a class` );\n\tif ( typeof lightNodeClass !== 'function' || ! lightNodeClass.type ) throw new Error( `Light node ${ lightNodeClass.type } is not a class` );\n\n\tLightNodes.set( lightClass, lightNodeClass );\n\n}\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/LightsNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/PointLightNode.js": +/*!**************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/PointLightNode.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AnalyticLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/AnalyticLightNode.js\");\n/* harmony import */ var _LightsNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LightsNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightsNode.js\");\n/* harmony import */ var _LightUtils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LightUtils.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightUtils.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/Object3DNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/Object3DNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\n\nclass PointLightNode extends _AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( light = null ) {\n\n\t\tsuper( light );\n\n\t\tthis.cutoffDistanceNode = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__.uniform)( 0 );\n\t\tthis.decayExponentNode = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__.uniform)( 0 );\n\n\t}\n\n\tupdate( frame ) {\n\n\t\tconst { light } = this;\n\n\t\tsuper.update( frame );\n\n\t\tthis.cutoffDistanceNode.value = light.distance;\n\t\tthis.decayExponentNode.value = light.decay;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst { colorNode, cutoffDistanceNode, decayExponentNode, light } = this;\n\n\t\tconst lightingModel = builder.context.lightingModel;\n\n\t\tconst lVector = (0,_accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_4__.objectViewPosition)( light ).sub( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_5__.positionView ); // @TODO: Add it into LightNode\n\n\t\tconst lightDirection = lVector.normalize();\n\t\tconst lightDistance = lVector.length();\n\n\t\tconst lightAttenuation = (0,_LightUtils_js__WEBPACK_IMPORTED_MODULE_2__.getDistanceAttenuation)( {\n\t\t\tlightDistance,\n\t\t\tcutoffDistance: cutoffDistanceNode,\n\t\t\tdecayExponent: decayExponentNode\n\t\t} );\n\n\t\tconst lightColor = colorNode.mul( lightAttenuation );\n\n\t\tconst reflectedLight = builder.context.reflectedLight;\n\n\t\tlightingModel.direct( {\n\t\t\tlightDirection,\n\t\t\tlightColor,\n\t\t\treflectedLight\n\t\t}, builder.stack, builder );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PointLightNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_6__.addNodeClass)( 'PointLightNode', PointLightNode );\n\n(0,_LightsNode_js__WEBPACK_IMPORTED_MODULE_1__.addLightNode)( three__WEBPACK_IMPORTED_MODULE_7__.PointLight, PointLightNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/PointLightNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/lighting/SpotLightNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/lighting/SpotLightNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AnalyticLightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/AnalyticLightNode.js\");\n/* harmony import */ var _LightNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LightNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightNode.js\");\n/* harmony import */ var _LightsNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LightsNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightsNode.js\");\n/* harmony import */ var _LightUtils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LightUtils.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightUtils.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../accessors/Object3DNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/Object3DNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\n\n\n\nclass SpotLightNode extends _AnalyticLightNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( light = null ) {\n\n\t\tsuper( light );\n\n\t\tthis.coneCosNode = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_4__.uniform)( 0 );\n\t\tthis.penumbraCosNode = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_4__.uniform)( 0 );\n\n\t\tthis.cutoffDistanceNode = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_4__.uniform)( 0 );\n\t\tthis.decayExponentNode = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_4__.uniform)( 0 );\n\n\t}\n\n\tupdate( frame ) {\n\n\t\tsuper.update( frame );\n\n\t\tconst { light } = this;\n\n\t\tthis.coneCosNode.value = Math.cos( light.angle );\n\t\tthis.penumbraCosNode.value = Math.cos( light.angle * ( 1 - light.penumbra ) );\n\n\t\tthis.cutoffDistanceNode.value = light.distance;\n\t\tthis.decayExponentNode.value = light.decay;\n\n\t}\n\n\tgetSpotAttenuation( angleCosine ) {\n\n\t\tconst { coneCosNode, penumbraCosNode } = this;\n\n\t\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_5__.smoothstep)( coneCosNode, penumbraCosNode, angleCosine );\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tsuper.setup( builder );\n\n\t\tconst lightingModel = builder.context.lightingModel;\n\n\t\tconst { colorNode, cutoffDistanceNode, decayExponentNode, light } = this;\n\n\t\tconst lVector = (0,_accessors_Object3DNode_js__WEBPACK_IMPORTED_MODULE_6__.objectViewPosition)( light ).sub( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_7__.positionView ); // @TODO: Add it into LightNode\n\n\t\tconst lightDirection = lVector.normalize();\n\t\tconst angleCos = lightDirection.dot( (0,_LightNode_js__WEBPACK_IMPORTED_MODULE_1__.lightTargetDirection)( light ) );\n\t\tconst spotAttenuation = this.getSpotAttenuation( angleCos );\n\n\t\tconst lightDistance = lVector.length();\n\n\t\tconst lightAttenuation = (0,_LightUtils_js__WEBPACK_IMPORTED_MODULE_3__.getDistanceAttenuation)( {\n\t\t\tlightDistance,\n\t\t\tcutoffDistance: cutoffDistanceNode,\n\t\t\tdecayExponent: decayExponentNode\n\t\t} );\n\n\t\tconst lightColor = colorNode.mul( spotAttenuation ).mul( lightAttenuation );\n\n\t\tconst reflectedLight = builder.context.reflectedLight;\n\n\t\tlightingModel.direct( {\n\t\t\tlightDirection,\n\t\t\tlightColor,\n\t\t\treflectedLight\n\t\t}, builder.stack, builder );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SpotLightNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_8__.addNodeClass)( 'SpotLightNode', SpotLightNode );\n\n(0,_LightsNode_js__WEBPACK_IMPORTED_MODULE_2__.addLightNode)( three__WEBPACK_IMPORTED_MODULE_9__.SpotLight, SpotLightNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/lighting/SpotLightNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/loaders/NodeLoader.js": +/*!*********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/loaders/NodeLoader.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\nclass NodeLoader extends three__WEBPACK_IMPORTED_MODULE_2__.Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tthis.textures = {};\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst loader = new three__WEBPACK_IMPORTED_MODULE_2__.FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, ( text ) => {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( this.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tthis.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparseNodes( json ) {\n\n\t\tconst nodes = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( const nodeJSON of json ) {\n\n\t\t\t\tconst { uuid, type } = nodeJSON;\n\n\t\t\t\tnodes[ uuid ] = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( (0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.createNodeFromType)( type ) ); // @TODO: Maybe nodeObjectify the node in createNodeFromType?\n\t\t\t\tnodes[ uuid ].uuid = uuid;\n\n\t\t\t}\n\n\t\t\tconst meta = { nodes, textures: this.textures };\n\n\t\t\tfor ( const nodeJSON of json ) {\n\n\t\t\t\tnodeJSON.meta = meta;\n\n\t\t\t\tconst node = nodes[ nodeJSON.uuid ];\n\t\t\t\tnode.deserialize( nodeJSON );\n\n\t\t\t\tdelete nodeJSON.meta;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn nodes;\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst node = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( (0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.createNodeFromType)( json.type ) );\n\t\tnode.uuid = json.uuid;\n\n\t\tconst nodes = this.parseNodes( json.nodes );\n\t\tconst meta = { nodes, textures: this.textures };\n\n\t\tjson.meta = meta;\n\n\t\tnode.deserialize( json );\n\n\t\tdelete json.meta;\n\n\t\treturn node;\n\n\t}\n\n\tsetTextures( value ) {\n\n\t\tthis.textures = value;\n\t\treturn this;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeLoader);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/loaders/NodeLoader.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/loaders/NodeMaterialLoader.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/loaders/NodeMaterialLoader.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _materials_Materials_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../materials/Materials.js */ \"./node_modules/three/examples/jsm/nodes/materials/Materials.js\");\n\n\n\nconst superFromTypeFunction = three__WEBPACK_IMPORTED_MODULE_1__.MaterialLoader.createMaterialFromType;\n\nthree__WEBPACK_IMPORTED_MODULE_1__.MaterialLoader.createMaterialFromType = function ( type ) {\n\n\tconst material = (0,_materials_Materials_js__WEBPACK_IMPORTED_MODULE_0__.createNodeMaterialFromType)( type );\n\n\tif ( material !== undefined ) {\n\n\t\treturn material;\n\n\t}\n\n\treturn superFromTypeFunction.call( this, type );\n\n};\n\nclass NodeMaterialLoader extends three__WEBPACK_IMPORTED_MODULE_1__.MaterialLoader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tthis.nodes = {};\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst material = super.parse( json );\n\n\t\tconst nodes = this.nodes;\n\t\tconst inputNodes = json.inputNodes;\n\n\t\tfor ( const property in inputNodes ) {\n\n\t\t\tconst uuid = inputNodes[ property ];\n\n\t\t\tmaterial[ property ] = nodes[ uuid ];\n\n\t\t}\n\n\t\treturn material;\n\n\t}\n\n\tsetNodes( value ) {\n\n\t\tthis.nodes = value;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeMaterialLoader);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/loaders/NodeMaterialLoader.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/loaders/NodeObjectLoader.js": +/*!***************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/loaders/NodeObjectLoader.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeLoader_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeLoader.js */ \"./node_modules/three/examples/jsm/nodes/loaders/NodeLoader.js\");\n/* harmony import */ var _NodeMaterialLoader_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NodeMaterialLoader.js */ \"./node_modules/three/examples/jsm/nodes/loaders/NodeMaterialLoader.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\nclass NodeObjectLoader extends three__WEBPACK_IMPORTED_MODULE_2__.ObjectLoader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tthis._nodesJSON = null;\n\n\t}\n\n\tparse( json, onLoad ) {\n\n\t\tthis._nodesJSON = json.nodes;\n\n\t\tconst data = super.parse( json, onLoad );\n\n\t\tthis._nodesJSON = null; // dispose\n\n\t\treturn data;\n\n\t}\n\n\tparseNodes( json, textures ) {\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst loader = new _NodeLoader_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n\t\t\tloader.setTextures( textures );\n\n\t\t\treturn loader.parseNodes( json );\n\n\t\t}\n\n\t\treturn {};\n\n\t}\n\n\tparseMaterials( json, textures ) {\n\n\t\tconst materials = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst nodes = this.parseNodes( this._nodesJSON, textures );\n\n\t\t\tconst loader = new _NodeMaterialLoader_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n\t\t\tloader.setTextures( textures );\n\t\t\tloader.setNodes( nodes );\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tmaterials[ data.uuid ] = loader.parse( data );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn materials;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeObjectLoader);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/loaders/NodeObjectLoader.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n/* harmony import */ var _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../accessors/MaterialNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js\");\n/* harmony import */ var _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../accessors/ModelNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ModelNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../accessors/UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../display/ViewportNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n // or should this be a property, instead?\n\n\n\n\n\n\n\n\n\nconst defaultValues = new three__WEBPACK_IMPORTED_MODULE_12__.PointsMaterial();\n\nclass InstancedPointsNodeMaterial extends _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( params = {} ) {\n\n\t\tsuper();\n\n\t\tthis.normals = false;\n\n\t\tthis.lights = false;\n\n\t\tthis.useAlphaToCoverage = true;\n\n\t\tthis.useColor = params.vertexColors;\n\n\t\tthis.pointWidth = 1;\n\n\t\tthis.pointColorNode = null;\n\n\t\tthis.setDefaultValues( defaultValues );\n\n\t\tthis.setupShaders();\n\n\t\tthis.setValues( params );\n\n\t}\n\n\tsetupShaders() {\n\n\t\tconst useAlphaToCoverage = this.alphaToCoverage;\n\t\tconst useColor = this.useColor;\n\n\t\tthis.vertexNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__.tslFn)( () => {\n\n\t\t\t//vUv = uv;\n\t\t\t(0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_1__.varying)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__.vec2)(), 'vUv' ).assign( (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_10__.uv)() ); // @TODO: Analyze other way to do this\n\n\t\t\tconst instancePosition = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_3__.attribute)( 'instancePosition' );\n\n\t\t\t// camera space\n\t\t\tconst mvPos = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.property)( 'vec4', 'mvPos' );\n\t\t\tmvPos.assign( _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_6__.modelViewMatrix.mul( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__.vec4)( instancePosition, 1.0 ) ) );\n\n\t\t\tconst aspect = _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_11__.viewport.z.div( _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_11__.viewport.w );\n\n\t\t\t// clip space\n\t\t\tconst clipPos = _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_4__.cameraProjectionMatrix.mul( mvPos );\n\n\t\t\t// offset in ndc space\n\t\t\tconst offset = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.property)( 'vec2', 'offset' );\n\t\t\toffset.assign( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_7__.positionGeometry.xy );\n\t\t\toffset.assign( offset.mul( _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_5__.materialPointWidth ) );\n\t\t\toffset.assign( offset.div( _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_11__.viewport.z ) );\n\t\t\toffset.y.assign( offset.y.mul( aspect ) );\n\n\t\t\t// back to clip space\n\t\t\toffset.assign( offset.mul( clipPos.w ) );\n\n\t\t\t//clipPos.xy += offset;\n\t\t\tclipPos.assign( clipPos.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__.vec4)( offset, 0, 0 ) ) );\n\n\t\t\treturn clipPos;\n\n\t\t\t//vec4 mvPosition = mvPos; // this was used for somethihng...\n\n\t\t} )();\n\n\t\tthis.fragmentNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__.tslFn)( () => {\n\n\t\t\tconst vUv = (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_1__.varying)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__.vec2)(), 'vUv' );\n\n\t\t\t// force assignment into correct place in flow\n\t\t\tconst alpha = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.property)( 'float', 'alpha' );\n\t\t\talpha.assign( 1 );\n\n\t\t\tconst a = vUv.x;\n\t\t\tconst b = vUv.y;\n\n\t\t\tconst len2 = a.mul( a ).add( b.mul( b ) );\n\n\t\t\tif ( useAlphaToCoverage ) {\n\n\t\t\t\t// force assignment out of following 'if' statement - to avoid uniform control flow errors\n\t\t\t\tconst dlen = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.property)( 'float', 'dlen' );\n\t\t\t\tdlen.assign( len2.fwidth() );\n\n\t\t\t\talpha.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_8__.smoothstep)( dlen.oneMinus(), dlen.add( 1 ), len2 ).oneMinus() );\n\n\t\t\t} else {\n\n\t\t\t\tlen2.greaterThan( 1.0 ).discard();\n\n\t\t\t}\n\n\t\t\tlet pointColorNode;\n\n\t\t\tif ( this.pointColorNode ) {\n\n\t\t\t\tpointColorNode = this.pointColorNode;\n\n\t\t\t} else {\n\n\t\t\t\tif ( useColor ) {\n\n\t\t\t\t\tconst instanceColor = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_3__.attribute)( 'instanceColor' );\n\n\t\t\t\t\tpointColorNode = instanceColor.mul( _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_5__.materialColor );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tpointColorNode = _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_5__.materialColor;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_9__.vec4)( pointColorNode, alpha );\n\n\t\t} )();\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n\tget alphaToCoverage() {\n\n\t\treturn this.useAlphaToCoverage;\n\n\t}\n\n\tset alphaToCoverage( value ) {\n\n\t\tif ( this.useAlphaToCoverage !== value ) {\n\n\t\t\tthis.useAlphaToCoverage = value;\n\t\t\tthis.setupShaders();\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (InstancedPointsNodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'InstancedPointsNodeMaterial', InstancedPointsNodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/Line2NodeMaterial.js": +/*!******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/Line2NodeMaterial.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _core_VarNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/VarNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VarNode.js\");\n/* harmony import */ var _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../accessors/CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n/* harmony import */ var _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../accessors/MaterialNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js\");\n/* harmony import */ var _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../accessors/ModelNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ModelNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../accessors/UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../display/ViewportNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst defaultValues = new three__WEBPACK_IMPORTED_MODULE_13__.LineDashedMaterial();\n\nclass Line2NodeMaterial extends _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( params = {} ) {\n\n\t\tsuper();\n\n\t\tthis.normals = false;\n\t\tthis.lights = false;\n\n\t\tthis.setDefaultValues( defaultValues );\n\n\t\tthis.useAlphaToCoverage = true;\n\t\tthis.useColor = params.vertexColors;\n\t\tthis.useDash = params.dashed;\n\t\tthis.useWorldUnits = false;\n\n\t\tthis.dashOffset = 0;\n\t\tthis.lineWidth = 1;\n\n\t\tthis.lineColorNode = null;\n\n\t\tthis.offsetNode = null;\n\t\tthis.dashScaleNode = null;\n\t\tthis.dashSizeNode = null;\n\t\tthis.gapSizeNode = null;\n\n\t\tthis.setupShaders();\n\n\t\tthis.setValues( params );\n\n\t}\n\n\tsetupShaders() {\n\n\t\tconst useAlphaToCoverage = this.alphaToCoverage;\n\t\tconst useColor = this.useColor;\n\t\tconst useDash = this.dashed;\n\t\tconst useWorldUnits = this.worldUnits;\n\n\t\tconst trimSegment = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.tslFn)( ( { start, end } ) => {\n\n\t\t\tconst a = _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_5__.cameraProjectionMatrix.element( 2 ).element( 2 ); // 3nd entry in 3th column\n\t\t\tconst b = _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_5__.cameraProjectionMatrix.element( 3 ).element( 2 ); // 3nd entry in 4th column\n\t\t\tconst nearEstimate = b.mul( - 0.5 ).div( a );\n\n\t\t\tconst alpha = nearEstimate.sub( start.z ).div( end.z.sub( start.z ) );\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec4)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_9__.mix)( start.xyz, end.xyz, alpha ), end.w );\n\n\t\t} );\n\n\t\tthis.vertexNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.tslFn)( () => {\n\n\t\t\t(0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.varyingProperty)( 'vec2', 'vUv' ).assign( (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_11__.uv)() );\n\n\t\t\tconst instanceStart = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_4__.attribute)( 'instanceStart' );\n\t\t\tconst instanceEnd = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_4__.attribute)( 'instanceEnd' );\n\n\t\t\t// camera space\n\n\t\t\tconst start = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.property)( 'vec4', 'start' );\n\t\t\tconst end = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.property)( 'vec4', 'end' );\n\n\t\t\tstart.assign( _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_7__.modelViewMatrix.mul( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec4)( instanceStart, 1.0 ) ) ); // force assignment into correct place in flow\n\t\t\tend.assign( _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_7__.modelViewMatrix.mul( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec4)( instanceEnd, 1.0 ) ) );\n\n\t\t\tif ( useWorldUnits ) {\n\n\t\t\t\t(0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.varyingProperty)( 'vec3', 'worldStart' ).assign( start.xyz );\n\t\t\t\t(0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.varyingProperty)( 'vec3', 'worldEnd' ).assign( end.xyz );\n\n\t\t\t}\n\n\t\t\tconst aspect = _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_12__.viewport.z.div( _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_12__.viewport.w );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tconst perspective = _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_5__.cameraProjectionMatrix.element( 2 ).element( 3 ).equal( - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.If)( perspective, () => {\n\n\t\t\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.If)( start.z.lessThan( 0.0 ).and( end.z.greaterThan( 0.0 ) ), () => {\n\n\t\t\t\t\tend.assign( trimSegment( { start: start, end: end } ) );\n\n\t\t\t\t} ).elseif( end.z.lessThan( 0.0 ).and( start.z.greaterThanEqual( 0.0 ) ), () => {\n\n\t\t\t\t\tstart.assign( trimSegment( { start: end, end: start } ) );\n\n\t\t\t \t} );\n\n\t\t\t} );\n\n\t\t\t// clip space\n\t\t\tconst clipStart = _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_5__.cameraProjectionMatrix.mul( start );\n\t\t\tconst clipEnd = _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_5__.cameraProjectionMatrix.mul( end );\n\n\t\t\t// ndc space\n\t\t\tconst ndcStart = clipStart.xyz.div( clipStart.w );\n\t\t\tconst ndcEnd = clipEnd.xyz.div( clipEnd.w );\n\n\t\t\t// direction\n\t\t\tconst dir = ndcEnd.xy.sub( ndcStart.xy ).temp();\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x.assign( dir.x.mul( aspect ) );\n\t\t\tdir.assign( dir.normalize() );\n\n\t\t\tconst clip = (0,_core_VarNode_js__WEBPACK_IMPORTED_MODULE_1__.temp)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec4)() );\n\n\t\t\tif ( useWorldUnits ) {\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\n\t\t\t\tconst worldDir = end.xyz.sub( start.xyz ).normalize();\n\t\t\t\tconst tmpFwd = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_9__.mix)( start.xyz, end.xyz, 0.5 ).normalize();\n\t\t\t\tconst worldUp = worldDir.cross( tmpFwd ).normalize();\n\t\t\t\tconst worldFwd = worldDir.cross( worldUp );\n\n\t\t\t\tconst worldPos = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.varyingProperty)( 'vec4', 'worldPos' );\n\n\t\t\t\tworldPos.assign( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionGeometry.y.lessThan( 0.5 ).cond( start, end) );\n\n\t\t\t\t// height offset\n\t\t\t\tconst hw = _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_6__.materialLineWidth.mul( 0.5 );\n\t\t\t\tworldPos.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec4)( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionGeometry.x.lessThan( 0.0 ).cond( worldUp.mul( hw ), worldUp.mul( hw ).negate() ), 0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\tif ( ! useDash ) {\n\n\t\t\t\t\t// cap extension\n\t\t\t\t\tworldPos.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec4)( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionGeometry.y.lessThan( 0.5 ).cond( worldDir.mul( hw ).negate(), worldDir.mul( hw ) ), 0 ) );\n\n\t\t\t\t\t// add width to the box\n\t\t\t\t\tworldPos.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec4)( worldFwd.mul( hw ), 0 ) );\n\n\t\t\t\t\t// endcaps\n\t\t\t\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.If)( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionGeometry.y.greaterThan( 1.0 ).or( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionGeometry.y.lessThan( 0.0 ) ), () => {\n\n\t\t\t\t\t\tworldPos.subAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec4)( worldFwd.mul( 2.0 ).mul( hw ), 0 ) );\n\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t\t// project the worldpos\n\t\t\t\tclip.assign( _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_5__.cameraProjectionMatrix.mul( worldPos ) );\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tconst clipPose = (0,_core_VarNode_js__WEBPACK_IMPORTED_MODULE_1__.temp)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec3)() );\n\n\t\t\t\tclipPose.assign( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionGeometry.y.lessThan( 0.5 ).cond( ndcStart, ndcEnd ) );\n\t\t\t\tclip.z.assign( clipPose.z.mul( clip.w ) );\n\n\t\t\t} else {\n\n\t\t\t\tconst offset = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.property)( 'vec2', 'offset' );\n\n\t\t\t\toffset.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec2)( dir.y, dir.x.negate() ) );\n\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x.assign( dir.x.div( aspect ) );\n\t\t\t\toffset.x.assign( offset.x.div( aspect ) );\n\n\t\t\t\t// sign flip\n\t\t\t\toffset.assign( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionGeometry.x.lessThan( 0.0 ).cond( offset.negate(), offset ) );\n\n\t\t\t\t// endcaps\n\t\t\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.If)( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionGeometry.y.lessThan( 0.0 ), () => {\n\n\t\t\t\t\toffset.assign( offset.sub( dir ) );\n\n\t\t\t\t} ).elseif( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionGeometry.y.greaterThan( 1.0 ), () => {\n\n\t\t\t\t\toffset.assign( offset.add( dir ) );\n\n\t\t\t\t} );\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset.assign( offset.mul( _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_6__.materialLineWidth ) );\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset.assign( offset.div( _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_12__.viewport.w ) );\n\n\t\t\t\t// select end\n\t\t\t\tclip.assign( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionGeometry.y.lessThan( 0.5 ).cond( clipStart, clipEnd ) );\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset.assign( offset.mul( clip.w ) );\n\n\t\t\t\tclip.assign( clip.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec4)( offset, 0, 0 ) ) );\n\n\t\t\t}\n\n\t\t\treturn clip;\n\n\t\t} )();\n\n\t\tconst closestLineToLine = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.tslFn)( ( { p1, p2, p3, p4 } ) => {\n\n\t\t\tconst p13 = p1.sub( p3 );\n\t\t\tconst p43 = p4.sub( p3 );\n\n\t\t\tconst p21 = p2.sub( p1 );\n\n\t\t\tconst d1343 = p13.dot( p43 );\n\t\t\tconst d4321 = p43.dot( p21 );\n\t\t\tconst d1321 = p13.dot( p21 );\n\t\t\tconst d4343 = p43.dot( p43 );\n\t\t\tconst d2121 = p21.dot( p21 );\n\n\t\t\tconst denom = d2121.mul( d4343 ).sub( d4321.mul( d4321 ) );\n\t\t\tconst numer = d1343.mul( d4321 ).sub( d1321.mul( d4343 ) );\n\n\t\t\tconst mua = numer.div( denom ).clamp();\n\t\t\tconst mub = d1343.add( d4321.mul( mua ) ).div( d4343 ).clamp();\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec2)( mua, mub );\n\n\t\t} );\n\n\t\tthis.fragmentNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.tslFn)( () => {\n\n\t\t\tconst vUv = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.varyingProperty)( 'vec2', 'vUv' );\n\n\t\t\tif ( useDash ) {\n\n\t\t\t\tconst offsetNode = this.offsetNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.float)( this.offsetNodeNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_6__.materialLineDashOffset;\n\t\t\t\tconst dashScaleNode = this.dashScaleNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.float)( this.dashScaleNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_6__.materialLineScale;\n\t\t\t\tconst dashSizeNode = this.dashSizeNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.float)( this.dashSizeNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_6__.materialLineDashSize;\n\t\t\t\tconst gapSizeNode = this.dashSizeNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.float)( this.dashGapNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_6__.materialLineGapSize;\n\n\t\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.dashSize.assign( dashSizeNode );\n\t\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.gapSize.assign( gapSizeNode );\n\n\t\t\t\tconst instanceDistanceStart = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_4__.attribute)( 'instanceDistanceStart' );\n\t\t\t\tconst instanceDistanceEnd = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_4__.attribute)( 'instanceDistanceEnd' );\n\n\t\t\t\tconst lineDistance = _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionGeometry.y.lessThan( 0.5 ).cond( dashScaleNode.mul( instanceDistanceStart ), _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_6__.materialLineScale.mul( instanceDistanceEnd ) );\n\n\t\t\t\tconst vLineDistance = (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__.varying)( lineDistance.add( _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_6__.materialLineDashOffset ) );\n\t\t\t\tconst vLineDistanceOffset = offsetNode ? vLineDistance.add( offsetNode ) : vLineDistance;\n\n\t\t\t\tvUv.y.lessThan( - 1.0 ).or( vUv.y.greaterThan( 1.0 ) ).discard(); // discard endcaps\n\t\t\t\tvLineDistanceOffset.mod( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.dashSize.add( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.gapSize ) ).greaterThan( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.dashSize ).discard(); // todo - FIX\n\n\t\t\t}\n\n\t\t\t // force assignment into correct place in flow\n\t\t\tconst alpha = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.property)( 'float', 'alpha' );\n\t\t\talpha.assign( 1 );\n\n\t\t\tif ( useWorldUnits ) {\n\n\t\t\t\tconst worldStart = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.varyingProperty)( 'vec3', 'worldStart' );\n\t\t\t\tconst worldEnd = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.varyingProperty)( 'vec3', 'worldEnd' );\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tconst rayEnd = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.varyingProperty)( 'vec4', 'worldPos' ).xyz.normalize().mul( 1e5 );\n\t\t\t\tconst lineDir = worldEnd.sub( worldStart );\n\t\t\t\tconst params = closestLineToLine( { p1: worldStart, p2: worldEnd, p3: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec3)( 0.0, 0.0, 0.0 ), p4: rayEnd } );\n\n\t\t\t\tconst p1 = worldStart.add( lineDir.mul( params.x ) );\n\t\t\t\tconst p2 = rayEnd.mul( params.y );\n\t\t\t\tconst delta = p1.sub( p2 );\n\t\t\t\tconst len = delta.length();\n\t\t\t\tconst norm = len.div( _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_6__.materialLineWidth );\n\n\t\t\t\tif ( ! useDash ) {\n\n\t\t\t\t\tif ( useAlphaToCoverage ) {\n\n\t\t\t\t\t\tconst dnorm = norm.fwidth();\n\t\t\t\t\t\talpha.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_9__.smoothstep)( dnorm.negate().add( 0.5 ), dnorm.add( 0.5 ), norm ).oneMinus() );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tnorm.greaterThan( 0.5 ).discard();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// round endcaps\n\n\t\t\t\tif ( useAlphaToCoverage ) {\n\n\t\t\t\t\tconst a = vUv.x;\n\t\t\t\t\tconst b = vUv.y.greaterThan( 0.0 ).cond( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );\n\n\t\t\t\t\tconst len2 = a.mul( a ).add( b.mul( b ) );\n\n\t\t\t\t\t// force assignment out of following 'if' statement - to avoid uniform control flow errors\n\t\t\t\t\tconst dlen = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_3__.property)( 'float', 'dlen' );\n\t\t\t\t\tdlen.assign( len2.fwidth() );\n\n\t\t\t\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.If)( vUv.y.abs().greaterThan( 1.0 ), () => {\n\n\t\t\t\t\t\talpha.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_9__.smoothstep)( dlen.oneMinus(), dlen.add( 1 ), len2 ).oneMinus() );\n\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.If)( vUv.y.abs().greaterThan( 1.0 ), () => {\n\n\t\t\t\t\t\tconst a = vUv.x;\n\t\t\t\t\t\tconst b = vUv.y.greaterThan( 0.0 ).cond( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );\n\t\t\t\t\t\tconst len2 = a.mul( a ).add( b.mul( b ) );\n\n\t\t\t\t\t\tlen2.greaterThan( 1.0 ).discard();\n\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tlet lineColorNode;\n\n\t\t\tif ( this.lineColorNode ) {\n\n\t\t\t\tlineColorNode = this.lineColorNode;\n\n\t\t\t} else {\n\n\t\t\t\tif ( useColor ) {\n\n\t\t\t\t\tconst instanceColorStart = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_4__.attribute)( 'instanceColorStart' );\n\t\t\t\t\tconst instanceColorEnd = (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_4__.attribute)( 'instanceColorEnd' );\n\n\t\t\t\t\tconst instanceColor = _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionGeometry.y.lessThan( 0.5 ).cond( instanceColorStart, instanceColorEnd );\n\n\t\t\t\t\tlineColorNode = instanceColor.mul( _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_6__.materialColor );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tlineColorNode = _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_6__.materialColor;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_10__.vec4)( lineColorNode, alpha );\n\n\t\t} )();\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n\n\tget worldUnits() {\n\n\t\treturn this.useWorldUnits;\n\n\t}\n\n\tset worldUnits( value ) {\n\n\t\tif ( this.useWorldUnits !== value ) {\n\n\t\t\tthis.useWorldUnits = value;\n\t\t\tthis.setupShaders();\n\n\t\t}\n\n\t}\n\n\n\tget dashed() {\n\n\t\treturn this.useDash;\n\n\t}\n\n\tset dashed( value ) {\n\n\t\tif ( this.useDash !== value ) {\n\n\t\t\tthis.useDash = value;\n\t\t\tthis.setupShaders();\n\n\t\t}\n\n\t}\n\n\n\tget alphaToCoverage() {\n\n\t\treturn this.useAlphaToCoverage;\n\n\t}\n\n\tset alphaToCoverage( value ) {\n\n\t\tif ( this.useAlphaToCoverage !== value ) {\n\n\t\t\tthis.useAlphaToCoverage = value;\n\t\t\tthis.setupShaders();\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Line2NodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'Line2NodeMaterial', Line2NodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/Line2NodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/LineBasicNodeMaterial.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/LineBasicNodeMaterial.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\nconst defaultValues = new three__WEBPACK_IMPORTED_MODULE_1__.LineBasicMaterial();\n\nclass LineBasicNodeMaterial extends _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineBasicNodeMaterial = true;\n\n\t\tthis.lights = false;\n\t\tthis.normals = false;\n\n\t\tthis.setDefaultValues( defaultValues );\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LineBasicNodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'LineBasicNodeMaterial', LineBasicNodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/LineBasicNodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/LineDashedNodeMaterial.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/LineDashedNodeMaterial.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var _core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/VaryingNode.js */ \"./node_modules/three/examples/jsm/nodes/core/VaryingNode.js\");\n/* harmony import */ var _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/MaterialNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\nconst defaultValues = new three__WEBPACK_IMPORTED_MODULE_6__.LineDashedMaterial();\n\nclass LineDashedNodeMaterial extends _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineDashedNodeMaterial = true;\n\n\t\tthis.lights = false;\n\t\tthis.normals = false;\n\n\t\tthis.setDefaultValues( defaultValues );\n\n\t\tthis.offsetNode = null;\n\t\tthis.dashScaleNode = null;\n\t\tthis.dashSizeNode = null;\n\t\tthis.gapSizeNode = null;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tsetupVariants() {\n\n\t\tconst offsetNode = this.offsetNode;\n\t\tconst dashScaleNode = this.dashScaleNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( this.dashScaleNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialLineScale;\n\t\tconst dashSizeNode = this.dashSizeNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( this.dashSizeNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialLineDashSize;\n\t\tconst gapSizeNode = this.dashSizeNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( this.dashGapNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialLineGapSize;\n\n\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_4__.dashSize.assign( dashSizeNode );\n\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_4__.gapSize.assign( gapSizeNode );\n\n\t\tconst vLineDistance = (0,_core_VaryingNode_js__WEBPACK_IMPORTED_MODULE_2__.varying)( (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__.attribute)( 'lineDistance' ).mul( dashScaleNode ) );\n\t\tconst vLineDistanceOffset = offsetNode ? vLineDistance.add( offsetNode ) : vLineDistance;\n\n\t\tvLineDistanceOffset.mod( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_4__.dashSize.add( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_4__.gapSize ) ).greaterThan( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_4__.dashSize ).discard();\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LineDashedNodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'LineDashedNodeMaterial', LineDashedNodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/LineDashedNodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/Materials.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/Materials.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InstancedPointsNodeMaterial: () => (/* reexport safe */ _InstancedPointsNodeMaterial_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]),\n/* harmony export */ Line2NodeMaterial: () => (/* reexport safe */ _Line2NodeMaterial_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]),\n/* harmony export */ LineBasicNodeMaterial: () => (/* reexport safe */ _LineBasicNodeMaterial_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]),\n/* harmony export */ LineDashedNodeMaterial: () => (/* reexport safe */ _LineDashedNodeMaterial_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]),\n/* harmony export */ MeshBasicNodeMaterial: () => (/* reexport safe */ _MeshBasicNodeMaterial_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]),\n/* harmony export */ MeshLambertNodeMaterial: () => (/* reexport safe */ _MeshLambertNodeMaterial_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]),\n/* harmony export */ MeshNormalNodeMaterial: () => (/* reexport safe */ _MeshNormalNodeMaterial_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]),\n/* harmony export */ MeshPhongNodeMaterial: () => (/* reexport safe */ _MeshPhongNodeMaterial_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]),\n/* harmony export */ MeshPhysicalNodeMaterial: () => (/* reexport safe */ _MeshPhysicalNodeMaterial_js__WEBPACK_IMPORTED_MODULE_10__[\"default\"]),\n/* harmony export */ MeshSSSNodeMaterial: () => (/* reexport safe */ _MeshSSSNodeMaterial_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"]),\n/* harmony export */ MeshStandardNodeMaterial: () => (/* reexport safe */ _MeshStandardNodeMaterial_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"]),\n/* harmony export */ NodeMaterial: () => (/* reexport safe */ _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]),\n/* harmony export */ PointsNodeMaterial: () => (/* reexport safe */ _PointsNodeMaterial_js__WEBPACK_IMPORTED_MODULE_12__[\"default\"]),\n/* harmony export */ SpriteNodeMaterial: () => (/* reexport safe */ _SpriteNodeMaterial_js__WEBPACK_IMPORTED_MODULE_13__[\"default\"]),\n/* harmony export */ addNodeMaterial: () => (/* reexport safe */ _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial),\n/* harmony export */ createNodeMaterialFromType: () => (/* reexport safe */ _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.createNodeMaterialFromType)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _InstancedPointsNodeMaterial_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./InstancedPointsNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js\");\n/* harmony import */ var _LineBasicNodeMaterial_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LineBasicNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/LineBasicNodeMaterial.js\");\n/* harmony import */ var _LineDashedNodeMaterial_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LineDashedNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/LineDashedNodeMaterial.js\");\n/* harmony import */ var _Line2NodeMaterial_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Line2NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/Line2NodeMaterial.js\");\n/* harmony import */ var _MeshNormalNodeMaterial_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./MeshNormalNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js\");\n/* harmony import */ var _MeshBasicNodeMaterial_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./MeshBasicNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js\");\n/* harmony import */ var _MeshLambertNodeMaterial_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./MeshLambertNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js\");\n/* harmony import */ var _MeshPhongNodeMaterial_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./MeshPhongNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js\");\n/* harmony import */ var _MeshStandardNodeMaterial_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./MeshStandardNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js\");\n/* harmony import */ var _MeshPhysicalNodeMaterial_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./MeshPhysicalNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js\");\n/* harmony import */ var _MeshSSSNodeMaterial_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./MeshSSSNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.js\");\n/* harmony import */ var _PointsNodeMaterial_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./PointsNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/PointsNodeMaterial.js\");\n/* harmony import */ var _SpriteNodeMaterial_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./SpriteNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/SpriteNodeMaterial.js\");\n// @TODO: We can simplify \"export { default as SomeNode, other, exports } from '...'\" to just \"export * from '...'\" if we will use only named exports\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/Materials.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\nconst defaultValues = new three__WEBPACK_IMPORTED_MODULE_1__.MeshBasicMaterial();\n\nclass MeshBasicNodeMaterial extends _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshBasicNodeMaterial = true;\n\n\t\tthis.lights = false;\n\t\t//this.normals = false; @TODO: normals usage by context\n\n\t\tthis.setDefaultValues( defaultValues );\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MeshBasicNodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'MeshBasicNodeMaterial', MeshBasicNodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js": +/*!************************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _functions_PhongLightingModel_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../functions/PhongLightingModel.js */ \"./node_modules/three/examples/jsm/nodes/functions/PhongLightingModel.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\nconst defaultValues = new three__WEBPACK_IMPORTED_MODULE_2__.MeshLambertMaterial();\n\nclass MeshLambertNodeMaterial extends _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshLambertNodeMaterial = true;\n\n\t\tthis.lights = true;\n\n\t\tthis.setDefaultValues( defaultValues );\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tsetupLightingModel( /*builder*/ ) {\n\n\t\treturn new _functions_PhongLightingModel_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]( false ); // ( specular ) -> force lambert\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MeshLambertNodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'MeshLambertNodeMaterial', MeshLambertNodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _utils_PackingNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/PackingNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/PackingNode.js\");\n/* harmony import */ var _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/MaterialNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\nconst defaultValues = new three__WEBPACK_IMPORTED_MODULE_6__.MeshNormalMaterial();\n\nclass MeshNormalNodeMaterial extends _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshNormalNodeMaterial = true;\n\n\t\tthis.colorSpaced = false;\n\n\t\tthis.setDefaultValues( defaultValues );\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tsetupDiffuseColor() {\n\n\t\tconst opacityNode = this.opacityNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( this.opacityNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialOpacity;\n\n\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__.diffuseColor.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.vec4)( (0,_utils_PackingNode_js__WEBPACK_IMPORTED_MODULE_2__.directionToColor)( _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_4__.transformedNormalView ), opacityNode ) );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MeshNormalNodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'MeshNormalNodeMaterial', MeshNormalNodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/MaterialNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _functions_PhongLightingModel_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../functions/PhongLightingModel.js */ \"./node_modules/three/examples/jsm/nodes/functions/PhongLightingModel.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\nconst defaultValues = new three__WEBPACK_IMPORTED_MODULE_5__.MeshPhongMaterial();\n\nclass MeshPhongNodeMaterial extends _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhongNodeMaterial = true;\n\n\t\tthis.lights = true;\n\n\t\tthis.shininessNode = null;\n\t\tthis.specularNode = null;\n\n\t\tthis.setDefaultValues( defaultValues );\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tsetupLightingModel( /*builder*/ ) {\n\n\t\treturn new _functions_PhongLightingModel_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]();\n\n\t}\n\n\tsetupVariants() {\n\n\t\t// SHININESS\n\n\t\tconst shininessNode = ( this.shininessNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.float)( this.shininessNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_2__.materialShininess ).max( 1e-4 ); // to prevent pow( 0.0, 0.0 )\n\n\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__.shininess.assign( shininessNode );\n\n\t\t// SPECULAR COLOR\n\n\t\tconst specularNode = this.specularNode || _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_2__.materialSpecularColor;\n\n\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__.specularColor.assign( specularNode );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.shininessNode = source.shininessNode;\n\t\tthis.specularNode = source.specularNode;\n\n\t\treturn super.copy( source );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MeshPhongNodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'MeshPhongNodeMaterial', MeshPhongNodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js ***! + \*************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/MaterialNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _functions_PhysicalLightingModel_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../functions/PhysicalLightingModel.js */ \"./node_modules/three/examples/jsm/nodes/functions/PhysicalLightingModel.js\");\n/* harmony import */ var _MeshStandardNodeMaterial_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./MeshStandardNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\n\nconst defaultValues = new three__WEBPACK_IMPORTED_MODULE_7__.MeshPhysicalMaterial();\n\nclass MeshPhysicalNodeMaterial extends _MeshStandardNodeMaterial_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"] {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhysicalNodeMaterial = true;\n\n\t\tthis.clearcoatNode = null;\n\t\tthis.clearcoatRoughnessNode = null;\n\t\tthis.clearcoatNormalNode = null;\n\n\t\tthis.sheenNode = null;\n\t\tthis.sheenRoughnessNode = null;\n\n\t\tthis.iridescenceNode = null;\n\t\tthis.iridescenceIORNode = null;\n\t\tthis.iridescenceThicknessNode = null;\n\n\t\tthis.specularIntensityNode = null;\n\t\tthis.specularColorNode = null;\n\n\t\tthis.transmissionNode = null;\n\t\tthis.thicknessNode = null;\n\t\tthis.attenuationDistanceNode = null;\n\t\tthis.attenuationColorNode = null;\n\n\t\tthis.setDefaultValues( defaultValues );\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tget useClearcoat() {\n\n\t\treturn this.clearcoat > 0 || this.clearcoatNode !== null;\n\n\t}\n\n\tget useIridescence() {\n\n\t\treturn this.iridescence > 0 || this.iridescenceNode !== null;\n\n\t}\n\n\tget useSheen() {\n\n\t\treturn this.sheen > 0 || this.sheenNode !== null;\n\n\t}\n\n\tsetupLightingModel( /*builder*/ ) {\n\n\t\treturn new _functions_PhysicalLightingModel_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]( this.useClearcoat, this.useSheen, this.useIridescence );\n\n\t}\n\n\tsetupVariants( builder ) {\n\n\t\tsuper.setupVariants( builder );\n\n\t\t// CLEARCOAT\n\n\t\tif ( this.useClearcoat ) {\n\n\t\t\tconst clearcoatNode = this.clearcoatNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.float)( this.clearcoatNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialClearcoat;\n\t\t\tconst clearcoatRoughnessNode = this.clearcoatRoughnessNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.float)( this.clearcoatRoughnessNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialClearcoatRoughness;\n\n\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.clearcoat.assign( clearcoatNode );\n\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.clearcoatRoughness.assign( clearcoatRoughnessNode );\n\n\t\t}\n\n\t\t// SHEEN\n\n\t\tif ( this.useSheen ) {\n\n\t\t\tconst sheenNode = this.sheenNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec3)( this.sheenNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialSheen;\n\t\t\tconst sheenRoughnessNode = this.sheenRoughnessNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.float)( this.sheenRoughnessNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialSheenRoughness;\n\n\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.sheen.assign( sheenNode );\n\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.sheenRoughness.assign( sheenRoughnessNode );\n\n\t\t}\n\n\t\t// IRIDESCENCE\n\n\t\tif ( this.useIridescence ) {\n\n\t\t\tconst iridescenceNode = this.iridescenceNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.float)( this.iridescenceNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialIridescence;\n\t\t\tconst iridescenceIORNode = this.iridescenceIORNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.float)( this.iridescenceIORNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialIridescenceIOR;\n\t\t\tconst iridescenceThicknessNode = this.iridescenceThicknessNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.float)( this.iridescenceThicknessNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialIridescenceThickness;\n\n\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.iridescence.assign( iridescenceNode );\n\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.iridescenceIOR.assign( iridescenceIORNode );\n\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.iridescenceThickness.assign( iridescenceThicknessNode );\n\n\t\t}\n\n\t}\n\n\tsetupNormal( builder ) {\n\n\t\tsuper.setupNormal( builder );\n\n\t\t// CLEARCOAT NORMAL\n\n\t\tconst clearcoatNormalNode = this.clearcoatNormalNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.vec3)( this.clearcoatNormalNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialClearcoatNormal;\n\n\t\t_accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_1__.transformedClearcoatNormalView.assign( clearcoatNormalNode );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.clearcoatNode = source.clearcoatNode;\n\t\tthis.clearcoatRoughnessNode = source.clearcoatRoughnessNode;\n\t\tthis.clearcoatNormalNode = source.clearcoatNormalNode;\n\n\t\tthis.sheenNode = source.sheenNode;\n\t\tthis.sheenRoughnessNode = source.sheenRoughnessNode;\n\n\t\tthis.iridescenceNode = source.iridescenceNode;\n\t\tthis.iridescenceIORNode = source.iridescenceIORNode;\n\t\tthis.iridescenceThicknessNode = source.iridescenceThicknessNode;\n\n\t\tthis.specularIntensityNode = source.specularIntensityNode;\n\t\tthis.specularColorNode = source.specularColorNode;\n\n\t\tthis.transmissionNode = source.transmissionNode;\n\t\tthis.thicknessNode = source.thicknessNode;\n\t\tthis.attenuationDistanceNode = source.attenuationDistanceNode;\n\t\tthis.attenuationColorNode = source.attenuationColorNode;\n\n\t\treturn super.copy( source );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MeshPhysicalNodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'MeshPhysicalNodeMaterial', MeshPhysicalNodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.js": +/*!********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _functions_PhysicalLightingModel_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../functions/PhysicalLightingModel.js */ \"./node_modules/three/examples/jsm/nodes/functions/PhysicalLightingModel.js\");\n/* harmony import */ var _MeshPhysicalNodeMaterial_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./MeshPhysicalNodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\n\nclass SSSLightingModel extends _functions_PhysicalLightingModel_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"] {\n\n\tconstructor( useClearcoat, useSheen, useIridescence, useSSS ) {\n\n\t\tsuper( useClearcoat, useSheen, useIridescence );\n\n\t\tthis.useSSS = useSSS;\n\n\t}\n\n\tdirect( { lightDirection, lightColor, reflectedLight }, stack, builder ) {\n\n\t\tif ( this.useSSS === true ) {\n\n\t\t\tconst material = builder.material;\n\n\t\t\tconst { thicknessColorNode, thicknessDistortionNode, thicknessAmbientNode, thicknessAttenuationNode, thicknessPowerNode, thicknessScaleNode } = material;\n\n\t\t\tconst scatteringHalf = lightDirection.add( _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_1__.transformedNormalView.mul( thicknessDistortionNode ) ).normalize();\n\t\t\tconst scatteringDot = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_2__.positionViewDirection.dot( scatteringHalf.negate() ).saturate().pow( thicknessPowerNode ).mul( thicknessScaleNode ) );\n\t\t\tconst scatteringIllu = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.vec3)( scatteringDot.add( thicknessAmbientNode ).mul( thicknessColorNode ) );\n\n\t\t\treflectedLight.directDiffuse.addAssign( scatteringIllu.mul( thicknessAttenuationNode.mul( lightColor ) ) );\n\n\t\t}\n\n\t\tsuper.direct( { lightDirection, lightColor, reflectedLight }, stack, builder );\n\n\t}\n\n}\n\nclass MeshSSSNodeMaterial extends _MeshPhysicalNodeMaterial_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"] {\n\n\tconstructor( parameters ) {\n\n\t\tsuper( parameters );\n\n\t\tthis.thicknessColorNode = null;\n\t\tthis.thicknessDistortionNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( 0.1 );\n\t\tthis.thicknessAmbientNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( 0.0 );\n\t\tthis.thicknessAttenuationNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( .1 );\n\t\tthis.thicknessPowerNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( 2.0 );\n\t\tthis.thicknessScaleNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( 10.0 );\n\n\t}\n\n\tget useSSS() {\n\n\t\treturn this.thicknessColorNode !== null;\n\n\t}\n\n\tsetupLightingModel( /*builder*/ ) {\n\n\t\treturn new SSSLightingModel( this.useClearcoat, this.useSheen, this.useIridescence, this.useSSS );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.thicknessColorNode = source.thicknessColorNode;\n\t\tthis.thicknessDistortionNode = source.thicknessDistortionNode;\n\t\tthis.thicknessAmbientNode = source.thicknessAmbientNode;\n\t\tthis.thicknessAttenuationNode = source.thicknessAttenuationNode;\n\t\tthis.thicknessPowerNode = source.thicknessPowerNode;\n\t\tthis.thicknessScaleNode = source.thicknessScaleNode;\n\n\t\treturn super.copy( source );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MeshSSSNodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'MeshSSSNodeMaterial', MeshSSSNodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/MeshSSSNodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js": +/*!*************************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js ***! + \*************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/MaterialNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js\");\n/* harmony import */ var _functions_material_getRoughness_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../functions/material/getRoughness.js */ \"./node_modules/three/examples/jsm/nodes/functions/material/getRoughness.js\");\n/* harmony import */ var _functions_PhysicalLightingModel_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../functions/PhysicalLightingModel.js */ \"./node_modules/three/examples/jsm/nodes/functions/PhysicalLightingModel.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\n\nconst defaultValues = new three__WEBPACK_IMPORTED_MODULE_7__.MeshStandardMaterial();\n\nclass MeshStandardNodeMaterial extends _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshStandardNodeMaterial = true;\n\n\t\tthis.emissiveNode = null;\n\n\t\tthis.metalnessNode = null;\n\t\tthis.roughnessNode = null;\n\n\t\tthis.setDefaultValues( defaultValues );\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tsetupLightingModel( /*builder*/ ) {\n\n\t\treturn new _functions_PhysicalLightingModel_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]();\n\n\t}\n\n\tsetupVariants() {\n\n\t\t// METALNESS\n\n\t\tconst metalnessNode = this.metalnessNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.float)( this.metalnessNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialMetalness;\n\n\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__.metalness.assign( metalnessNode );\n\n\t\t// ROUGHNESS\n\n\t\tlet roughnessNode = this.roughnessNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.float)( this.roughnessNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialRoughness;\n\t\troughnessNode = (0,_functions_material_getRoughness_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"])( { roughness: roughnessNode } );\n\n\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__.roughness.assign( roughnessNode );\n\n\t\t// SPECULAR COLOR\n\n\t\tconst specularColorNode = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.mix)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.vec3)( 0.04 ), _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__.diffuseColor.rgb, metalnessNode );\n\n\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__.specularColor.assign( specularColorNode );\n\n\t\t// DIFFUSE COLOR\n\n\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__.diffuseColor.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.vec4)( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__.diffuseColor.rgb.mul( metalnessNode.oneMinus() ), _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__.diffuseColor.a ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.emissiveNode = source.emissiveNode;\n\n\t\tthis.metalnessNode = source.metalnessNode;\n\t\tthis.roughnessNode = source.roughnessNode;\n\n\t\treturn super.copy( source );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MeshStandardNodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'MeshStandardNodeMaterial', MeshStandardNodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addNodeMaterial: () => (/* binding */ addNodeMaterial),\n/* harmony export */ createNodeMaterialFromType: () => (/* binding */ createNodeMaterialFromType),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/NodeUtils.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeUtils.js\");\n/* harmony import */ var _core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/MaterialNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js\");\n/* harmony import */ var _accessors_ModelViewProjectionNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/ModelViewProjectionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ModelViewProjectionNode.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_InstanceNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../accessors/InstanceNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/InstanceNode.js\");\n/* harmony import */ var _accessors_BatchNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../accessors/BatchNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/BatchNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _accessors_SkinningNode_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../accessors/SkinningNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/SkinningNode.js\");\n/* harmony import */ var _accessors_MorphNode_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../accessors/MorphNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MorphNode.js\");\n/* harmony import */ var _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../accessors/TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _accessors_CubeTextureNode_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../accessors/CubeTextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CubeTextureNode.js\");\n/* harmony import */ var _lighting_LightsNode_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../lighting/LightsNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightsNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _lighting_AONode_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../lighting/AONode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/AONode.js\");\n/* harmony import */ var _lighting_LightingContextNode_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../lighting/LightingContextNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/LightingContextNode.js\");\n/* harmony import */ var _lighting_EnvironmentNode_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../lighting/EnvironmentNode.js */ \"./node_modules/three/examples/jsm/nodes/lighting/EnvironmentNode.js\");\n/* harmony import */ var _display_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../display/ViewportDepthNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportDepthNode.js\");\n/* harmony import */ var _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../accessors/CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n/* harmony import */ var _accessors_ClippingNode_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../accessors/ClippingNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ClippingNode.js\");\n/* harmony import */ var _display_FrontFacingNode_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../display/FrontFacingNode.js */ \"./node_modules/three/examples/jsm/nodes/display/FrontFacingNode.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst NodeMaterials = new Map();\n\nclass NodeMaterial extends three__WEBPACK_IMPORTED_MODULE_23__.ShaderMaterial {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isNodeMaterial = true;\n\n\t\tthis.type = this.constructor.type;\n\n\t\tthis.forceSinglePass = false;\n\n\t\tthis.fog = true;\n\t\tthis.lights = true;\n\t\tthis.normals = true;\n\n\t\tthis.colorSpaced = true;\n\n\t\tthis.lightsNode = null;\n\t\tthis.envNode = null;\n\n\t\tthis.colorNode = null;\n\t\tthis.normalNode = null;\n\t\tthis.opacityNode = null;\n\t\tthis.backdropNode = null;\n\t\tthis.backdropAlphaNode = null;\n\t\tthis.alphaTestNode = null;\n\n\t\tthis.positionNode = null;\n\n\t\tthis.depthNode = null;\n\t\tthis.shadowNode = null;\n\n\t\tthis.outputNode = null;\n\n\t\tthis.fragmentNode = null;\n\t\tthis.vertexNode = null;\n\n\t}\n\n\tcustomProgramCacheKey() {\n\n\t\treturn this.type + (0,_core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_0__.getCacheKey)( this );\n\n\t}\n\n\tbuild( builder ) {\n\n\t\tthis.setup( builder );\n\n\t}\n\n\tsetup( builder ) {\n\n\t\t// < VERTEX STAGE >\n\n\t\tbuilder.addStack();\n\n\t\tbuilder.stack.outputNode = this.vertexNode || this.setupPosition( builder );\n\n\t\tbuilder.addFlow( 'vertex', builder.removeStack() );\n\n\t\t// < FRAGMENT STAGE >\n\n\t\tbuilder.addStack();\n\n\t\tlet resultNode;\n\n\t\tconst clippingNode = this.setupClipping( builder );\n\n\t\tif ( this.fragmentNode === null ) {\n\n\t\t\tif ( this.depthWrite === true ) this.setupDepth( builder );\n\n\t\t\tif ( this.normals === true ) this.setupNormal( builder );\n\n\t\t\tthis.setupDiffuseColor( builder );\n\t\t\tthis.setupVariants( builder );\n\n\t\t\tconst outgoingLightNode = this.setupLighting( builder );\n\n\t\t\tif ( clippingNode !== null ) builder.stack.add( clippingNode );\n\n\t\t\t// force unsigned floats - useful for RenderTargets\n\n\t\t\tconst basicOutput = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_15__.vec4)( outgoingLightNode, _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.diffuseColor.a ).max( 0 );\n\n\t\t\tresultNode = this.setupOutput( builder, basicOutput );\n\n\t\t\t// OUTPUT NODE\n\n\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.output.assign( resultNode );\n\n\t\t\t//\n\n\t\t\tif ( this.outputNode !== null ) resultNode = this.outputNode;\n\n\t\t} else {\n\n\t\t\tresultNode = this.setupOutput( builder, this.fragmentNode );\n\n\t\t}\n\n\t\tbuilder.stack.outputNode = resultNode;\n\n\t\tbuilder.addFlow( 'fragment', builder.removeStack() );\n\n\t}\n\n\tsetupClipping( builder ) {\n\n\t\tconst { globalClippingCount, localClippingCount } = builder.clippingContext;\n\n\t\tlet result = null;\n\n\t\tif ( globalClippingCount || localClippingCount ) {\n\n\t\t\tif ( this.alphaToCoverage ) {\n\n\t\t\t\t// to be added to flow when the color/alpha value has been determined\n\t\t\t\tresult = (0,_accessors_ClippingNode_js__WEBPACK_IMPORTED_MODULE_21__.clippingAlpha)();\n\n\t\t\t} else {\n\n\t\t\t\tbuilder.stack.add( (0,_accessors_ClippingNode_js__WEBPACK_IMPORTED_MODULE_21__.clipping)() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tsetupDepth( builder ) {\n\n\t\tconst { renderer } = builder;\n\n\t\t// Depth\n\n\t\tlet depthNode = this.depthNode;\n\n\t\tif ( depthNode === null && renderer.logarithmicDepthBuffer === true ) {\n\n\t\t\tconst fragDepth = (0,_accessors_ModelViewProjectionNode_js__WEBPACK_IMPORTED_MODULE_4__.modelViewProjection)().w.add( 1 );\n\n\t\t\tdepthNode = fragDepth.log2().mul( _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_20__.cameraLogDepth ).mul( 0.5 );\n\n\t\t}\n\n\t\tif ( depthNode !== null ) {\n\n\t\t\t_display_ViewportDepthNode_js__WEBPACK_IMPORTED_MODULE_19__.depthPixel.assign( depthNode ).append();\n\n\t\t}\n\n\t}\n\n\tsetupPosition( builder ) {\n\n\t\tconst { object } = builder;\n\t\tconst geometry = object.geometry;\n\n\t\tbuilder.addStack();\n\n\t\t// Vertex\n\n\t\tif ( geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color ) {\n\n\t\t\t(0,_accessors_MorphNode_js__WEBPACK_IMPORTED_MODULE_10__.morphReference)( object ).append();\n\n\t\t}\n\n\t\tif ( object.isSkinnedMesh === true ) {\n\n\t\t\t(0,_accessors_SkinningNode_js__WEBPACK_IMPORTED_MODULE_9__.skinningReference)( object ).append();\n\n\t\t}\n\n\t\tif ( object.isBatchedMesh ) {\n\n\t\t\t(0,_accessors_BatchNode_js__WEBPACK_IMPORTED_MODULE_7__.batch)( object ).append();\n\n\t\t}\n\n\t\tif ( ( object.instanceMatrix && object.instanceMatrix.isInstancedBufferAttribute === true ) && builder.isAvailable( 'instance' ) === true ) {\n\n\t\t\t(0,_accessors_InstanceNode_js__WEBPACK_IMPORTED_MODULE_6__.instance)( object ).append();\n\n\t\t}\n\n\t\tif ( this.positionNode !== null ) {\n\n\t\t\t_accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionLocal.assign( this.positionNode );\n\n\t\t}\n\n\t\tconst mvp = (0,_accessors_ModelViewProjectionNode_js__WEBPACK_IMPORTED_MODULE_4__.modelViewProjection)();\n\n\t\tbuilder.context.vertex = builder.removeStack();\n\t\tbuilder.context.mvp = mvp;\n\n\t\treturn mvp;\n\n\t}\n\n\tsetupDiffuseColor( { object, geometry } ) {\n\n\t\tlet colorNode = this.colorNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_15__.vec4)( this.colorNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialColor;\n\n\t\t// VERTEX COLORS\n\n\t\tif ( this.vertexColors === true && geometry.hasAttribute( 'color' ) ) {\n\n\t\t\tcolorNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_15__.vec4)( colorNode.xyz.mul( (0,_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_1__.attribute)( 'color', 'vec3' ) ), colorNode.a );\n\n\t\t}\n\n\t\t// Instanced colors\n\n\t\tif ( object.instanceColor ) {\n\n\t\t\tconst instanceColor = (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.varyingProperty)( 'vec3', 'vInstanceColor' );\n\n\t\t\tcolorNode = instanceColor.mul( colorNode );\n\n\t\t}\n\n\t\t// COLOR\n\n\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.diffuseColor.assign( colorNode );\n\n\t\t// OPACITY\n\n\t\tconst opacityNode = this.opacityNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_15__.float)( this.opacityNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialOpacity;\n\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.diffuseColor.a.assign( _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.diffuseColor.a.mul( opacityNode ) );\n\n\t\t// ALPHA TEST\n\n\t\tif ( this.alphaTestNode !== null || this.alphaTest > 0 ) {\n\n\t\t\tconst alphaTestNode = this.alphaTestNode !== null ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_15__.float)( this.alphaTestNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialAlphaTest;\n\n\t\t\t_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.diffuseColor.a.lessThanEqual( alphaTestNode ).discard();\n\n\t\t}\n\n\t}\n\n\tsetupVariants( /*builder*/ ) {\n\n\t\t// Interface function.\n\n\t}\n\n\tsetupNormal() {\n\n\t\t// NORMAL VIEW\n\n\t\tif ( this.flatShading === true ) {\n\n\t\t\tconst normalNode = _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionView.dFdx().cross( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_8__.positionView.dFdy() ).normalize();\n\n\t\t\t_accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_5__.transformedNormalView.assign( normalNode.mul( _display_FrontFacingNode_js__WEBPACK_IMPORTED_MODULE_22__.faceDirection ) );\n\n\t\t} else {\n\n\t\t\tconst normalNode = this.normalNode ? (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_15__.vec3)( this.normalNode ) : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialNormal;\n\n\t\t\t_accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_5__.transformedNormalView.assign( normalNode.mul( _display_FrontFacingNode_js__WEBPACK_IMPORTED_MODULE_22__.faceDirection ) );\n\n\t\t}\n\n\t}\n\n\tgetEnvNode( builder ) {\n\n\t\tlet node = null;\n\n\t\tif ( this.envNode ) {\n\n\t\t\tnode = this.envNode;\n\n\t\t} else if ( this.envMap ) {\n\n\t\t\tnode = this.envMap.isCubeTexture ? (0,_accessors_CubeTextureNode_js__WEBPACK_IMPORTED_MODULE_12__.cubeTexture)( this.envMap ) : (0,_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_11__.texture)( this.envMap );\n\n\t\t} else if ( builder.environmentNode ) {\n\n\t\t\tnode = builder.environmentNode;\n\n\t\t}\n\n\t\treturn node;\n\n\t}\n\n\tsetupLights( builder ) {\n\n\t\tconst envNode = this.getEnvNode( builder );\n\n\t\t//\n\n\t\tconst materialLightsNode = [];\n\n\t\tif ( envNode ) {\n\n\t\t\tmaterialLightsNode.push( new _lighting_EnvironmentNode_js__WEBPACK_IMPORTED_MODULE_18__[\"default\"]( envNode ) );\n\n\t\t}\n\n\t\tif ( builder.material.aoMap ) {\n\n\t\t\tmaterialLightsNode.push( new _lighting_AONode_js__WEBPACK_IMPORTED_MODULE_16__[\"default\"]( (0,_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_11__.texture)( builder.material.aoMap ) ) );\n\n\t\t}\n\n\t\tlet lightsN = this.lightsNode || builder.lightsNode;\n\n\t\tif ( materialLightsNode.length > 0 ) {\n\n\t\t\tlightsN = (0,_lighting_LightsNode_js__WEBPACK_IMPORTED_MODULE_13__.lightsNode)( [ ...lightsN.lightNodes, ...materialLightsNode ] );\n\n\t\t}\n\n\t\treturn lightsN;\n\n\t}\n\n\tsetupLightingModel( /*builder*/ ) {\n\n\t\t// Interface function.\n\n\t}\n\n\tsetupLighting( builder ) {\n\n\t\tconst { material } = builder;\n\t\tconst { backdropNode, backdropAlphaNode, emissiveNode } = this;\n\n\t\t// OUTGOING LIGHT\n\n\t\tconst lights = this.lights === true || this.lightsNode !== null;\n\n\t\tconst lightsNode = lights ? this.setupLights( builder ) : null;\n\n\t\tlet outgoingLightNode = _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_2__.diffuseColor.rgb;\n\n\t\tif ( lightsNode && lightsNode.hasLight !== false ) {\n\n\t\t\tconst lightingModel = this.setupLightingModel( builder );\n\n\t\t\toutgoingLightNode = (0,_lighting_LightingContextNode_js__WEBPACK_IMPORTED_MODULE_17__.lightingContext)( lightsNode, lightingModel, backdropNode, backdropAlphaNode );\n\n\t\t} else if ( backdropNode !== null ) {\n\n\t\t\toutgoingLightNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_15__.vec3)( backdropAlphaNode !== null ? (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_14__.mix)( outgoingLightNode, backdropNode, backdropAlphaNode ) : backdropNode );\n\n\t\t}\n\n\t\t// EMISSIVE\n\n\t\tif ( ( emissiveNode && emissiveNode.isNode === true ) || ( material.emissive && material.emissive.isColor === true ) ) {\n\n\t\t\toutgoingLightNode = outgoingLightNode.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_15__.vec3)( emissiveNode ? emissiveNode : _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialEmissive ) );\n\n\t\t}\n\n\t\treturn outgoingLightNode;\n\n\t}\n\n\tsetupOutput( builder, outputNode ) {\n\n\t\tconst renderer = builder.renderer;\n\n\t\t// FOG\n\n\t\tif ( this.fog === true ) {\n\n\t\t\tconst fogNode = builder.fogNode;\n\n\t\t\tif ( fogNode ) outputNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_15__.vec4)( fogNode.mix( outputNode.rgb, fogNode.colorNode ), outputNode.a );\n\n\t\t}\n\n\t\t// TONE MAPPING\n\n\t\tconst toneMappingNode = builder.toneMappingNode;\n\n\t\tif ( this.toneMapped === true && toneMappingNode ) {\n\n\t\t\toutputNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_15__.vec4)( toneMappingNode.context( { color: outputNode.rgb } ), outputNode.a );\n\n\t\t}\n\n\t\t// ENCODING\n\n\t\tif ( this.colorSpaced === true ) {\n\n\t\t\tconst outputColorSpace = renderer.currentColorSpace;\n\n\t\t\tif ( outputColorSpace !== three__WEBPACK_IMPORTED_MODULE_23__.LinearSRGBColorSpace && outputColorSpace !== three__WEBPACK_IMPORTED_MODULE_23__.NoColorSpace ) {\n\n\t\t\t\toutputNode = outputNode.linearToColorSpace( outputColorSpace );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn outputNode;\n\n\t}\n\n\tsetDefaultValues( material ) {\n\n\t\t// This approach is to reuse the native refreshUniforms*\n\t\t// and turn available the use of features like transmission and environment in core\n\n\t\tfor ( const property in material ) {\n\n\t\t\tconst value = material[ property ];\n\n\t\t\tif ( this[ property ] === undefined ) {\n\n\t\t\t\tthis[ property ] = value;\n\n\t\t\t\tif ( value && value.clone ) this[ property ] = value.clone();\n\n\t\t\t}\n\n\t\t}\n\n\t\tObject.assign( this.defines, material.defines );\n\n\t\tconst descriptors = Object.getOwnPropertyDescriptors( material.constructor.prototype );\n\n\t\tfor ( const key in descriptors ) {\n\n\t\t\tif ( Object.getOwnPropertyDescriptor( this.constructor.prototype, key ) === undefined &&\n\t\t\t descriptors[ key ].get !== undefined ) {\n\n\t\t\t\tObject.defineProperty( this.constructor.prototype, key, descriptors[ key ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRoot = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( isRoot ) {\n\n\t\t\tmeta = {\n\t\t\t\ttextures: {},\n\t\t\t\timages: {},\n\t\t\t\tnodes: {}\n\t\t\t};\n\n\t\t}\n\n\t\tconst data = three__WEBPACK_IMPORTED_MODULE_23__.Material.prototype.toJSON.call( this, meta );\n\t\tconst nodeChildren = (0,_core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_0__.getNodeChildren)( this );\n\n\t\tdata.inputNodes = {};\n\n\t\tfor ( const { property, childNode } of nodeChildren ) {\n\n\t\t\tdata.inputNodes[ property ] = childNode.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\t// TODO: Copied from Object3D.toJSON\n\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t\tif ( isRoot ) {\n\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\t\t\tconst nodes = extractFromCache( meta.nodes );\n\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\n\t\t\tif ( images.length > 0 ) data.images = images;\n\t\t\tif ( nodes.length > 0 ) data.nodes = nodes;\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.lightsNode = source.lightsNode;\n\t\tthis.envNode = source.envNode;\n\n\t\tthis.colorNode = source.colorNode;\n\t\tthis.normalNode = source.normalNode;\n\t\tthis.opacityNode = source.opacityNode;\n\t\tthis.backdropNode = source.backdropNode;\n\t\tthis.backdropAlphaNode = source.backdropAlphaNode;\n\t\tthis.alphaTestNode = source.alphaTestNode;\n\n\t\tthis.positionNode = source.positionNode;\n\n\t\tthis.depthNode = source.depthNode;\n\t\tthis.shadowNode = source.shadowNode;\n\n\t\tthis.outputNode = source.outputNode;\n\n\t\tthis.fragmentNode = source.fragmentNode;\n\t\tthis.vertexNode = source.vertexNode;\n\n\t\treturn super.copy( source );\n\n\t}\n\n\tstatic fromMaterial( material ) {\n\n\t\tif ( material.isNodeMaterial === true ) { // is already a node material\n\n\t\t\treturn material;\n\n\t\t}\n\n\t\tconst type = material.type.replace( 'Material', 'NodeMaterial' );\n\n\t\tconst nodeMaterial = createNodeMaterialFromType( type );\n\n\t\tif ( nodeMaterial === undefined ) {\n\n\t\t\tthrow new Error( `NodeMaterial: Material \"${ material.type }\" is not compatible.` );\n\n\t\t}\n\n\t\tfor ( const key in material ) {\n\n\t\t\tnodeMaterial[ key ] = material[ key ];\n\n\t\t}\n\n\t\treturn nodeMaterial;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeMaterial);\n\nfunction addNodeMaterial( type, nodeMaterial ) {\n\n\tif ( typeof nodeMaterial !== 'function' || ! type ) throw new Error( `Node material ${ type } is not a class` );\n\tif ( NodeMaterials.has( type ) ) {\n\n\t\tconsole.warn( `Redefinition of node material ${ type }` );\n\t\treturn;\n\n\t}\n\n\tNodeMaterials.set( type, nodeMaterial );\n\tnodeMaterial.type = type;\n\n}\n\nfunction createNodeMaterialFromType( type ) {\n\n\tconst Material = NodeMaterials.get( type );\n\n\tif ( Material !== undefined ) {\n\n\t\treturn new Material();\n\n\t}\n\n}\n\naddNodeMaterial( 'NodeMaterial', NodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/PointsNodeMaterial.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/PointsNodeMaterial.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\nconst defaultValues = new three__WEBPACK_IMPORTED_MODULE_1__.PointsMaterial();\n\nclass PointsNodeMaterial extends _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isPointsNodeMaterial = true;\n\n\t\tthis.lights = false;\n\t\tthis.normals = false;\n\t\tthis.transparent = true;\n\n\t\tthis.sizeNode = null;\n\n\t\tthis.setDefaultValues( defaultValues );\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.sizeNode = source.sizeNode;\n\n\t\treturn super.copy( source );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PointsNodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'PointsNodeMaterial', PointsNodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/PointsNodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materials/SpriteNodeMaterial.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materials/SpriteNodeMaterial.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/CameraNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CameraNode.js\");\n/* harmony import */ var _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/MaterialNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/MaterialNode.js\");\n/* harmony import */ var _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/ModelNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/ModelNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\n\nconst defaultValues = new three__WEBPACK_IMPORTED_MODULE_7__.SpriteMaterial();\n\nclass SpriteNodeMaterial extends _NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isSpriteNodeMaterial = true;\n\n\t\tthis.lights = false;\n\t\tthis.normals = false;\n\n\t\tthis.positionNode = null;\n\t\tthis.rotationNode = null;\n\t\tthis.scaleNode = null;\n\n\t\tthis.setDefaultValues( defaultValues );\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tsetupPosition( { object, context } ) {\n\n\t\t// < VERTEX STAGE >\n\n\t\tconst { positionNode, rotationNode, scaleNode } = this;\n\n\t\tconst vertex = _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_5__.positionLocal;\n\n\t\tlet mvPosition = _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_4__.modelViewMatrix.mul( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.vec3)( positionNode || 0 ) );\n\n\t\tlet scale = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.vec2)( _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_4__.modelWorldMatrix[ 0 ].xyz.length(), _accessors_ModelNode_js__WEBPACK_IMPORTED_MODULE_4__.modelWorldMatrix[ 1 ].xyz.length() );\n\n\t\tif ( scaleNode !== null ) {\n\n\t\t\tscale = scale.mul( scaleNode );\n\n\t\t}\n\n\t\tlet alignedPosition = vertex.xy;\n\n\t\tif ( object.center && object.center.isVector2 === true ) {\n\n\t\t\talignedPosition = alignedPosition.sub( (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_1__.uniform)( object.center ).sub( 0.5 ) );\n\n\t\t}\n\n\t\talignedPosition = alignedPosition.mul( scale );\n\n\t\tconst rotation = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.float)( rotationNode || _accessors_MaterialNode_js__WEBPACK_IMPORTED_MODULE_3__.materialRotation );\n\n\t\tconst rotatedPosition = alignedPosition.rotate( rotation );\n\n\t\tmvPosition = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.vec4)( mvPosition.xy.add( rotatedPosition ), mvPosition.zw );\n\n\t\tconst modelViewProjection = _accessors_CameraNode_js__WEBPACK_IMPORTED_MODULE_2__.cameraProjectionMatrix.mul( mvPosition );\n\n\t\tcontext.vertex = vertex;\n\n\t\treturn modelViewProjection;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.positionNode = source.positionNode;\n\t\tthis.rotationNode = source.rotationNode;\n\t\tthis.scaleNode = source.scaleNode;\n\n\t\treturn super.copy( source );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SpriteNodeMaterial);\n\n(0,_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__.addNodeMaterial)( 'SpriteNodeMaterial', SpriteNodeMaterial );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materials/SpriteNodeMaterial.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materialx/MaterialXNodes.js": +/*!***************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materialx/MaterialXNodes.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ mx_aastep: () => (/* binding */ mx_aastep),\n/* harmony export */ mx_cell_noise_float: () => (/* binding */ mx_cell_noise_float),\n/* harmony export */ mx_contrast: () => (/* binding */ mx_contrast),\n/* harmony export */ mx_fractal_noise_float: () => (/* binding */ mx_fractal_noise_float),\n/* harmony export */ mx_fractal_noise_vec2: () => (/* binding */ mx_fractal_noise_vec2),\n/* harmony export */ mx_fractal_noise_vec3: () => (/* binding */ mx_fractal_noise_vec3),\n/* harmony export */ mx_fractal_noise_vec4: () => (/* binding */ mx_fractal_noise_vec4),\n/* harmony export */ mx_hsvtorgb: () => (/* reexport safe */ _lib_mx_hsv_js__WEBPACK_IMPORTED_MODULE_1__.mx_hsvtorgb),\n/* harmony export */ mx_noise_float: () => (/* binding */ mx_noise_float),\n/* harmony export */ mx_noise_vec3: () => (/* binding */ mx_noise_vec3),\n/* harmony export */ mx_noise_vec4: () => (/* binding */ mx_noise_vec4),\n/* harmony export */ mx_ramplr: () => (/* binding */ mx_ramplr),\n/* harmony export */ mx_ramptb: () => (/* binding */ mx_ramptb),\n/* harmony export */ mx_rgbtohsv: () => (/* reexport safe */ _lib_mx_hsv_js__WEBPACK_IMPORTED_MODULE_1__.mx_rgbtohsv),\n/* harmony export */ mx_safepower: () => (/* binding */ mx_safepower),\n/* harmony export */ mx_splitlr: () => (/* binding */ mx_splitlr),\n/* harmony export */ mx_splittb: () => (/* binding */ mx_splittb),\n/* harmony export */ mx_srgb_texture_to_lin_rec709: () => (/* reexport safe */ _lib_mx_transform_color_js__WEBPACK_IMPORTED_MODULE_2__.mx_srgb_texture_to_lin_rec709),\n/* harmony export */ mx_transform_uv: () => (/* binding */ mx_transform_uv),\n/* harmony export */ mx_worley_noise_float: () => (/* binding */ mx_worley_noise_float),\n/* harmony export */ mx_worley_noise_vec2: () => (/* binding */ mx_worley_noise_vec2),\n/* harmony export */ mx_worley_noise_vec3: () => (/* binding */ mx_worley_noise_vec3)\n/* harmony export */ });\n/* harmony import */ var _lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/mx_noise.js */ \"./node_modules/three/examples/jsm/nodes/materialx/lib/mx_noise.js\");\n/* harmony import */ var _lib_mx_hsv_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/mx_hsv.js */ \"./node_modules/three/examples/jsm/nodes/materialx/lib/mx_hsv.js\");\n/* harmony import */ var _lib_mx_transform_color_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/mx_transform_color.js */ \"./node_modules/three/examples/jsm/nodes/materialx/lib/mx_transform_color.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\n\nconst mx_aastep = ( threshold, value ) => {\n\n\tthreshold = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( threshold );\n\tvalue = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( value );\n\n\tconst afwidth = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.vec2)( value.dFdx(), value.dFdy() ).length().mul( 0.70710678118654757 );\n\n\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.smoothstep)( threshold.sub( afwidth ), threshold.add( afwidth ), value );\n\n};\n\nconst _ramp = ( a, b, uv, p ) => (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.mix)( a, b, uv[ p ].clamp() );\nconst mx_ramplr = ( valuel, valuer, texcoord = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)() ) => _ramp( valuel, valuer, texcoord, 'x' );\nconst mx_ramptb = ( valuet, valueb, texcoord = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)() ) => _ramp( valuet, valueb, texcoord, 'y' );\n\nconst _split = ( a, b, center, uv, p ) => (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.mix)( a, b, mx_aastep( center, uv[ p ] ) );\nconst mx_splitlr = ( valuel, valuer, center, texcoord = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)() ) => _split( valuel, valuer, center, texcoord, 'x' );\nconst mx_splittb = ( valuet, valueb, center, texcoord = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)() ) => _split( valuet, valueb, center, texcoord, 'y' );\n\nconst mx_transform_uv = ( uv_scale = 1, uv_offset = 0, uv_geo = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)() ) => uv_geo.mul( uv_scale ).add( uv_offset );\n\nconst mx_safepower = ( in1, in2 = 1 ) => {\n\n\tin1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( in1 );\n\n\treturn in1.abs().pow( in2 ).mul( in1.sign() );\n\n};\n\nconst mx_contrast = ( input, amount = 1, pivot = .5 ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( input ).sub( pivot ).mul( amount ).add( pivot );\n\nconst mx_noise_float = ( texcoord = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)(), amplitude = 1, pivot = 0 ) => (0,_lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__.mx_perlin_noise_float)( texcoord.convert( 'vec2|vec3' ) ).mul( amplitude ).add( pivot );\n//export const mx_noise_vec2 = ( texcoord = uv(), amplitude = 1, pivot = 0 ) => mx_perlin_noise_vec3( texcoord.convert( 'vec2|vec3' ) ).mul( amplitude ).add( pivot );\nconst mx_noise_vec3 = ( texcoord = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)(), amplitude = 1, pivot = 0 ) => (0,_lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__.mx_perlin_noise_vec3)( texcoord.convert( 'vec2|vec3' ) ).mul( amplitude ).add( pivot );\nconst mx_noise_vec4 = ( texcoord = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)(), amplitude = 1, pivot = 0 ) => {\n\n\ttexcoord = texcoord.convert( 'vec2|vec3' ); // overloading type\n\n\tconst noise_vec4 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.vec4)( (0,_lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__.mx_perlin_noise_vec3)( texcoord ), (0,_lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__.mx_perlin_noise_float)( texcoord.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.vec2)( 19, 73 ) ) ) );\n\n\treturn noise_vec4.mul( amplitude ).add( pivot );\n\n};\n\nconst mx_worley_noise_float = ( texcoord = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)(), jitter = 1 ) => (0,_lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__.mx_worley_noise_float)( texcoord.convert( 'vec2|vec3' ), jitter, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.int)( 1 ) );\nconst mx_worley_noise_vec2 = ( texcoord = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)(), jitter = 1 ) => (0,_lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__.mx_worley_noise_vec2)( texcoord.convert( 'vec2|vec3' ), jitter, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.int)( 1 ) );\nconst mx_worley_noise_vec3 = ( texcoord = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)(), jitter = 1 ) => (0,_lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__.mx_worley_noise_vec3)( texcoord.convert( 'vec2|vec3' ), jitter, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.int)( 1 ) );\n\nconst mx_cell_noise_float = ( texcoord = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)() ) => (0,_lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__.mx_cell_noise_float)( texcoord.convert( 'vec2|vec3' ) );\n\nconst mx_fractal_noise_float = ( position = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)(), octaves = 3, lacunarity = 2, diminish = .5, amplitude = 1 ) => (0,_lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__.mx_fractal_noise_float)( position, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.int)( octaves ), lacunarity, diminish ).mul( amplitude );\nconst mx_fractal_noise_vec2 = ( position = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)(), octaves = 3, lacunarity = 2, diminish = .5, amplitude = 1 ) => (0,_lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__.mx_fractal_noise_vec2)( position, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.int)( octaves ), lacunarity, diminish ).mul( amplitude );\nconst mx_fractal_noise_vec3 = ( position = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)(), octaves = 3, lacunarity = 2, diminish = .5, amplitude = 1 ) => (0,_lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__.mx_fractal_noise_vec3)( position, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.int)( octaves ), lacunarity, diminish ).mul( amplitude );\nconst mx_fractal_noise_vec4 = ( position = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_4__.uv)(), octaves = 3, lacunarity = 2, diminish = .5, amplitude = 1 ) => (0,_lib_mx_noise_js__WEBPACK_IMPORTED_MODULE_0__.mx_fractal_noise_vec4)( position, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.int)( octaves ), lacunarity, diminish ).mul( amplitude );\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materialx/MaterialXNodes.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materialx/lib/mx_hsv.js": +/*!***********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materialx/lib/mx_hsv.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ mx_hsvtorgb: () => (/* binding */ mx_hsvtorgb),\n/* harmony export */ mx_rgbtohsv: () => (/* binding */ mx_rgbtohsv)\n/* harmony export */ });\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n// Three.js Transpiler\n// https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/stdlib/genglsl/lib/mx_hsv.glsl\n\n\n\n\n\nconst mx_hsvtorgb = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ hsv_immutable ] ) => {\n\n\tconst hsv = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( hsv_immutable ).toVar();\n\tconst h = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( hsv.x ).toVar();\n\tconst s = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( hsv.y ).toVar();\n\tconst v = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( hsv.z ).toVar();\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( s.lessThan( 0.0001 ), () => {\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v, v, v );\n\n\t} ).else( () => {\n\n\t\th.assign( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.mul)( 6.0, h.sub( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.floor)( h ) ) ) );\n\t\tconst hi = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.trunc)( h ) ).toVar();\n\t\tconst f = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( h.sub( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( hi ) ) ).toVar();\n\t\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v.mul( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.sub)( 1.0, s ) ) ).toVar();\n\t\tconst q = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v.mul( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.sub)( 1.0, s.mul( f ) ) ) ).toVar();\n\t\tconst t = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v.mul( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.sub)( 1.0, s.mul( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.sub)( 1.0, f ) ) ) ) ).toVar();\n\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( hi.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ) ), () => {\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v, t, p );\n\n\t\t} ).elseif( hi.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), () => {\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( q, v, p );\n\n\t\t} ).elseif( hi.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 2 ) ), () => {\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p, v, t );\n\n\t\t} ).elseif( hi.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 3 ) ), () => {\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p, q, v );\n\n\t\t} ).elseif( hi.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 4 ) ), () => {\n\n\t\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( t, p, v );\n\n\t\t} );\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v, p, q );\n\n\t} );\n\n} );\n\nconst mx_rgbtohsv = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ c_immutable ] ) => {\n\n\tconst c = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( c_immutable ).toVar();\n\tconst r = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( c.x ).toVar();\n\tconst g = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( c.y ).toVar();\n\tconst b = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( c.z ).toVar();\n\tconst mincomp = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.min)( r, (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.min)( g, b ) ) ).toVar();\n\tconst maxcomp = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.max)( r, (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.max)( g, b ) ) ).toVar();\n\tconst delta = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( maxcomp.sub( mincomp ) ).toVar();\n\tconst h = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)().toVar(), s = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)().toVar(), v = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)().toVar();\n\tv.assign( maxcomp );\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( maxcomp.greaterThan( 0.0 ), () => {\n\n\t\ts.assign( delta.div( maxcomp ) );\n\n\t} ).else( () => {\n\n\t\ts.assign( 0.0 );\n\n\t} );\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( s.lessThanEqual( 0.0 ), () => {\n\n\t\th.assign( 0.0 );\n\n\t} ).else( () => {\n\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( r.greaterThanEqual( maxcomp ), () => {\n\n\t\t\th.assign( g.sub( b ).div( delta ) );\n\n\t\t} ).elseif( g.greaterThanEqual( maxcomp ), () => {\n\n\t\t\th.assign( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.add)( 2.0, b.sub( r ).div( delta ) ) );\n\n\t\t} ).else( () => {\n\n\t\t\th.assign( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.add)( 4.0, r.sub( g ).div( delta ) ) );\n\n\t\t} );\n\n\t\th.mulAssign( 1.0 / 6.0 );\n\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( h.lessThan( 0.0 ), () => {\n\n\t\t\th.addAssign( 1.0 );\n\n\t\t} );\n\n\t} );\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( h, s, v );\n\n} );\n\n// layouts\n\nmx_hsvtorgb.setLayout( {\n\tname: 'mx_hsvtorgb',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'hsv', type: 'vec3' }\n\t]\n} );\n\nmx_rgbtohsv.setLayout( {\n\tname: 'mx_rgbtohsv',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'c', type: 'vec3' }\n\t]\n} );\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materialx/lib/mx_hsv.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materialx/lib/mx_noise.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materialx/lib/mx_noise.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ mx_bilerp: () => (/* binding */ mx_bilerp),\n/* harmony export */ mx_bits_to_01: () => (/* binding */ mx_bits_to_01),\n/* harmony export */ mx_bjfinal: () => (/* binding */ mx_bjfinal),\n/* harmony export */ mx_bjmix: () => (/* binding */ mx_bjmix),\n/* harmony export */ mx_cell_noise_float: () => (/* binding */ mx_cell_noise_float),\n/* harmony export */ mx_cell_noise_vec3: () => (/* binding */ mx_cell_noise_vec3),\n/* harmony export */ mx_fade: () => (/* binding */ mx_fade),\n/* harmony export */ mx_floor: () => (/* binding */ mx_floor),\n/* harmony export */ mx_floorfrac: () => (/* binding */ mx_floorfrac),\n/* harmony export */ mx_fractal_noise_float: () => (/* binding */ mx_fractal_noise_float),\n/* harmony export */ mx_fractal_noise_vec2: () => (/* binding */ mx_fractal_noise_vec2),\n/* harmony export */ mx_fractal_noise_vec3: () => (/* binding */ mx_fractal_noise_vec3),\n/* harmony export */ mx_fractal_noise_vec4: () => (/* binding */ mx_fractal_noise_vec4),\n/* harmony export */ mx_gradient_float: () => (/* binding */ mx_gradient_float),\n/* harmony export */ mx_gradient_scale2d: () => (/* binding */ mx_gradient_scale2d),\n/* harmony export */ mx_gradient_scale3d: () => (/* binding */ mx_gradient_scale3d),\n/* harmony export */ mx_gradient_vec3: () => (/* binding */ mx_gradient_vec3),\n/* harmony export */ mx_hash_int: () => (/* binding */ mx_hash_int),\n/* harmony export */ mx_hash_vec3: () => (/* binding */ mx_hash_vec3),\n/* harmony export */ mx_negate_if: () => (/* binding */ mx_negate_if),\n/* harmony export */ mx_perlin_noise_float: () => (/* binding */ mx_perlin_noise_float),\n/* harmony export */ mx_perlin_noise_vec3: () => (/* binding */ mx_perlin_noise_vec3),\n/* harmony export */ mx_rotl32: () => (/* binding */ mx_rotl32),\n/* harmony export */ mx_select: () => (/* binding */ mx_select),\n/* harmony export */ mx_trilerp: () => (/* binding */ mx_trilerp),\n/* harmony export */ mx_worley_distance: () => (/* binding */ mx_worley_distance),\n/* harmony export */ mx_worley_noise_float: () => (/* binding */ mx_worley_noise_float),\n/* harmony export */ mx_worley_noise_vec2: () => (/* binding */ mx_worley_noise_vec2),\n/* harmony export */ mx_worley_noise_vec3: () => (/* binding */ mx_worley_noise_vec3)\n/* harmony export */ });\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _math_CondNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../math/CondNode.js */ \"./node_modules/three/examples/jsm/nodes/math/CondNode.js\");\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/FunctionOverloadingNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/FunctionOverloadingNode.js\");\n/* harmony import */ var _utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/LoopNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/LoopNode.js\");\n// Three.js Transpiler\n// https://raw.githubusercontent.com/AcademySoftwareFoundation/MaterialX/main/libraries/stdlib/genglsl/lib/mx_noise.glsl\n\n\n\n\n\n\n\n\nconst mx_select = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ b_immutable, t_immutable, f_immutable ] ) => {\n\n\tconst f = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( f_immutable ).toVar();\n\tconst t = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( t_immutable ).toVar();\n\tconst b = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.bool)( b_immutable ).toVar();\n\n\treturn (0,_math_CondNode_js__WEBPACK_IMPORTED_MODULE_1__.cond)( b, t, f );\n\n} );\n\nconst mx_negate_if = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ val_immutable, b_immutable ] ) => {\n\n\tconst b = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.bool)( b_immutable ).toVar();\n\tconst val = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( val_immutable ).toVar();\n\n\treturn (0,_math_CondNode_js__WEBPACK_IMPORTED_MODULE_1__.cond)( b, val.negate(), val );\n\n} );\n\nconst mx_floor = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ x_immutable ] ) => {\n\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( x_immutable ).toVar();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.floor)( x ) );\n\n} );\n\nconst mx_floorfrac = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ x_immutable, i ] ) => {\n\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( x_immutable ).toVar();\n\ti.assign( mx_floor( x ) );\n\n\treturn x.sub( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( i ) );\n\n} );\n\nconst mx_bilerp_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => {\n\n\tconst t = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( t_immutable ).toVar();\n\tconst s = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( s_immutable ).toVar();\n\tconst v3 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v3_immutable ).toVar();\n\tconst v2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v2_immutable ).toVar();\n\tconst v1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v1_immutable ).toVar();\n\tconst v0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v0_immutable ).toVar();\n\tconst s1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.sub)( 1.0, s ) ).toVar();\n\n\treturn (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.sub)( 1.0, t ).mul( v0.mul( s1 ).add( v1.mul( s ) ) ).add( t.mul( v2.mul( s1 ).add( v3.mul( s ) ) ) );\n\n} );\n\nconst mx_bilerp_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => {\n\n\tconst t = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( t_immutable ).toVar();\n\tconst s = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( s_immutable ).toVar();\n\tconst v3 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v3_immutable ).toVar();\n\tconst v2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v2_immutable ).toVar();\n\tconst v1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v1_immutable ).toVar();\n\tconst v0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v0_immutable ).toVar();\n\tconst s1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.sub)( 1.0, s ) ).toVar();\n\n\treturn (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.sub)( 1.0, t ).mul( v0.mul( s1 ).add( v1.mul( s ) ) ).add( t.mul( v2.mul( s1 ).add( v3.mul( s ) ) ) );\n\n} );\n\nconst mx_bilerp = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_bilerp_0, mx_bilerp_1 ] );\n\nconst mx_trilerp_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => {\n\n\tconst r = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( r_immutable ).toVar();\n\tconst t = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( t_immutable ).toVar();\n\tconst s = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( s_immutable ).toVar();\n\tconst v7 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v7_immutable ).toVar();\n\tconst v6 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v6_immutable ).toVar();\n\tconst v5 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v5_immutable ).toVar();\n\tconst v4 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v4_immutable ).toVar();\n\tconst v3 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v3_immutable ).toVar();\n\tconst v2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v2_immutable ).toVar();\n\tconst v1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v1_immutable ).toVar();\n\tconst v0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v0_immutable ).toVar();\n\tconst s1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.sub)( 1.0, s ) ).toVar();\n\tconst t1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.sub)( 1.0, t ) ).toVar();\n\tconst r1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.sub)( 1.0, r ) ).toVar();\n\n\treturn r1.mul( t1.mul( v0.mul( s1 ).add( v1.mul( s ) ) ).add( t.mul( v2.mul( s1 ).add( v3.mul( s ) ) ) ) ).add( r.mul( t1.mul( v4.mul( s1 ).add( v5.mul( s ) ) ).add( t.mul( v6.mul( s1 ).add( v7.mul( s ) ) ) ) ) );\n\n} );\n\nconst mx_trilerp_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => {\n\n\tconst r = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( r_immutable ).toVar();\n\tconst t = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( t_immutable ).toVar();\n\tconst s = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( s_immutable ).toVar();\n\tconst v7 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v7_immutable ).toVar();\n\tconst v6 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v6_immutable ).toVar();\n\tconst v5 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v5_immutable ).toVar();\n\tconst v4 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v4_immutable ).toVar();\n\tconst v3 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v3_immutable ).toVar();\n\tconst v2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v2_immutable ).toVar();\n\tconst v1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v1_immutable ).toVar();\n\tconst v0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v0_immutable ).toVar();\n\tconst s1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.sub)( 1.0, s ) ).toVar();\n\tconst t1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.sub)( 1.0, t ) ).toVar();\n\tconst r1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.sub)( 1.0, r ) ).toVar();\n\n\treturn r1.mul( t1.mul( v0.mul( s1 ).add( v1.mul( s ) ) ).add( t.mul( v2.mul( s1 ).add( v3.mul( s ) ) ) ) ).add( r.mul( t1.mul( v4.mul( s1 ).add( v5.mul( s ) ) ).add( t.mul( v6.mul( s1 ).add( v7.mul( s ) ) ) ) ) );\n\n} );\n\nconst mx_trilerp = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_trilerp_0, mx_trilerp_1 ] );\n\nconst mx_gradient_float_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ hash_immutable, x_immutable, y_immutable ] ) => {\n\n\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( y_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( x_immutable ).toVar();\n\tconst hash = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( hash_immutable ).toVar();\n\tconst h = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( hash.bitAnd( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 7 ) ) ).toVar();\n\tconst u = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_select( h.lessThan( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 4 ) ), x, y ) ).toVar();\n\tconst v = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( 2.0, mx_select( h.lessThan( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 4 ) ), y, x ) ) ).toVar();\n\n\treturn mx_negate_if( u, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.bool)( h.bitAnd( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 1 ) ) ) ).add( mx_negate_if( v, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.bool)( h.bitAnd( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 2 ) ) ) ) );\n\n} );\n\nconst mx_gradient_float_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => {\n\n\tconst z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( z_immutable ).toVar();\n\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( y_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( x_immutable ).toVar();\n\tconst hash = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( hash_immutable ).toVar();\n\tconst h = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( hash.bitAnd( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 15 ) ) ).toVar();\n\tconst u = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_select( h.lessThan( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 8 ) ), x, y ) ).toVar();\n\tconst v = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_select( h.lessThan( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 4 ) ), y, mx_select( h.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 12 ) ).or( h.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 14 ) ) ), x, z ) ) ).toVar();\n\n\treturn mx_negate_if( u, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.bool)( h.bitAnd( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 1 ) ) ) ).add( mx_negate_if( v, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.bool)( h.bitAnd( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 2 ) ) ) ) );\n\n} );\n\nconst mx_gradient_float = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_gradient_float_0, mx_gradient_float_1 ] );\n\nconst mx_gradient_vec3_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ hash_immutable, x_immutable, y_immutable ] ) => {\n\n\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( y_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( x_immutable ).toVar();\n\tconst hash = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uvec3)( hash_immutable ).toVar();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_gradient_float( hash.x, x, y ), mx_gradient_float( hash.y, x, y ), mx_gradient_float( hash.z, x, y ) );\n\n} );\n\nconst mx_gradient_vec3_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => {\n\n\tconst z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( z_immutable ).toVar();\n\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( y_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( x_immutable ).toVar();\n\tconst hash = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uvec3)( hash_immutable ).toVar();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_gradient_float( hash.x, x, y, z ), mx_gradient_float( hash.y, x, y, z ), mx_gradient_float( hash.z, x, y, z ) );\n\n} );\n\nconst mx_gradient_vec3 = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_gradient_vec3_0, mx_gradient_vec3_1 ] );\n\nconst mx_gradient_scale2d_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ v_immutable ] ) => {\n\n\tconst v = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v_immutable ).toVar();\n\n\treturn (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( 0.6616, v );\n\n} );\n\nconst mx_gradient_scale3d_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ v_immutable ] ) => {\n\n\tconst v = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( v_immutable ).toVar();\n\n\treturn (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( 0.9820, v );\n\n} );\n\nconst mx_gradient_scale2d_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ v_immutable ] ) => {\n\n\tconst v = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v_immutable ).toVar();\n\n\treturn (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( 0.6616, v );\n\n} );\n\nconst mx_gradient_scale2d = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_gradient_scale2d_0, mx_gradient_scale2d_1 ] );\n\nconst mx_gradient_scale3d_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ v_immutable ] ) => {\n\n\tconst v = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( v_immutable ).toVar();\n\n\treturn (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( 0.9820, v );\n\n} );\n\nconst mx_gradient_scale3d = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_gradient_scale3d_0, mx_gradient_scale3d_1 ] );\n\nconst mx_rotl32 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ x_immutable, k_immutable ] ) => {\n\n\tconst k = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( k_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( x_immutable ).toVar();\n\n\treturn x.shiftLeft( k ).bitOr( x.shiftRight( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 32 ).sub( k ) ) );\n\n} );\n\nconst mx_bjmix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ a, b, c ] ) => {\n\n\ta.subAssign( c );\n\ta.bitXorAssign( mx_rotl32( c, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 4 ) ) );\n\tc.addAssign( b );\n\tb.subAssign( a );\n\tb.bitXorAssign( mx_rotl32( a, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 6 ) ) );\n\ta.addAssign( c );\n\tc.subAssign( b );\n\tc.bitXorAssign( mx_rotl32( b, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 8 ) ) );\n\tb.addAssign( a );\n\ta.subAssign( c );\n\ta.bitXorAssign( mx_rotl32( c, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 16 ) ) );\n\tc.addAssign( b );\n\tb.subAssign( a );\n\tb.bitXorAssign( mx_rotl32( a, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 19 ) ) );\n\ta.addAssign( c );\n\tc.subAssign( b );\n\tc.bitXorAssign( mx_rotl32( b, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 4 ) ) );\n\tb.addAssign( a );\n\n} );\n\nconst mx_bjfinal = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ a_immutable, b_immutable, c_immutable ] ) => {\n\n\tconst c = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( c_immutable ).toVar();\n\tconst b = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( b_immutable ).toVar();\n\tconst a = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( a_immutable ).toVar();\n\tc.bitXorAssign( b );\n\tc.subAssign( mx_rotl32( b, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 14 ) ) );\n\ta.bitXorAssign( c );\n\ta.subAssign( mx_rotl32( c, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 11 ) ) );\n\tb.bitXorAssign( a );\n\tb.subAssign( mx_rotl32( a, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 25 ) ) );\n\tc.bitXorAssign( b );\n\tc.subAssign( mx_rotl32( b, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 16 ) ) );\n\ta.bitXorAssign( c );\n\ta.subAssign( mx_rotl32( c, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 4 ) ) );\n\tb.bitXorAssign( a );\n\tb.subAssign( mx_rotl32( a, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 14 ) ) );\n\tc.bitXorAssign( b );\n\tc.subAssign( mx_rotl32( b, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 24 ) ) );\n\n\treturn c;\n\n} );\n\nconst mx_bits_to_01 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ bits_immutable ] ) => {\n\n\tconst bits = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( bits_immutable ).toVar();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( bits ).div( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0xffffffff ) ) ) );\n\n} );\n\nconst mx_fade = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ t_immutable ] ) => {\n\n\tconst t = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( t_immutable ).toVar();\n\n\treturn t.mul( t.mul( t.mul( t.mul( t.mul( 6.0 ).sub( 15.0 ) ).add( 10.0 ) ) ) );\n\n} );\n\nconst mx_hash_int_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ x_immutable ] ) => {\n\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( x_immutable ).toVar();\n\tconst len = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 1 ) ).toVar();\n\tconst seed = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0xdeadbeef ) ).add( len.shiftLeft( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 2 ) ).add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 13 ) ) ) ).toVar();\n\n\treturn mx_bjfinal( seed.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( x ) ), seed, seed );\n\n} );\n\nconst mx_hash_int_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ x_immutable, y_immutable ] ) => {\n\n\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( y_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( x_immutable ).toVar();\n\tconst len = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 2 ) ).toVar();\n\tconst a = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)().toVar(), b = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)().toVar(), c = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)().toVar();\n\ta.assign( b.assign( c.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0xdeadbeef ) ).add( len.shiftLeft( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 2 ) ).add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 13 ) ) ) ) ) );\n\ta.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( x ) );\n\tb.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( y ) );\n\n\treturn mx_bjfinal( a, b, c );\n\n} );\n\nconst mx_hash_int_2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ x_immutable, y_immutable, z_immutable ] ) => {\n\n\tconst z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( z_immutable ).toVar();\n\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( y_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( x_immutable ).toVar();\n\tconst len = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 3 ) ).toVar();\n\tconst a = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)().toVar(), b = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)().toVar(), c = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)().toVar();\n\ta.assign( b.assign( c.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0xdeadbeef ) ).add( len.shiftLeft( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 2 ) ).add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 13 ) ) ) ) ) );\n\ta.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( x ) );\n\tb.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( y ) );\n\tc.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( z ) );\n\n\treturn mx_bjfinal( a, b, c );\n\n} );\n\nconst mx_hash_int_3 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ x_immutable, y_immutable, z_immutable, xx_immutable ] ) => {\n\n\tconst xx = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( xx_immutable ).toVar();\n\tconst z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( z_immutable ).toVar();\n\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( y_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( x_immutable ).toVar();\n\tconst len = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 4 ) ).toVar();\n\tconst a = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)().toVar(), b = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)().toVar(), c = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)().toVar();\n\ta.assign( b.assign( c.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0xdeadbeef ) ).add( len.shiftLeft( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 2 ) ).add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 13 ) ) ) ) ) );\n\ta.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( x ) );\n\tb.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( y ) );\n\tc.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( z ) );\n\tmx_bjmix( a, b, c );\n\ta.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( xx ) );\n\n\treturn mx_bjfinal( a, b, c );\n\n} );\n\nconst mx_hash_int_4 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ x_immutable, y_immutable, z_immutable, xx_immutable, yy_immutable ] ) => {\n\n\tconst yy = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( yy_immutable ).toVar();\n\tconst xx = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( xx_immutable ).toVar();\n\tconst z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( z_immutable ).toVar();\n\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( y_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( x_immutable ).toVar();\n\tconst len = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 5 ) ).toVar();\n\tconst a = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)().toVar(), b = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)().toVar(), c = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)().toVar();\n\ta.assign( b.assign( c.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0xdeadbeef ) ).add( len.shiftLeft( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 2 ) ).add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( 13 ) ) ) ) ) );\n\ta.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( x ) );\n\tb.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( y ) );\n\tc.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( z ) );\n\tmx_bjmix( a, b, c );\n\ta.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( xx ) );\n\tb.addAssign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( yy ) );\n\n\treturn mx_bjfinal( a, b, c );\n\n} );\n\nconst mx_hash_int = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_hash_int_0, mx_hash_int_1, mx_hash_int_2, mx_hash_int_3, mx_hash_int_4 ] );\n\nconst mx_hash_vec3_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ x_immutable, y_immutable ] ) => {\n\n\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( y_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( x_immutable ).toVar();\n\tconst h = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( mx_hash_int( x, y ) ).toVar();\n\tconst result = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uvec3)().toVar();\n\tresult.x.assign( h.bitAnd( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0xFF ) ) );\n\tresult.y.assign( h.shiftRight( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 8 ) ).bitAnd( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0xFF ) ) );\n\tresult.z.assign( h.shiftRight( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 16 ) ).bitAnd( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0xFF ) ) );\n\n\treturn result;\n\n} );\n\nconst mx_hash_vec3_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ x_immutable, y_immutable, z_immutable ] ) => {\n\n\tconst z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( z_immutable ).toVar();\n\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( y_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( x_immutable ).toVar();\n\tconst h = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uint)( mx_hash_int( x, y, z ) ).toVar();\n\tconst result = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.uvec3)().toVar();\n\tresult.x.assign( h.bitAnd( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0xFF ) ) );\n\tresult.y.assign( h.shiftRight( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 8 ) ).bitAnd( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0xFF ) ) );\n\tresult.z.assign( h.shiftRight( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 16 ) ).bitAnd( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0xFF ) ) );\n\n\treturn result;\n\n} );\n\nconst mx_hash_vec3 = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_hash_vec3_0, mx_hash_vec3_1 ] );\n\nconst mx_perlin_noise_float_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( p_immutable ).toVar();\n\tconst X = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar();\n\tconst fx = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_floorfrac( p.x, X ) ).toVar();\n\tconst fy = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_floorfrac( p.y, Y ) ).toVar();\n\tconst u = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_fade( fx ) ).toVar();\n\tconst v = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_fade( fy ) ).toVar();\n\tconst result = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_bilerp( mx_gradient_float( mx_hash_int( X, Y ), fx, fy ), mx_gradient_float( mx_hash_int( X.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Y ), fx.sub( 1.0 ), fy ), mx_gradient_float( mx_hash_int( X, Y.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), fx, fy.sub( 1.0 ) ), mx_gradient_float( mx_hash_int( X.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Y.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), fx.sub( 1.0 ), fy.sub( 1.0 ) ), u, v ) ).toVar();\n\n\treturn mx_gradient_scale2d( result );\n\n} );\n\nconst mx_perlin_noise_float_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p_immutable ).toVar();\n\tconst X = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar();\n\tconst fx = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_floorfrac( p.x, X ) ).toVar();\n\tconst fy = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_floorfrac( p.y, Y ) ).toVar();\n\tconst fz = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_floorfrac( p.z, Z ) ).toVar();\n\tconst u = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_fade( fx ) ).toVar();\n\tconst v = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_fade( fy ) ).toVar();\n\tconst w = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_fade( fz ) ).toVar();\n\tconst result = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_trilerp( mx_gradient_float( mx_hash_int( X, Y, Z ), fx, fy, fz ), mx_gradient_float( mx_hash_int( X.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Y, Z ), fx.sub( 1.0 ), fy, fz ), mx_gradient_float( mx_hash_int( X, Y.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Z ), fx, fy.sub( 1.0 ), fz ), mx_gradient_float( mx_hash_int( X.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Y.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Z ), fx.sub( 1.0 ), fy.sub( 1.0 ), fz ), mx_gradient_float( mx_hash_int( X, Y, Z.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), fx, fy, fz.sub( 1.0 ) ), mx_gradient_float( mx_hash_int( X.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Y, Z.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), fx.sub( 1.0 ), fy, fz.sub( 1.0 ) ), mx_gradient_float( mx_hash_int( X, Y.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Z.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), fx, fy.sub( 1.0 ), fz.sub( 1.0 ) ), mx_gradient_float( mx_hash_int( X.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Y.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Z.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), fx.sub( 1.0 ), fy.sub( 1.0 ), fz.sub( 1.0 ) ), u, v, w ) ).toVar();\n\n\treturn mx_gradient_scale3d( result );\n\n} );\n\nconst mx_perlin_noise_float = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_perlin_noise_float_0, mx_perlin_noise_float_1 ] );\n\nconst mx_perlin_noise_vec3_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( p_immutable ).toVar();\n\tconst X = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar();\n\tconst fx = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_floorfrac( p.x, X ) ).toVar();\n\tconst fy = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_floorfrac( p.y, Y ) ).toVar();\n\tconst u = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_fade( fx ) ).toVar();\n\tconst v = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_fade( fy ) ).toVar();\n\tconst result = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_bilerp( mx_gradient_vec3( mx_hash_vec3( X, Y ), fx, fy ), mx_gradient_vec3( mx_hash_vec3( X.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Y ), fx.sub( 1.0 ), fy ), mx_gradient_vec3( mx_hash_vec3( X, Y.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), fx, fy.sub( 1.0 ) ), mx_gradient_vec3( mx_hash_vec3( X.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Y.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), fx.sub( 1.0 ), fy.sub( 1.0 ) ), u, v ) ).toVar();\n\n\treturn mx_gradient_scale2d( result );\n\n} );\n\nconst mx_perlin_noise_vec3_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p_immutable ).toVar();\n\tconst X = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar();\n\tconst fx = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_floorfrac( p.x, X ) ).toVar();\n\tconst fy = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_floorfrac( p.y, Y ) ).toVar();\n\tconst fz = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_floorfrac( p.z, Z ) ).toVar();\n\tconst u = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_fade( fx ) ).toVar();\n\tconst v = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_fade( fy ) ).toVar();\n\tconst w = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_fade( fz ) ).toVar();\n\tconst result = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_trilerp( mx_gradient_vec3( mx_hash_vec3( X, Y, Z ), fx, fy, fz ), mx_gradient_vec3( mx_hash_vec3( X.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Y, Z ), fx.sub( 1.0 ), fy, fz ), mx_gradient_vec3( mx_hash_vec3( X, Y.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Z ), fx, fy.sub( 1.0 ), fz ), mx_gradient_vec3( mx_hash_vec3( X.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Y.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Z ), fx.sub( 1.0 ), fy.sub( 1.0 ), fz ), mx_gradient_vec3( mx_hash_vec3( X, Y, Z.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), fx, fy, fz.sub( 1.0 ) ), mx_gradient_vec3( mx_hash_vec3( X.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Y, Z.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), fx.sub( 1.0 ), fy, fz.sub( 1.0 ) ), mx_gradient_vec3( mx_hash_vec3( X, Y.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Z.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), fx, fy.sub( 1.0 ), fz.sub( 1.0 ) ), mx_gradient_vec3( mx_hash_vec3( X.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Y.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ), Z.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), fx.sub( 1.0 ), fy.sub( 1.0 ), fz.sub( 1.0 ) ), u, v, w ) ).toVar();\n\n\treturn mx_gradient_scale3d( result );\n\n} );\n\nconst mx_perlin_noise_vec3 = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_perlin_noise_vec3_0, mx_perlin_noise_vec3_1 ] );\n\nconst mx_cell_noise_float_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( p_immutable ).toVar();\n\tconst ix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p ) ).toVar();\n\n\treturn mx_bits_to_01( mx_hash_int( ix ) );\n\n} );\n\nconst mx_cell_noise_float_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( p_immutable ).toVar();\n\tconst ix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.x ) ).toVar();\n\tconst iy = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.y ) ).toVar();\n\n\treturn mx_bits_to_01( mx_hash_int( ix, iy ) );\n\n} );\n\nconst mx_cell_noise_float_2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p_immutable ).toVar();\n\tconst ix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.x ) ).toVar();\n\tconst iy = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.y ) ).toVar();\n\tconst iz = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.z ) ).toVar();\n\n\treturn mx_bits_to_01( mx_hash_int( ix, iy, iz ) );\n\n} );\n\nconst mx_cell_noise_float_3 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec4)( p_immutable ).toVar();\n\tconst ix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.x ) ).toVar();\n\tconst iy = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.y ) ).toVar();\n\tconst iz = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.z ) ).toVar();\n\tconst iw = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.w ) ).toVar();\n\n\treturn mx_bits_to_01( mx_hash_int( ix, iy, iz, iw ) );\n\n} );\n\nconst mx_cell_noise_float = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_cell_noise_float_0, mx_cell_noise_float_1, mx_cell_noise_float_2, mx_cell_noise_float_3 ] );\n\nconst mx_cell_noise_vec3_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( p_immutable ).toVar();\n\tconst ix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p ) ).toVar();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_bits_to_01( mx_hash_int( ix, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ) ) ), mx_bits_to_01( mx_hash_int( ix, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), mx_bits_to_01( mx_hash_int( ix, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 2 ) ) ) );\n\n} );\n\nconst mx_cell_noise_vec3_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( p_immutable ).toVar();\n\tconst ix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.x ) ).toVar();\n\tconst iy = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.y ) ).toVar();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_bits_to_01( mx_hash_int( ix, iy, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ) ) ), mx_bits_to_01( mx_hash_int( ix, iy, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), mx_bits_to_01( mx_hash_int( ix, iy, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 2 ) ) ) );\n\n} );\n\nconst mx_cell_noise_vec3_2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p_immutable ).toVar();\n\tconst ix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.x ) ).toVar();\n\tconst iy = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.y ) ).toVar();\n\tconst iz = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.z ) ).toVar();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_bits_to_01( mx_hash_int( ix, iy, iz, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ) ) ), mx_bits_to_01( mx_hash_int( ix, iy, iz, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), mx_bits_to_01( mx_hash_int( ix, iy, iz, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 2 ) ) ) );\n\n} );\n\nconst mx_cell_noise_vec3_3 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec4)( p_immutable ).toVar();\n\tconst ix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.x ) ).toVar();\n\tconst iy = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.y ) ).toVar();\n\tconst iz = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.z ) ).toVar();\n\tconst iw = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( mx_floor( p.w ) ).toVar();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_bits_to_01( mx_hash_int( ix, iy, iz, iw, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ) ) ), mx_bits_to_01( mx_hash_int( ix, iy, iz, iw, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ) ) ), mx_bits_to_01( mx_hash_int( ix, iy, iz, iw, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 2 ) ) ) );\n\n} );\n\nconst mx_cell_noise_vec3 = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_cell_noise_vec3_0, mx_cell_noise_vec3_1, mx_cell_noise_vec3_2, mx_cell_noise_vec3_3 ] );\n\nconst mx_fractal_noise_float = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {\n\n\tconst diminish = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( diminish_immutable ).toVar();\n\tconst lacunarity = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( lacunarity_immutable ).toVar();\n\tconst octaves = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( octaves_immutable ).toVar();\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p_immutable ).toVar();\n\tconst result = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 0.0 ).toVar();\n\tconst amplitude = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 1.0 ).toVar();\n\n\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ), end: octaves }, ( { i } ) => {\n\n\t\tresult.addAssign( amplitude.mul( mx_perlin_noise_float( p ) ) );\n\t\tamplitude.mulAssign( diminish );\n\t\tp.mulAssign( lacunarity );\n\n\t} );\n\n\treturn result;\n\n} );\n\nconst mx_fractal_noise_vec3 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {\n\n\tconst diminish = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( diminish_immutable ).toVar();\n\tconst lacunarity = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( lacunarity_immutable ).toVar();\n\tconst octaves = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( octaves_immutable ).toVar();\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p_immutable ).toVar();\n\tconst result = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( 0.0 ).toVar();\n\tconst amplitude = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 1.0 ).toVar();\n\n\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ), end: octaves }, ( { i } ) => {\n\n\t\tresult.addAssign( amplitude.mul( mx_perlin_noise_vec3( p ) ) );\n\t\tamplitude.mulAssign( diminish );\n\t\tp.mulAssign( lacunarity );\n\n\t} );\n\n\treturn result;\n\n} );\n\nconst mx_fractal_noise_vec2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {\n\n\tconst diminish = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( diminish_immutable ).toVar();\n\tconst lacunarity = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( lacunarity_immutable ).toVar();\n\tconst octaves = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( octaves_immutable ).toVar();\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p_immutable ).toVar();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( mx_fractal_noise_float( p, octaves, lacunarity, diminish ), mx_fractal_noise_float( p.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 19 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 193 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 17 ) ) ), octaves, lacunarity, diminish ) );\n\n} );\n\nconst mx_fractal_noise_vec4 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {\n\n\tconst diminish = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( diminish_immutable ).toVar();\n\tconst lacunarity = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( lacunarity_immutable ).toVar();\n\tconst octaves = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( octaves_immutable ).toVar();\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p_immutable ).toVar();\n\tconst c = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_fractal_noise_vec3( p, octaves, lacunarity, diminish ) ).toVar();\n\tconst f = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_fractal_noise_float( p.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 19 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 193 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 17 ) ) ), octaves, lacunarity, diminish ) ).toVar();\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec4)( c, f );\n\n} );\n\nconst mx_worley_distance_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable, x_immutable, y_immutable, xoff_immutable, yoff_immutable, jitter_immutable, metric_immutable ] ) => {\n\n\tconst metric = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( metric_immutable ).toVar();\n\tconst jitter = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( jitter_immutable ).toVar();\n\tconst yoff = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( yoff_immutable ).toVar();\n\tconst xoff = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( xoff_immutable ).toVar();\n\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( y_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( x_immutable ).toVar();\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( p_immutable ).toVar();\n\tconst tmp = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_cell_noise_vec3( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( x.add( xoff ), y.add( yoff ) ) ) ).toVar();\n\tconst off = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( tmp.x, tmp.y ).toVar();\n\toff.subAssign( 0.5 );\n\toff.mulAssign( jitter );\n\toff.addAssign( 0.5 );\n\tconst cellpos = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( x ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( y ) ).add( off ) ).toVar();\n\tconst diff = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( cellpos.sub( p ) ).toVar();\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( metric.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 2 ) ), () => {\n\n\t\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.abs)( diff.x ).add( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.abs)( diff.y ) );\n\n\t} );\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( metric.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 3 ) ), () => {\n\n\t\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.max)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.abs)( diff.x ), (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.abs)( diff.y ) );\n\n\t} );\n\n\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.dot)( diff, diff );\n\n} );\n\nconst mx_worley_distance_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable, x_immutable, y_immutable, z_immutable, xoff_immutable, yoff_immutable, zoff_immutable, jitter_immutable, metric_immutable ] ) => {\n\n\tconst metric = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( metric_immutable ).toVar();\n\tconst jitter = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( jitter_immutable ).toVar();\n\tconst zoff = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( zoff_immutable ).toVar();\n\tconst yoff = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( yoff_immutable ).toVar();\n\tconst xoff = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( xoff_immutable ).toVar();\n\tconst z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( z_immutable ).toVar();\n\tconst y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( y_immutable ).toVar();\n\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( x_immutable ).toVar();\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p_immutable ).toVar();\n\tconst off = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_cell_noise_vec3( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( x.add( xoff ), y.add( yoff ), z.add( zoff ) ) ) ).toVar();\n\toff.subAssign( 0.5 );\n\toff.mulAssign( jitter );\n\toff.addAssign( 0.5 );\n\tconst cellpos = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( x ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( y ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( z ) ).add( off ) ).toVar();\n\tconst diff = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( cellpos.sub( p ) ).toVar();\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( metric.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 2 ) ), () => {\n\n\t\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.abs)( diff.x ).add( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.abs)( diff.y ).add( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.abs)( diff.z ) ) );\n\n\t} );\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( metric.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 3 ) ), () => {\n\n\t\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.max)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.max)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.abs)( diff.x ), (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.abs)( diff.y ) ), (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.abs)( diff.z ) );\n\n\t} );\n\n\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.dot)( diff, diff );\n\n} );\n\nconst mx_worley_distance = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_worley_distance_0, mx_worley_distance_1 ] );\n\nconst mx_worley_noise_float_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {\n\n\tconst metric = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( metric_immutable ).toVar();\n\tconst jitter = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( jitter_immutable ).toVar();\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( p_immutable ).toVar();\n\tconst X = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar();\n\tconst localpos = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();\n\tconst sqdist = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 1e6 ).toVar();\n\n\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {\n\n\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {\n\n\t\t\tconst dist = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();\n\t\t\tsqdist.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.min)( sqdist, dist ) );\n\n\t\t} );\n\n\t} );\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( metric.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ) ), () => {\n\n\t\tsqdist.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.sqrt)( sqdist ) );\n\n\t} );\n\n\treturn sqdist;\n\n} );\n\nconst mx_worley_noise_vec2_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {\n\n\tconst metric = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( metric_immutable ).toVar();\n\tconst jitter = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( jitter_immutable ).toVar();\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( p_immutable ).toVar();\n\tconst X = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar();\n\tconst localpos = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();\n\tconst sqdist = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( 1e6, 1e6 ).toVar();\n\n\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {\n\n\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {\n\n\t\t\tconst dist = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();\n\n\t\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( dist.lessThan( sqdist.x ), () => {\n\n\t\t\t\tsqdist.y.assign( sqdist.x );\n\t\t\t\tsqdist.x.assign( dist );\n\n\t\t\t} ).elseif( dist.lessThan( sqdist.y ), () => {\n\n\t\t\t\tsqdist.y.assign( dist );\n\n\t\t\t} );\n\n\t\t} );\n\n\t} );\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( metric.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ) ), () => {\n\n\t\tsqdist.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.sqrt)( sqdist ) );\n\n\t} );\n\n\treturn sqdist;\n\n} );\n\nconst mx_worley_noise_vec3_0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {\n\n\tconst metric = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( metric_immutable ).toVar();\n\tconst jitter = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( jitter_immutable ).toVar();\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( p_immutable ).toVar();\n\tconst X = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar();\n\tconst localpos = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();\n\tconst sqdist = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( 1e6, 1e6, 1e6 ).toVar();\n\n\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {\n\n\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {\n\n\t\t\tconst dist = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();\n\n\t\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( dist.lessThan( sqdist.x ), () => {\n\n\t\t\t\tsqdist.z.assign( sqdist.y );\n\t\t\t\tsqdist.y.assign( sqdist.x );\n\t\t\t\tsqdist.x.assign( dist );\n\n\t\t\t} ).elseif( dist.lessThan( sqdist.y ), () => {\n\n\t\t\t\tsqdist.z.assign( sqdist.y );\n\t\t\t\tsqdist.y.assign( dist );\n\n\t\t\t} ).elseif( dist.lessThan( sqdist.z ), () => {\n\n\t\t\t\tsqdist.z.assign( dist );\n\n\t\t\t} );\n\n\t\t} );\n\n\t} );\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( metric.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ) ), () => {\n\n\t\tsqdist.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.sqrt)( sqdist ) );\n\n\t} );\n\n\treturn sqdist;\n\n} );\n\nconst mx_worley_noise_float_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {\n\n\tconst metric = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( metric_immutable ).toVar();\n\tconst jitter = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( jitter_immutable ).toVar();\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p_immutable ).toVar();\n\tconst X = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar();\n\tconst localpos = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();\n\tconst sqdist = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 1e6 ).toVar();\n\n\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {\n\n\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {\n\n\t\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {\n\n\t\t\t\tconst dist = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();\n\t\t\t\tsqdist.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.min)( sqdist, dist ) );\n\n\t\t\t} );\n\n\t\t} );\n\n\t} );\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( metric.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ) ), () => {\n\n\t\tsqdist.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.sqrt)( sqdist ) );\n\n\t} );\n\n\treturn sqdist;\n\n} );\n\nconst mx_worley_noise_float = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_worley_noise_float_0, mx_worley_noise_float_1 ] );\n\nconst mx_worley_noise_vec2_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {\n\n\tconst metric = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( metric_immutable ).toVar();\n\tconst jitter = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( jitter_immutable ).toVar();\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p_immutable ).toVar();\n\tconst X = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar();\n\tconst localpos = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();\n\tconst sqdist = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( 1e6, 1e6 ).toVar();\n\n\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {\n\n\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {\n\n\t\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {\n\n\t\t\t\tconst dist = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();\n\n\t\t\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( dist.lessThan( sqdist.x ), () => {\n\n\t\t\t\t\tsqdist.y.assign( sqdist.x );\n\t\t\t\t\tsqdist.x.assign( dist );\n\n\t\t\t\t} ).elseif( dist.lessThan( sqdist.y ), () => {\n\n\t\t\t\t\tsqdist.y.assign( dist );\n\n\t\t\t\t} );\n\n\t\t\t} );\n\n\t\t} );\n\n\t} );\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( metric.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ) ), () => {\n\n\t\tsqdist.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.sqrt)( sqdist ) );\n\n\t} );\n\n\treturn sqdist;\n\n} );\n\nconst mx_worley_noise_vec2 = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_worley_noise_vec2_0, mx_worley_noise_vec2_1 ] );\n\nconst mx_worley_noise_vec3_1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {\n\n\tconst metric = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( metric_immutable ).toVar();\n\tconst jitter = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( jitter_immutable ).toVar();\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( p_immutable ).toVar();\n\tconst X = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Y = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar(), Z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)().toVar();\n\tconst localpos = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();\n\tconst sqdist = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( 1e6, 1e6, 1e6 ).toVar();\n\n\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {\n\n\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {\n\n\t\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_5__.loop)( { start: - 1, end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {\n\n\t\t\t\tconst dist = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();\n\n\t\t\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( dist.lessThan( sqdist.x ), () => {\n\n\t\t\t\t\tsqdist.z.assign( sqdist.y );\n\t\t\t\t\tsqdist.y.assign( sqdist.x );\n\t\t\t\t\tsqdist.x.assign( dist );\n\n\t\t\t\t} ).elseif( dist.lessThan( sqdist.y ), () => {\n\n\t\t\t\t\tsqdist.z.assign( sqdist.y );\n\t\t\t\t\tsqdist.y.assign( dist );\n\n\t\t\t\t} ).elseif( dist.lessThan( sqdist.z ), () => {\n\n\t\t\t\t\tsqdist.z.assign( dist );\n\n\t\t\t\t} );\n\n\t\t\t} );\n\n\t\t} );\n\n\t} );\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( metric.equal( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ) ), () => {\n\n\t\tsqdist.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.sqrt)( sqdist ) );\n\n\t} );\n\n\treturn sqdist;\n\n} );\n\nconst mx_worley_noise_vec3 = (0,_utils_FunctionOverloadingNode_js__WEBPACK_IMPORTED_MODULE_4__.overloadingFn)( [ mx_worley_noise_vec3_0, mx_worley_noise_vec3_1 ] );\n\n// layouts\n\nmx_select.setLayout( {\n\tname: 'mx_select',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'b', type: 'bool' },\n\t\t{ name: 't', type: 'float' },\n\t\t{ name: 'f', type: 'float' }\n\t]\n} );\n\nmx_negate_if.setLayout( {\n\tname: 'mx_negate_if',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'val', type: 'float' },\n\t\t{ name: 'b', type: 'bool' }\n\t]\n} );\n\nmx_floor.setLayout( {\n\tname: 'mx_floor',\n\ttype: 'int',\n\tinputs: [\n\t\t{ name: 'x', type: 'float' }\n\t]\n} );\n\nmx_bilerp_0.setLayout( {\n\tname: 'mx_bilerp_0',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'v0', type: 'float' },\n\t\t{ name: 'v1', type: 'float' },\n\t\t{ name: 'v2', type: 'float' },\n\t\t{ name: 'v3', type: 'float' },\n\t\t{ name: 's', type: 'float' },\n\t\t{ name: 't', type: 'float' }\n\t]\n} );\n\nmx_bilerp_1.setLayout( {\n\tname: 'mx_bilerp_1',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'v0', type: 'vec3' },\n\t\t{ name: 'v1', type: 'vec3' },\n\t\t{ name: 'v2', type: 'vec3' },\n\t\t{ name: 'v3', type: 'vec3' },\n\t\t{ name: 's', type: 'float' },\n\t\t{ name: 't', type: 'float' }\n\t]\n} );\n\nmx_trilerp_0.setLayout( {\n\tname: 'mx_trilerp_0',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'v0', type: 'float' },\n\t\t{ name: 'v1', type: 'float' },\n\t\t{ name: 'v2', type: 'float' },\n\t\t{ name: 'v3', type: 'float' },\n\t\t{ name: 'v4', type: 'float' },\n\t\t{ name: 'v5', type: 'float' },\n\t\t{ name: 'v6', type: 'float' },\n\t\t{ name: 'v7', type: 'float' },\n\t\t{ name: 's', type: 'float' },\n\t\t{ name: 't', type: 'float' },\n\t\t{ name: 'r', type: 'float' }\n\t]\n} );\n\nmx_trilerp_1.setLayout( {\n\tname: 'mx_trilerp_1',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'v0', type: 'vec3' },\n\t\t{ name: 'v1', type: 'vec3' },\n\t\t{ name: 'v2', type: 'vec3' },\n\t\t{ name: 'v3', type: 'vec3' },\n\t\t{ name: 'v4', type: 'vec3' },\n\t\t{ name: 'v5', type: 'vec3' },\n\t\t{ name: 'v6', type: 'vec3' },\n\t\t{ name: 'v7', type: 'vec3' },\n\t\t{ name: 's', type: 'float' },\n\t\t{ name: 't', type: 'float' },\n\t\t{ name: 'r', type: 'float' }\n\t]\n} );\n\nmx_gradient_float_0.setLayout( {\n\tname: 'mx_gradient_float_0',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'hash', type: 'uint' },\n\t\t{ name: 'x', type: 'float' },\n\t\t{ name: 'y', type: 'float' }\n\t]\n} );\n\nmx_gradient_float_1.setLayout( {\n\tname: 'mx_gradient_float_1',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'hash', type: 'uint' },\n\t\t{ name: 'x', type: 'float' },\n\t\t{ name: 'y', type: 'float' },\n\t\t{ name: 'z', type: 'float' }\n\t]\n} );\n\nmx_gradient_vec3_0.setLayout( {\n\tname: 'mx_gradient_vec3_0',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'hash', type: 'uvec3' },\n\t\t{ name: 'x', type: 'float' },\n\t\t{ name: 'y', type: 'float' }\n\t]\n} );\n\nmx_gradient_vec3_1.setLayout( {\n\tname: 'mx_gradient_vec3_1',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'hash', type: 'uvec3' },\n\t\t{ name: 'x', type: 'float' },\n\t\t{ name: 'y', type: 'float' },\n\t\t{ name: 'z', type: 'float' }\n\t]\n} );\n\nmx_gradient_scale2d_0.setLayout( {\n\tname: 'mx_gradient_scale2d_0',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'v', type: 'float' }\n\t]\n} );\n\nmx_gradient_scale3d_0.setLayout( {\n\tname: 'mx_gradient_scale3d_0',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'v', type: 'float' }\n\t]\n} );\n\nmx_gradient_scale2d_1.setLayout( {\n\tname: 'mx_gradient_scale2d_1',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'v', type: 'vec3' }\n\t]\n} );\n\nmx_gradient_scale3d_1.setLayout( {\n\tname: 'mx_gradient_scale3d_1',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'v', type: 'vec3' }\n\t]\n} );\n\nmx_rotl32.setLayout( {\n\tname: 'mx_rotl32',\n\ttype: 'uint',\n\tinputs: [\n\t\t{ name: 'x', type: 'uint' },\n\t\t{ name: 'k', type: 'int' }\n\t]\n} );\n\nmx_bjfinal.setLayout( {\n\tname: 'mx_bjfinal',\n\ttype: 'uint',\n\tinputs: [\n\t\t{ name: 'a', type: 'uint' },\n\t\t{ name: 'b', type: 'uint' },\n\t\t{ name: 'c', type: 'uint' }\n\t]\n} );\n\nmx_bits_to_01.setLayout( {\n\tname: 'mx_bits_to_01',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'bits', type: 'uint' }\n\t]\n} );\n\nmx_fade.setLayout( {\n\tname: 'mx_fade',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 't', type: 'float' }\n\t]\n} );\n\nmx_hash_int_0.setLayout( {\n\tname: 'mx_hash_int_0',\n\ttype: 'uint',\n\tinputs: [\n\t\t{ name: 'x', type: 'int' }\n\t]\n} );\n\nmx_hash_int_1.setLayout( {\n\tname: 'mx_hash_int_1',\n\ttype: 'uint',\n\tinputs: [\n\t\t{ name: 'x', type: 'int' },\n\t\t{ name: 'y', type: 'int' }\n\t]\n} );\n\nmx_hash_int_2.setLayout( {\n\tname: 'mx_hash_int_2',\n\ttype: 'uint',\n\tinputs: [\n\t\t{ name: 'x', type: 'int' },\n\t\t{ name: 'y', type: 'int' },\n\t\t{ name: 'z', type: 'int' }\n\t]\n} );\n\nmx_hash_int_3.setLayout( {\n\tname: 'mx_hash_int_3',\n\ttype: 'uint',\n\tinputs: [\n\t\t{ name: 'x', type: 'int' },\n\t\t{ name: 'y', type: 'int' },\n\t\t{ name: 'z', type: 'int' },\n\t\t{ name: 'xx', type: 'int' }\n\t]\n} );\n\nmx_hash_int_4.setLayout( {\n\tname: 'mx_hash_int_4',\n\ttype: 'uint',\n\tinputs: [\n\t\t{ name: 'x', type: 'int' },\n\t\t{ name: 'y', type: 'int' },\n\t\t{ name: 'z', type: 'int' },\n\t\t{ name: 'xx', type: 'int' },\n\t\t{ name: 'yy', type: 'int' }\n\t]\n} );\n\nmx_hash_vec3_0.setLayout( {\n\tname: 'mx_hash_vec3_0',\n\ttype: 'uvec3',\n\tinputs: [\n\t\t{ name: 'x', type: 'int' },\n\t\t{ name: 'y', type: 'int' }\n\t]\n} );\n\nmx_hash_vec3_1.setLayout( {\n\tname: 'mx_hash_vec3_1',\n\ttype: 'uvec3',\n\tinputs: [\n\t\t{ name: 'x', type: 'int' },\n\t\t{ name: 'y', type: 'int' },\n\t\t{ name: 'z', type: 'int' }\n\t]\n} );\n\nmx_perlin_noise_float_0.setLayout( {\n\tname: 'mx_perlin_noise_float_0',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec2' }\n\t]\n} );\n\nmx_perlin_noise_float_1.setLayout( {\n\tname: 'mx_perlin_noise_float_1',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' }\n\t]\n} );\n\nmx_perlin_noise_vec3_0.setLayout( {\n\tname: 'mx_perlin_noise_vec3_0',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec2' }\n\t]\n} );\n\nmx_perlin_noise_vec3_1.setLayout( {\n\tname: 'mx_perlin_noise_vec3_1',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' }\n\t]\n} );\n\nmx_cell_noise_float_0.setLayout( {\n\tname: 'mx_cell_noise_float_0',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'p', type: 'float' }\n\t]\n} );\n\nmx_cell_noise_float_1.setLayout( {\n\tname: 'mx_cell_noise_float_1',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec2' }\n\t]\n} );\n\nmx_cell_noise_float_2.setLayout( {\n\tname: 'mx_cell_noise_float_2',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' }\n\t]\n} );\n\nmx_cell_noise_float_3.setLayout( {\n\tname: 'mx_cell_noise_float_3',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec4' }\n\t]\n} );\n\nmx_cell_noise_vec3_0.setLayout( {\n\tname: 'mx_cell_noise_vec3_0',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'p', type: 'float' }\n\t]\n} );\n\nmx_cell_noise_vec3_1.setLayout( {\n\tname: 'mx_cell_noise_vec3_1',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec2' }\n\t]\n} );\n\nmx_cell_noise_vec3_2.setLayout( {\n\tname: 'mx_cell_noise_vec3_2',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' }\n\t]\n} );\n\nmx_cell_noise_vec3_3.setLayout( {\n\tname: 'mx_cell_noise_vec3_3',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec4' }\n\t]\n} );\n\nmx_fractal_noise_float.setLayout( {\n\tname: 'mx_fractal_noise_float',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' },\n\t\t{ name: 'octaves', type: 'int' },\n\t\t{ name: 'lacunarity', type: 'float' },\n\t\t{ name: 'diminish', type: 'float' }\n\t]\n} );\n\nmx_fractal_noise_vec3.setLayout( {\n\tname: 'mx_fractal_noise_vec3',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' },\n\t\t{ name: 'octaves', type: 'int' },\n\t\t{ name: 'lacunarity', type: 'float' },\n\t\t{ name: 'diminish', type: 'float' }\n\t]\n} );\n\nmx_fractal_noise_vec2.setLayout( {\n\tname: 'mx_fractal_noise_vec2',\n\ttype: 'vec2',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' },\n\t\t{ name: 'octaves', type: 'int' },\n\t\t{ name: 'lacunarity', type: 'float' },\n\t\t{ name: 'diminish', type: 'float' }\n\t]\n} );\n\nmx_fractal_noise_vec4.setLayout( {\n\tname: 'mx_fractal_noise_vec4',\n\ttype: 'vec4',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' },\n\t\t{ name: 'octaves', type: 'int' },\n\t\t{ name: 'lacunarity', type: 'float' },\n\t\t{ name: 'diminish', type: 'float' }\n\t]\n} );\n\nmx_worley_distance_0.setLayout( {\n\tname: 'mx_worley_distance_0',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec2' },\n\t\t{ name: 'x', type: 'int' },\n\t\t{ name: 'y', type: 'int' },\n\t\t{ name: 'xoff', type: 'int' },\n\t\t{ name: 'yoff', type: 'int' },\n\t\t{ name: 'jitter', type: 'float' },\n\t\t{ name: 'metric', type: 'int' }\n\t]\n} );\n\nmx_worley_distance_1.setLayout( {\n\tname: 'mx_worley_distance_1',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' },\n\t\t{ name: 'x', type: 'int' },\n\t\t{ name: 'y', type: 'int' },\n\t\t{ name: 'z', type: 'int' },\n\t\t{ name: 'xoff', type: 'int' },\n\t\t{ name: 'yoff', type: 'int' },\n\t\t{ name: 'zoff', type: 'int' },\n\t\t{ name: 'jitter', type: 'float' },\n\t\t{ name: 'metric', type: 'int' }\n\t]\n} );\n\nmx_worley_noise_float_0.setLayout( {\n\tname: 'mx_worley_noise_float_0',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec2' },\n\t\t{ name: 'jitter', type: 'float' },\n\t\t{ name: 'metric', type: 'int' }\n\t]\n} );\n\nmx_worley_noise_vec2_0.setLayout( {\n\tname: 'mx_worley_noise_vec2_0',\n\ttype: 'vec2',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec2' },\n\t\t{ name: 'jitter', type: 'float' },\n\t\t{ name: 'metric', type: 'int' }\n\t]\n} );\n\nmx_worley_noise_vec3_0.setLayout( {\n\tname: 'mx_worley_noise_vec3_0',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec2' },\n\t\t{ name: 'jitter', type: 'float' },\n\t\t{ name: 'metric', type: 'int' }\n\t]\n} );\n\nmx_worley_noise_float_1.setLayout( {\n\tname: 'mx_worley_noise_float_1',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' },\n\t\t{ name: 'jitter', type: 'float' },\n\t\t{ name: 'metric', type: 'int' }\n\t]\n} );\n\nmx_worley_noise_vec2_1.setLayout( {\n\tname: 'mx_worley_noise_vec2_1',\n\ttype: 'vec2',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' },\n\t\t{ name: 'jitter', type: 'float' },\n\t\t{ name: 'metric', type: 'int' }\n\t]\n} );\n\nmx_worley_noise_vec3_1.setLayout( {\n\tname: 'mx_worley_noise_vec3_1',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' },\n\t\t{ name: 'jitter', type: 'float' },\n\t\t{ name: 'metric', type: 'int' }\n\t]\n} );\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materialx/lib/mx_noise.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/materialx/lib/mx_transform_color.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/materialx/lib/mx_transform_color.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ mx_srgb_texture_to_lin_rec709: () => (/* binding */ mx_srgb_texture_to_lin_rec709)\n/* harmony export */ });\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n// Three.js Transpiler\n// https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/stdlib/genglsl/lib/mx_transform_color.glsl\n\n\n\n\n\nconst mx_srgb_texture_to_lin_rec709 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ color_immutable ] ) => {\n\n\tconst color = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( color_immutable ).toVar();\n\tconst isAbove = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.bvec3)( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.greaterThan)( color, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( 0.04045 ) ) ).toVar();\n\tconst linSeg = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( color.div( 12.92 ) ).toVar();\n\tconst powSeg = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.pow)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.max)( color.add( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( 0.055 ) ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( 0.0 ) ).div( 1.055 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( 2.4 ) ) ).toVar();\n\n\treturn (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.mix)( linSeg, powSeg, isAbove );\n\n} );\n\n// layouts\n\nmx_srgb_texture_to_lin_rec709.setLayout( {\n\tname: 'mx_srgb_texture_to_lin_rec709',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'color', type: 'vec3' }\n\t]\n} );\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/materialx/lib/mx_transform_color.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/math/CondNode.js": +/*!****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/math/CondNode.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cond: () => (/* binding */ cond),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/PropertyNode.js */ \"./node_modules/three/examples/jsm/nodes/core/PropertyNode.js\");\n/* harmony import */ var _core_ContextNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/ContextNode.js */ \"./node_modules/three/examples/jsm/nodes/core/ContextNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\nclass CondNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( condNode, ifNode, elseNode = null ) {\n\n\t\tsuper();\n\n\t\tthis.condNode = condNode;\n\n\t\tthis.ifNode = ifNode;\n\t\tthis.elseNode = elseNode;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\tconst ifType = this.ifNode.getNodeType( builder );\n\n\t\tif ( this.elseNode !== null ) {\n\n\t\t\tconst elseType = this.elseNode.getNodeType( builder );\n\n\t\t\tif ( builder.getTypeLength( elseType ) > builder.getTypeLength( ifType ) ) {\n\n\t\t\t\treturn elseType;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn ifType;\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst type = this.getNodeType( builder );\n\t\tconst context = { tempWrite: false };\n\n\t\tconst nodeData = builder.getDataFromNode( this );\n\n\t\tif ( nodeData.nodeProperty !== undefined ) {\n\n\t\t\treturn nodeData.nodeProperty;\n\n\t\t}\n\n\t\tconst { ifNode, elseNode } = this;\n\n\t\tconst needsOutput = output !== 'void';\n\t\tconst nodeProperty = needsOutput ? (0,_core_PropertyNode_js__WEBPACK_IMPORTED_MODULE_1__.property)( type ).build( builder ) : '';\n\n\t\tnodeData.nodeProperty = nodeProperty;\n\n\t\tconst nodeSnippet = (0,_core_ContextNode_js__WEBPACK_IMPORTED_MODULE_2__.context)( this.condNode/*, context*/ ).build( builder, 'bool' );\n\n\t\tbuilder.addFlowCode( `\\n${ builder.tab }if ( ${ nodeSnippet } ) {\\n\\n` ).addFlowTab();\n\n\t\tlet ifSnippet = (0,_core_ContextNode_js__WEBPACK_IMPORTED_MODULE_2__.context)( ifNode, context ).build( builder, type );\n\n\t\tif ( ifSnippet ) {\n\n\t\t\tif ( needsOutput ) {\n\n\t\t\t\tifSnippet = nodeProperty + ' = ' + ifSnippet + ';';\n\n\t\t\t} else {\n\n\t\t\t\tifSnippet = 'return ' + ifSnippet + ';';\n\n\t\t\t}\n\n\t\t}\n\n\t\tbuilder.removeFlowTab().addFlowCode( builder.tab + '\\t' + ifSnippet + '\\n\\n' + builder.tab + '}' );\n\n\t\tif ( elseNode !== null ) {\n\n\t\t\tbuilder.addFlowCode( ' else {\\n\\n' ).addFlowTab();\n\n\t\t\tlet elseSnippet = (0,_core_ContextNode_js__WEBPACK_IMPORTED_MODULE_2__.context)( elseNode, context ).build( builder, type );\n\n\t\t\tif ( elseSnippet ) {\n\n\t\t\t\tif ( needsOutput ) {\n\n\t\t\t\t\telseSnippet = nodeProperty + ' = ' + elseSnippet + ';';\n\n\t\t\t\t} else {\n\n\t\t\t\t\telseSnippet = 'return ' + elseSnippet + ';';\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tbuilder.removeFlowTab().addFlowCode( builder.tab + '\\t' + elseSnippet + '\\n\\n' + builder.tab + '}\\n\\n' );\n\n\t\t} else {\n\n\t\t\tbuilder.addFlowCode( '\\n\\n' );\n\n\t\t}\n\n\t\treturn builder.format( nodeProperty, type, output );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CondNode);\n\nconst cond = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( CondNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'cond', cond );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'CondNode', CondNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/math/CondNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/math/HashNode.js": +/*!****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/math/HashNode.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ hash: () => (/* binding */ hash)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nclass HashNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( seedNode ) {\n\n\t\tsuper();\n\n\t\tthis.seedNode = seedNode;\n\n\t}\n\n\tsetup( /*builder*/ ) {\n\n\t\t// Taken from https://www.shadertoy.com/view/XlGcRh, originally from pcg-random.org\n\n\t\tconst state = this.seedNode.uint().mul( 747796405 ).add( 2891336453 );\n\t\tconst word = state.shiftRight( state.shiftRight( 28 ).add( 4 ) ).bitXor( state ).mul( 277803737 );\n\t\tconst result = word.shiftRight( 22 ).bitXor( word );\n\n\t\treturn result.float().mul( 1 / 2 ** 32 ); // Convert to range [0, 1)\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (HashNode);\n\nconst hash = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( HashNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'hash', hash );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'HashNode', HashNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/math/HashNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/math/MathNode.js": +/*!****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/math/MathNode.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EPSILON: () => (/* binding */ EPSILON),\n/* harmony export */ INFINITY: () => (/* binding */ INFINITY),\n/* harmony export */ PI: () => (/* binding */ PI),\n/* harmony export */ PI2: () => (/* binding */ PI2),\n/* harmony export */ abs: () => (/* binding */ abs),\n/* harmony export */ acos: () => (/* binding */ acos),\n/* harmony export */ all: () => (/* binding */ all),\n/* harmony export */ any: () => (/* binding */ any),\n/* harmony export */ asin: () => (/* binding */ asin),\n/* harmony export */ atan: () => (/* binding */ atan),\n/* harmony export */ atan2: () => (/* binding */ atan2),\n/* harmony export */ bitcast: () => (/* binding */ bitcast),\n/* harmony export */ cbrt: () => (/* binding */ cbrt),\n/* harmony export */ ceil: () => (/* binding */ ceil),\n/* harmony export */ clamp: () => (/* binding */ clamp),\n/* harmony export */ cos: () => (/* binding */ cos),\n/* harmony export */ cross: () => (/* binding */ cross),\n/* harmony export */ dFdx: () => (/* binding */ dFdx),\n/* harmony export */ dFdy: () => (/* binding */ dFdy),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ degrees: () => (/* binding */ degrees),\n/* harmony export */ difference: () => (/* binding */ difference),\n/* harmony export */ distance: () => (/* binding */ distance),\n/* harmony export */ dot: () => (/* binding */ dot),\n/* harmony export */ equals: () => (/* binding */ equals),\n/* harmony export */ exp: () => (/* binding */ exp),\n/* harmony export */ exp2: () => (/* binding */ exp2),\n/* harmony export */ faceForward: () => (/* binding */ faceForward),\n/* harmony export */ floor: () => (/* binding */ floor),\n/* harmony export */ fract: () => (/* binding */ fract),\n/* harmony export */ fwidth: () => (/* binding */ fwidth),\n/* harmony export */ inverseSqrt: () => (/* binding */ inverseSqrt),\n/* harmony export */ length: () => (/* binding */ length),\n/* harmony export */ lengthSq: () => (/* binding */ lengthSq),\n/* harmony export */ log: () => (/* binding */ log),\n/* harmony export */ log2: () => (/* binding */ log2),\n/* harmony export */ max: () => (/* binding */ max),\n/* harmony export */ min: () => (/* binding */ min),\n/* harmony export */ mix: () => (/* binding */ mix),\n/* harmony export */ mixElement: () => (/* binding */ mixElement),\n/* harmony export */ mod: () => (/* binding */ mod),\n/* harmony export */ negate: () => (/* binding */ negate),\n/* harmony export */ normalize: () => (/* binding */ normalize),\n/* harmony export */ oneMinus: () => (/* binding */ oneMinus),\n/* harmony export */ pow: () => (/* binding */ pow),\n/* harmony export */ pow2: () => (/* binding */ pow2),\n/* harmony export */ pow3: () => (/* binding */ pow3),\n/* harmony export */ pow4: () => (/* binding */ pow4),\n/* harmony export */ radians: () => (/* binding */ radians),\n/* harmony export */ reciprocal: () => (/* binding */ reciprocal),\n/* harmony export */ reflect: () => (/* binding */ reflect),\n/* harmony export */ refract: () => (/* binding */ refract),\n/* harmony export */ round: () => (/* binding */ round),\n/* harmony export */ saturate: () => (/* binding */ saturate),\n/* harmony export */ sign: () => (/* binding */ sign),\n/* harmony export */ sin: () => (/* binding */ sin),\n/* harmony export */ smoothstep: () => (/* binding */ smoothstep),\n/* harmony export */ smoothstepElement: () => (/* binding */ smoothstepElement),\n/* harmony export */ sqrt: () => (/* binding */ sqrt),\n/* harmony export */ step: () => (/* binding */ step),\n/* harmony export */ tan: () => (/* binding */ tan),\n/* harmony export */ transformDirection: () => (/* binding */ transformDirection),\n/* harmony export */ trunc: () => (/* binding */ trunc)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\nclass MathNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( method, aNode, bNode = null, cNode = null ) {\n\n\t\tsuper();\n\n\t\tthis.method = method;\n\n\t\tthis.aNode = aNode;\n\t\tthis.bNode = bNode;\n\t\tthis.cNode = cNode;\n\n\t}\n\n\tgetInputType( builder ) {\n\n\t\tconst aType = this.aNode.getNodeType( builder );\n\t\tconst bType = this.bNode ? this.bNode.getNodeType( builder ) : null;\n\t\tconst cType = this.cNode ? this.cNode.getNodeType( builder ) : null;\n\n\t\tconst aLen = builder.isMatrix( aType ) ? 0 : builder.getTypeLength( aType );\n\t\tconst bLen = builder.isMatrix( bType ) ? 0 : builder.getTypeLength( bType );\n\t\tconst cLen = builder.isMatrix( cType ) ? 0 : builder.getTypeLength( cType );\n\n\t\tif ( aLen > bLen && aLen > cLen ) {\n\n\t\t\treturn aType;\n\n\t\t} else if ( bLen > cLen ) {\n\n\t\t\treturn bType;\n\n\t\t} else if ( cLen > aLen ) {\n\n\t\t\treturn cType;\n\n\t\t}\n\n\t\treturn aType;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\tconst method = this.method;\n\n\t\tif ( method === MathNode.LENGTH || method === MathNode.DISTANCE || method === MathNode.DOT ) {\n\n\t\t\treturn 'float';\n\n\t\t} else if ( method === MathNode.CROSS ) {\n\n\t\t\treturn 'vec3';\n\n\t\t} else if ( method === MathNode.ALL ) {\n\n\t\t\treturn 'bool';\n\n\t\t} else if ( method === MathNode.EQUALS ) {\n\n\t\t\treturn builder.changeComponentType( this.aNode.getNodeType( builder ), 'bool' );\n\n\t\t} else if ( method === MathNode.MOD ) {\n\n\t\t\treturn this.aNode.getNodeType( builder );\n\n\t\t} else {\n\n\t\t\treturn this.getInputType( builder );\n\n\t\t}\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst method = this.method;\n\n\t\tconst type = this.getNodeType( builder );\n\t\tconst inputType = this.getInputType( builder );\n\n\t\tconst a = this.aNode;\n\t\tconst b = this.bNode;\n\t\tconst c = this.cNode;\n\n\t\tconst isWebGL = builder.renderer.isWebGLRenderer === true;\n\n\t\tif ( method === MathNode.TRANSFORM_DIRECTION ) {\n\n\t\t\t// dir can be either a direction vector or a normal vector\n\t\t\t// upper-left 3x3 of matrix is assumed to be orthogonal\n\n\t\t\tlet tA = a;\n\t\t\tlet tB = b;\n\n\t\t\tif ( builder.isMatrix( tA.getNodeType( builder ) ) ) {\n\n\t\t\t\ttB = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec4)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec3)( tB ), 0.0 );\n\n\t\t\t} else {\n\n\t\t\t\ttA = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec4)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec3)( tA ), 0.0 );\n\n\t\t\t}\n\n\t\t\tconst mulNode = (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.mul)( tA, tB ).xyz;\n\n\t\t\treturn normalize( mulNode ).build( builder, output );\n\n\t\t} else if ( method === MathNode.NEGATE ) {\n\n\t\t\treturn builder.format( '( - ' + a.build( builder, inputType ) + ' )', type, output );\n\n\t\t} else if ( method === MathNode.ONE_MINUS ) {\n\n\t\t\treturn (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.sub)( 1.0, a ).build( builder, output );\n\n\t\t} else if ( method === MathNode.RECIPROCAL ) {\n\n\t\t\treturn (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.div)( 1.0, a ).build( builder, output );\n\n\t\t} else if ( method === MathNode.DIFFERENCE ) {\n\n\t\t\treturn abs( (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.sub)( a, b ) ).build( builder, output );\n\n\t\t} else {\n\n\t\t\tconst params = [];\n\n\t\t\tif ( method === MathNode.CROSS || method === MathNode.MOD ) {\n\n\t\t\t\tparams.push(\n\t\t\t\t\ta.build( builder, type ),\n\t\t\t\t\tb.build( builder, type )\n\t\t\t\t);\n\n\t\t\t} else if ( method === MathNode.STEP ) {\n\n\t\t\t\tparams.push(\n\t\t\t\t\ta.build( builder, builder.getTypeLength( a.getNodeType( builder ) ) === 1 ? 'float' : inputType ),\n\t\t\t\t\tb.build( builder, inputType )\n\t\t\t\t);\n\n\t\t\t} else if ( ( isWebGL && ( method === MathNode.MIN || method === MathNode.MAX ) ) || method === MathNode.MOD ) {\n\n\t\t\t\tparams.push(\n\t\t\t\t\ta.build( builder, inputType ),\n\t\t\t\t\tb.build( builder, builder.getTypeLength( b.getNodeType( builder ) ) === 1 ? 'float' : inputType )\n\t\t\t\t);\n\n\t\t\t} else if ( method === MathNode.REFRACT ) {\n\n\t\t\t\tparams.push(\n\t\t\t\t\ta.build( builder, inputType ),\n\t\t\t\t\tb.build( builder, inputType ),\n\t\t\t\t\tc.build( builder, 'float' )\n\t\t\t\t);\n\n\t\t\t} else if ( method === MathNode.MIX ) {\n\n\t\t\t\tparams.push(\n\t\t\t\t\ta.build( builder, inputType ),\n\t\t\t\t\tb.build( builder, inputType ),\n\t\t\t\t\tc.build( builder, builder.getTypeLength( c.getNodeType( builder ) ) === 1 ? 'float' : inputType )\n\t\t\t\t);\n\n\t\t\t} else {\n\n\t\t\t\tparams.push( a.build( builder, inputType ) );\n\t\t\t\tif ( b !== null ) params.push( b.build( builder, inputType ) );\n\t\t\t\tif ( c !== null ) params.push( c.build( builder, inputType ) );\n\n\t\t\t}\n\n\t\t\treturn builder.format( `${ builder.getMethod( method, type ) }( ${params.join( ', ' )} )`, type, output );\n\n\t\t}\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.method = this.method;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.method = data.method;\n\n\t}\n\n}\n\n// 1 input\n\nMathNode.ALL = 'all';\nMathNode.ANY = 'any';\nMathNode.EQUALS = 'equals';\n\nMathNode.RADIANS = 'radians';\nMathNode.DEGREES = 'degrees';\nMathNode.EXP = 'exp';\nMathNode.EXP2 = 'exp2';\nMathNode.LOG = 'log';\nMathNode.LOG2 = 'log2';\nMathNode.SQRT = 'sqrt';\nMathNode.INVERSE_SQRT = 'inversesqrt';\nMathNode.FLOOR = 'floor';\nMathNode.CEIL = 'ceil';\nMathNode.NORMALIZE = 'normalize';\nMathNode.FRACT = 'fract';\nMathNode.SIN = 'sin';\nMathNode.COS = 'cos';\nMathNode.TAN = 'tan';\nMathNode.ASIN = 'asin';\nMathNode.ACOS = 'acos';\nMathNode.ATAN = 'atan';\nMathNode.ABS = 'abs';\nMathNode.SIGN = 'sign';\nMathNode.LENGTH = 'length';\nMathNode.NEGATE = 'negate';\nMathNode.ONE_MINUS = 'oneMinus';\nMathNode.DFDX = 'dFdx';\nMathNode.DFDY = 'dFdy';\nMathNode.ROUND = 'round';\nMathNode.RECIPROCAL = 'reciprocal';\nMathNode.TRUNC = 'trunc';\nMathNode.FWIDTH = 'fwidth';\nMathNode.BITCAST = 'bitcast';\n\n// 2 inputs\n\nMathNode.ATAN2 = 'atan2';\nMathNode.MIN = 'min';\nMathNode.MAX = 'max';\nMathNode.MOD = 'mod';\nMathNode.STEP = 'step';\nMathNode.REFLECT = 'reflect';\nMathNode.DISTANCE = 'distance';\nMathNode.DIFFERENCE = 'difference';\nMathNode.DOT = 'dot';\nMathNode.CROSS = 'cross';\nMathNode.POW = 'pow';\nMathNode.TRANSFORM_DIRECTION = 'transformDirection';\n\n// 3 inputs\n\nMathNode.MIX = 'mix';\nMathNode.CLAMP = 'clamp';\nMathNode.REFRACT = 'refract';\nMathNode.SMOOTHSTEP = 'smoothstep';\nMathNode.FACEFORWARD = 'faceforward';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MathNode);\n\nconst EPSILON = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.float)( 1e-6 );\nconst INFINITY = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.float)( 1e6 );\nconst PI = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.float)( Math.PI );\nconst PI2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.float)( Math.PI * 2 );\n\nconst all = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.ALL );\nconst any = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.ANY );\nconst equals = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.EQUALS );\n\nconst radians = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.RADIANS );\nconst degrees = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.DEGREES );\nconst exp = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.EXP );\nconst exp2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.EXP2 );\nconst log = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.LOG );\nconst log2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.LOG2 );\nconst sqrt = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.SQRT );\nconst inverseSqrt = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.INVERSE_SQRT );\nconst floor = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.FLOOR );\nconst ceil = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.CEIL );\nconst normalize = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.NORMALIZE );\nconst fract = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.FRACT );\nconst sin = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.SIN );\nconst cos = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.COS );\nconst tan = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.TAN );\nconst asin = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.ASIN );\nconst acos = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.ACOS );\nconst atan = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.ATAN );\nconst abs = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.ABS );\nconst sign = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.SIGN );\nconst length = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.LENGTH );\nconst negate = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.NEGATE );\nconst oneMinus = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.ONE_MINUS );\nconst dFdx = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.DFDX );\nconst dFdy = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.DFDY );\nconst round = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.ROUND );\nconst reciprocal = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.RECIPROCAL );\nconst trunc = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.TRUNC );\nconst fwidth = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.FWIDTH );\nconst bitcast = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.BITCAST );\n\nconst atan2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.ATAN2 );\nconst min = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.MIN );\nconst max = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.MAX );\nconst mod = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.MOD );\nconst step = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.STEP );\nconst reflect = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.REFLECT );\nconst distance = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.DISTANCE );\nconst difference = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.DIFFERENCE );\nconst dot = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.DOT );\nconst cross = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.CROSS );\nconst pow = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.POW );\nconst pow2 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.POW, 2 );\nconst pow3 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.POW, 3 );\nconst pow4 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.POW, 4 );\nconst transformDirection = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.TRANSFORM_DIRECTION );\n\nconst cbrt = ( a ) => (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.mul)( sign( a ), pow( abs( a ), 1.0 / 3.0 ) );\nconst lengthSq = ( a ) => dot( a, a );\nconst mix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.MIX );\nconst clamp = ( value, low = 0, high = 1 ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeObject)( new MathNode( MathNode.CLAMP, (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeObject)( value ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeObject)( low ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeObject)( high ) ) );\nconst saturate = ( value ) => clamp( value );\nconst refract = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.REFRACT );\nconst smoothstep = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.SMOOTHSTEP );\nconst faceForward = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( MathNode, MathNode.FACEFORWARD );\n\nconst mixElement = ( t, e1, e2 ) => mix( e1, e2, t );\nconst smoothstepElement = ( x, low, high ) => smoothstep( low, high, x );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'all', all );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'any', any );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'equals', equals );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'radians', radians );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'degrees', degrees );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'exp', exp );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'exp2', exp2 );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'log', log );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'log2', log2 );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'sqrt', sqrt );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'inverseSqrt', inverseSqrt );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'floor', floor );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'ceil', ceil );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'normalize', normalize );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'fract', fract );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'sin', sin );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'cos', cos );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'tan', tan );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'asin', asin );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'acos', acos );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'atan', atan );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'abs', abs );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'sign', sign );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'length', length );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'lengthSq', lengthSq );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'negate', negate );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'oneMinus', oneMinus );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'dFdx', dFdx );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'dFdy', dFdy );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'round', round );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'reciprocal', reciprocal );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'trunc', trunc );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'fwidth', fwidth );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'atan2', atan2 );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'min', min );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'max', max );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'mod', mod );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'step', step );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'reflect', reflect );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'distance', distance );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'dot', dot );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'cross', cross );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'pow', pow );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'pow2', pow2 );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'pow3', pow3 );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'pow4', pow4 );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'transformDirection', transformDirection );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'mix', mixElement );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'clamp', clamp );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'refract', refract );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'smoothstep', smoothstepElement );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'faceForward', faceForward );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'difference', difference );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'saturate', saturate );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'cbrt', cbrt );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_2__.addNodeClass)( 'MathNode', MathNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/math/MathNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/math/MathUtils.js": +/*!*****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/math/MathUtils.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ gain: () => (/* binding */ gain),\n/* harmony export */ parabola: () => (/* binding */ parabola),\n/* harmony export */ pcurve: () => (/* binding */ pcurve),\n/* harmony export */ sinc: () => (/* binding */ sinc)\n/* harmony export */ });\n/* harmony import */ var _OperatorNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _MathNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n\n\n\n\n// remapping functions https://iquilezles.org/articles/functions/\nconst parabola = ( x, k ) => (0,_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.pow)( (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_0__.mul)( 4.0, x.mul( (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_0__.sub)( 1.0, x ) ) ), k );\nconst gain = ( x, k ) => x.lessThan( 0.5 ) ? parabola( x.mul( 2.0 ), k ).div( 2.0 ) : (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_0__.sub)( 1.0, parabola( (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_0__.mul)( (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_0__.sub)( 1.0, x ), 2.0 ), k ).div( 2.0 ) );\nconst pcurve = ( x, a, b ) => (0,_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.pow)( (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_0__.div)( (0,_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.pow)( x, a ), (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_0__.add)( (0,_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.pow)( x, a ), (0,_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.pow)( (0,_OperatorNode_js__WEBPACK_IMPORTED_MODULE_0__.sub)( 1.0, x ), b ) ) ), 1.0 / a );\nconst sinc = ( x, k ) => (0,_MathNode_js__WEBPACK_IMPORTED_MODULE_2__.sin)( _MathNode_js__WEBPACK_IMPORTED_MODULE_2__.PI.mul( k.mul( x ).sub( 1.0 ) ) ).div( _MathNode_js__WEBPACK_IMPORTED_MODULE_2__.PI.mul( k.mul( x ).sub( 1.0 ) ) );\n\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'parabola', parabola );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'gain', gain );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'pcurve', pcurve );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'sinc', sinc );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/math/MathUtils.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/math/OperatorNode.js": +/*!********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/math/OperatorNode.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ add: () => (/* binding */ add),\n/* harmony export */ and: () => (/* binding */ and),\n/* harmony export */ bitAnd: () => (/* binding */ bitAnd),\n/* harmony export */ bitNot: () => (/* binding */ bitNot),\n/* harmony export */ bitOr: () => (/* binding */ bitOr),\n/* harmony export */ bitXor: () => (/* binding */ bitXor),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ div: () => (/* binding */ div),\n/* harmony export */ equal: () => (/* binding */ equal),\n/* harmony export */ greaterThan: () => (/* binding */ greaterThan),\n/* harmony export */ greaterThanEqual: () => (/* binding */ greaterThanEqual),\n/* harmony export */ lessThan: () => (/* binding */ lessThan),\n/* harmony export */ lessThanEqual: () => (/* binding */ lessThanEqual),\n/* harmony export */ mul: () => (/* binding */ mul),\n/* harmony export */ not: () => (/* binding */ not),\n/* harmony export */ notEqual: () => (/* binding */ notEqual),\n/* harmony export */ or: () => (/* binding */ or),\n/* harmony export */ remainder: () => (/* binding */ remainder),\n/* harmony export */ shiftLeft: () => (/* binding */ shiftLeft),\n/* harmony export */ shiftRight: () => (/* binding */ shiftRight),\n/* harmony export */ sub: () => (/* binding */ sub),\n/* harmony export */ xor: () => (/* binding */ xor)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass OperatorNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( op, aNode, bNode, ...params ) {\n\n\t\tsuper();\n\n\t\tthis.op = op;\n\n\t\tif ( params.length > 0 ) {\n\n\t\t\tlet finalBNode = bNode;\n\n\t\t\tfor ( let i = 0; i < params.length; i ++ ) {\n\n\t\t\t\tfinalBNode = new OperatorNode( op, finalBNode, params[ i ] );\n\n\t\t\t}\n\n\t\t\tbNode = finalBNode;\n\n\t\t}\n\n\t\tthis.aNode = aNode;\n\t\tthis.bNode = bNode;\n\n\t}\n\n\tgetNodeType( builder, output ) {\n\n\t\tconst op = this.op;\n\n\t\tconst aNode = this.aNode;\n\t\tconst bNode = this.bNode;\n\n\t\tconst typeA = aNode.getNodeType( builder );\n\t\tconst typeB = typeof bNode !== 'undefined' ? bNode.getNodeType( builder ) : null;\n\n\t\tif ( typeA === 'void' || typeB === 'void' ) {\n\n\t\t\treturn 'void';\n\n\t\t} else if ( op === '%' ) {\n\n\t\t\treturn typeA;\n\n\t\t} else if ( op === '~' || op === '&' || op === '|' || op === '^' || op === '>>' || op === '<<' ) {\n\n\t\t\treturn builder.getIntegerType( typeA );\n\n\t\t} else if ( op === '!' || op === '==' || op === '&&' || op === '||' || op === '^^' ) {\n\n\t\t\treturn 'bool';\n\n\t\t} else if ( op === '<' || op === '>' || op === '<=' || op === '>=' ) {\n\n\t\t\tconst typeLength = output ? builder.getTypeLength( output ) : Math.max( builder.getTypeLength( typeA ), builder.getTypeLength( typeB ) );\n\n\t\t\treturn typeLength > 1 ? `bvec${ typeLength }` : 'bool';\n\n\t\t} else {\n\n\t\t\tif ( typeA === 'float' && builder.isMatrix( typeB ) ) {\n\n\t\t\t\treturn typeB;\n\n\t\t\t} else if ( builder.isMatrix( typeA ) && builder.isVector( typeB ) ) {\n\n\t\t\t\t// matrix x vector\n\n\t\t\t\treturn builder.getVectorFromMatrix( typeA );\n\n\t\t\t} else if ( builder.isVector( typeA ) && builder.isMatrix( typeB ) ) {\n\n\t\t\t\t// vector x matrix\n\n\t\t\t\treturn builder.getVectorFromMatrix( typeB );\n\n\t\t\t} else if ( builder.getTypeLength( typeB ) > builder.getTypeLength( typeA ) ) {\n\n\t\t\t\t// anytype x anytype: use the greater length vector\n\n\t\t\t\treturn typeB;\n\n\t\t\t}\n\n\t\t\treturn typeA;\n\n\t\t}\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst op = this.op;\n\n\t\tconst aNode = this.aNode;\n\t\tconst bNode = this.bNode;\n\n\t\tconst type = this.getNodeType( builder, output );\n\n\t\tlet typeA = null;\n\t\tlet typeB = null;\n\n\t\tif ( type !== 'void' ) {\n\n\t\t\ttypeA = aNode.getNodeType( builder );\n\t\t\ttypeB = typeof bNode !== 'undefined' ? bNode.getNodeType( builder ) : null;\n\n\t\t\tif ( op === '<' || op === '>' || op === '<=' || op === '>=' || op === '==' ) {\n\n\t\t\t\tif ( builder.isVector( typeA ) ) {\n\n\t\t\t\t\ttypeB = typeA;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttypeA = typeB = 'float';\n\n\t\t\t\t}\n\n\t\t\t} else if ( op === '>>' || op === '<<' ) {\n\n\t\t\t\ttypeA = type;\n\t\t\t\ttypeB = builder.changeComponentType( typeB, 'uint' );\n\n\t\t\t} else if ( builder.isMatrix( typeA ) && builder.isVector( typeB ) ) {\n\n\t\t\t\t// matrix x vector\n\n\t\t\t\ttypeB = builder.getVectorFromMatrix( typeA );\n\n\t\t\t} else if ( builder.isVector( typeA ) && builder.isMatrix( typeB ) ) {\n\n\t\t\t\t// vector x matrix\n\n\t\t\t\ttypeA = builder.getVectorFromMatrix( typeB );\n\n\t\t\t} else {\n\n\t\t\t\t// anytype x anytype\n\n\t\t\t\ttypeA = typeB = type;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\ttypeA = typeB = type;\n\n\t\t}\n\n\t\tconst a = aNode.build( builder, typeA );\n\t\tconst b = typeof bNode !== 'undefined' ? bNode.build( builder, typeB ) : null;\n\n\t\tconst outputLength = builder.getTypeLength( output );\n\t\tconst fnOpSnippet = builder.getFunctionOperator( op );\n\n\t\tif ( output !== 'void' ) {\n\n\t\t\tif ( op === '<' && outputLength > 1 ) {\n\n\t\t\t\treturn builder.format( `${ builder.getMethod( 'lessThan' ) }( ${ a }, ${ b } )`, type, output );\n\n\t\t\t} else if ( op === '<=' && outputLength > 1 ) {\n\n\t\t\t\treturn builder.format( `${ builder.getMethod( 'lessThanEqual' ) }( ${ a }, ${ b } )`, type, output );\n\n\t\t\t} else if ( op === '>' && outputLength > 1 ) {\n\n\t\t\t\treturn builder.format( `${ builder.getMethod( 'greaterThan' ) }( ${ a }, ${ b } )`, type, output );\n\n\t\t\t} else if ( op === '>=' && outputLength > 1 ) {\n\n\t\t\t\treturn builder.format( `${ builder.getMethod( 'greaterThanEqual' ) }( ${ a }, ${ b } )`, type, output );\n\n\t\t\t} else if ( op === '!' || op === '~' ) {\n\n\t\t\t\treturn builder.format( `(${op}${a})`, typeA, output );\n\n\t\t\t} else if ( fnOpSnippet ) {\n\n\t\t\t\treturn builder.format( `${ fnOpSnippet }( ${ a }, ${ b } )`, type, output );\n\n\t\t\t} else {\n\n\t\t\t\treturn builder.format( `( ${ a } ${ op } ${ b } )`, type, output );\n\n\t\t\t}\n\n\t\t} else if ( typeA !== 'void' ) {\n\n\t\t\tif ( fnOpSnippet ) {\n\n\t\t\t\treturn builder.format( `${ fnOpSnippet }( ${ a }, ${ b } )`, type, output );\n\n\t\t\t} else {\n\n\t\t\t\treturn builder.format( `${ a } ${ op } ${ b }`, type, output );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.op = this.op;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.op = data.op;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (OperatorNode);\n\nconst add = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '+' );\nconst sub = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '-' );\nconst mul = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '*' );\nconst div = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '/' );\nconst remainder = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '%' );\nconst equal = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '==' );\nconst notEqual = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '!=' );\nconst lessThan = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '<' );\nconst greaterThan = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '>' );\nconst lessThanEqual = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '<=' );\nconst greaterThanEqual = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '>=' );\nconst and = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '&&' );\nconst or = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '||' );\nconst not = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '!' );\nconst xor = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '^^' );\nconst bitAnd = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '&' );\nconst bitNot = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '~' );\nconst bitOr = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '|' );\nconst bitXor = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '^' );\nconst shiftLeft = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '<<' );\nconst shiftRight = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OperatorNode, '>>' );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'add', add );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'sub', sub );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'mul', mul );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'div', div );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'remainder', remainder );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'equal', equal );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'notEqual', notEqual );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'lessThan', lessThan );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'greaterThan', greaterThan );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'lessThanEqual', lessThanEqual );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'greaterThanEqual', greaterThanEqual );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'and', and );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'or', or );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'not', not );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'xor', xor );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'bitAnd', bitAnd );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'bitNot', bitNot );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'bitOr', bitOr );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'bitXor', bitXor );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'shiftLeft', shiftLeft );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'shiftRight', shiftRight );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'OperatorNode', OperatorNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/math/OperatorNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/math/TriNoise3D.js": +/*!******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/math/TriNoise3D.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ tri: () => (/* binding */ tri),\n/* harmony export */ tri3: () => (/* binding */ tri3),\n/* harmony export */ triNoise3D: () => (/* binding */ triNoise3D)\n/* harmony export */ });\n/* harmony import */ var _utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/LoopNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/LoopNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n// https://github.com/cabbibo/glsl-tri-noise-3d\n\n\n\n\nconst tri = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.tslFn)( ( [ x ] ) => {\n\n\treturn x.fract().sub( .5 ).abs();\n\n} );\n\nconst tri3 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.tslFn)( ( [ p ] ) => {\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec3)( tri( p.z.add( tri( p.y.mul( 1. ) ) ) ), tri( p.z.add( tri( p.x.mul( 1. ) ) ) ), tri( p.y.add( tri( p.x.mul( 1. ) ) ) ) );\n\n} );\n\nconst triNoise3D = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.tslFn)( ( [ p_immutable, spd, time ] ) => {\n\n\tconst p = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec3)( p_immutable ).toVar();\n\tconst z = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( 1.4 ).toVar();\n\tconst rz = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( 0.0 ).toVar();\n\tconst bp = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec3)( p ).toVar();\n\n\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_0__.loop)( { start: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( 0.0 ), end: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( 3.0 ), type: 'float', condition: '<=' }, () => {\n\n\t\tconst dg = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec3)( tri3( bp.mul( 2.0 ) ) ).toVar();\n\t\tp.addAssign( dg.add( time.mul( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( 0.1 ).mul( spd ) ) ) );\n\t\tbp.mulAssign( 1.8 );\n\t\tz.mulAssign( 1.5 );\n\t\tp.mulAssign( 1.2 );\n\n\t\tconst t = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( tri( p.z.add( tri( p.x.add( tri( p.y ) ) ) ) ) ).toVar();\n\t\trz.addAssign( t.div( z ) );\n\t\tbp.addAssign( 0.14 );\n\n\t} );\n\n\treturn rz;\n\n} );\n\n// layouts\n\ntri.setLayout( {\n\tname: 'tri',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'x', type: 'float' }\n\t]\n} );\n\ntri3.setLayout( {\n\tname: 'tri3',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' }\n\t]\n} );\n\ntriNoise3D.setLayout( {\n\tname: 'triNoise3D',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'p', type: 'vec3' },\n\t\t{ name: 'spd', type: 'float' },\n\t\t{ name: 'time', type: 'float' }\n\t]\n} );\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/math/TriNoise3D.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/parsers/GLSLNodeFunction.js": +/*!***************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/parsers/GLSLNodeFunction.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_NodeFunction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/NodeFunction.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeFunction.js\");\n/* harmony import */ var _core_NodeFunctionInput_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/NodeFunctionInput.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeFunctionInput.js\");\n\n\n\nconst declarationRegexp = /^\\s*(highp|mediump|lowp)?\\s*([a-z_0-9]+)\\s*([a-z_0-9]+)?\\s*\\(([\\s\\S]*?)\\)/i;\nconst propertiesRegexp = /[a-z_0-9]+/ig;\n\nconst pragmaMain = '#pragma main';\n\nconst parse = ( source ) => {\n\n\tsource = source.trim();\n\n\tconst pragmaMainIndex = source.indexOf( pragmaMain );\n\n\tconst mainCode = pragmaMainIndex !== - 1 ? source.slice( pragmaMainIndex + pragmaMain.length ) : source;\n\n\tconst declaration = mainCode.match( declarationRegexp );\n\n\tif ( declaration !== null && declaration.length === 5 ) {\n\n\t\t// tokenizer\n\n\t\tconst inputsCode = declaration[ 4 ];\n\t\tconst propsMatches = [];\n\n\t\tlet nameMatch = null;\n\n\t\twhile ( ( nameMatch = propertiesRegexp.exec( inputsCode ) ) !== null ) {\n\n\t\t\tpropsMatches.push( nameMatch );\n\n\t\t}\n\n\t\t// parser\n\n\t\tconst inputs = [];\n\n\t\tlet i = 0;\n\n\t\twhile ( i < propsMatches.length ) {\n\n\t\t\tconst isConst = propsMatches[ i ][ 0 ] === 'const';\n\n\t\t\tif ( isConst === true ) {\n\n\t\t\t\ti ++;\n\n\t\t\t}\n\n\t\t\tlet qualifier = propsMatches[ i ][ 0 ];\n\n\t\t\tif ( qualifier === 'in' || qualifier === 'out' || qualifier === 'inout' ) {\n\n\t\t\t\ti ++;\n\n\t\t\t} else {\n\n\t\t\t\tqualifier = '';\n\n\t\t\t}\n\n\t\t\tconst type = propsMatches[ i ++ ][ 0 ];\n\n\t\t\tlet count = Number.parseInt( propsMatches[ i ][ 0 ] );\n\n\t\t\tif ( Number.isNaN( count ) === false ) i ++;\n\t\t\telse count = null;\n\n\t\t\tconst name = propsMatches[ i ++ ][ 0 ];\n\n\t\t\tinputs.push( new _core_NodeFunctionInput_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]( type, name, count, qualifier, isConst ) );\n\n\t\t}\n\n\t\t//\n\n\t\tconst blockCode = mainCode.substring( declaration[ 0 ].length );\n\n\t\tconst name = declaration[ 3 ] !== undefined ? declaration[ 3 ] : '';\n\t\tconst type = declaration[ 2 ];\n\n\t\tconst presicion = declaration[ 1 ] !== undefined ? declaration[ 1 ] : '';\n\n\t\tconst headerCode = pragmaMainIndex !== - 1 ? source.slice( 0, pragmaMainIndex ) : '';\n\n\t\treturn {\n\t\t\ttype,\n\t\t\tinputs,\n\t\t\tname,\n\t\t\tpresicion,\n\t\t\tinputsCode,\n\t\t\tblockCode,\n\t\t\theaderCode\n\t\t};\n\n\t} else {\n\n\t\tthrow new Error( 'FunctionNode: Function is not a GLSL code.' );\n\n\t}\n\n};\n\nclass GLSLNodeFunction extends _core_NodeFunction_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( source ) {\n\n\t\tconst { type, inputs, name, presicion, inputsCode, blockCode, headerCode } = parse( source );\n\n\t\tsuper( type, inputs, name, presicion );\n\n\t\tthis.inputsCode = inputsCode;\n\t\tthis.blockCode = blockCode;\n\t\tthis.headerCode = headerCode;\n\n\t}\n\n\tgetCode( name = this.name ) {\n\n\t\tlet code;\n\n\t\tconst blockCode = this.blockCode;\n\n\t\tif ( blockCode !== '' ) {\n\n\t\t\tconst { type, inputsCode, headerCode, presicion } = this;\n\n\t\t\tlet declarationCode = `${ type } ${ name } ( ${ inputsCode.trim() } )`;\n\n\t\t\tif ( presicion !== '' ) {\n\n\t\t\t\tdeclarationCode = `${ presicion } ${ declarationCode }`;\n\n\t\t\t}\n\n\t\t\tcode = headerCode + declarationCode + blockCode;\n\n\t\t} else {\n\n\t\t\t// interface function\n\n\t\t\tcode = '';\n\n\t\t}\n\n\t\treturn code;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (GLSLNodeFunction);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/parsers/GLSLNodeFunction.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/parsers/GLSLNodeParser.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/parsers/GLSLNodeParser.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_NodeParser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/NodeParser.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeParser.js\");\n/* harmony import */ var _GLSLNodeFunction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GLSLNodeFunction.js */ \"./node_modules/three/examples/jsm/nodes/parsers/GLSLNodeFunction.js\");\n\n\n\nclass GLSLNodeParser extends _core_NodeParser_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tparseFunction( source ) {\n\n\t\treturn new _GLSLNodeFunction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]( source );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (GLSLNodeParser);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/parsers/GLSLNodeParser.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/pmrem/PMREMNode.js": +/*!******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/pmrem/PMREMNode.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ pmremTexture: () => (/* binding */ pmremTexture)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _PMREMUtils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PMREMUtils.js */ \"./node_modules/three/examples/jsm/nodes/pmrem/PMREMUtils.js\");\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\nlet _generator = null;\n\nconst _cache = new WeakMap();\n\nfunction _generateCubeUVSize( imageHeight ) {\n\n\tconst maxMip = Math.log2( imageHeight ) - 2;\n\n\tconst texelHeight = 1.0 / imageHeight;\n\n\tconst texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 * 16 ) );\n\n\treturn { texelWidth, texelHeight, maxMip };\n\n}\n\nfunction _getPMREMFromTexture( texture ) {\n\n\tlet cacheTexture = _cache.get( texture );\n\n\tconst pmremVersion = cacheTexture !== undefined ? cacheTexture.pmremVersion : - 1;\n\n\tif ( pmremVersion !== texture.pmremVersion ) {\n\n\t\tif ( texture.isCubeTexture ) {\n\n\t\t\tif ( texture.source.data.some( ( texture ) => texture === undefined ) ) {\n\n\t\t\t\tthrow new Error( 'PMREMNode: Undefined texture in CubeTexture. Use onLoad callback or async loader' );\n\n\t\t\t}\n\n\t\t\tcacheTexture = _generator.fromCubemap( texture, cacheTexture );\n\n\t\t} else {\n\n\t\t\tif ( texture.image === undefined ) {\n\n\t\t\t\tthrow new Error( 'PMREMNode: Undefined image in Texture. Use onLoad callback or async loader' );\n\n\t\t\t}\n\n\t\t\tcacheTexture = _generator.fromEquirectangular( texture, cacheTexture );\n\n\t\t}\n\n\t\tcacheTexture.pmremVersion = texture.pmremVersion;\n\n\t\t_cache.set( texture, cacheTexture );\n\n\t}\n\n\treturn cacheTexture.texture;\n\n}\n\nclass PMREMNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( value, uvNode = null, levelNode = null ) {\n\n\t\tsuper( 'vec3' );\n\n\t\tthis._value = value;\n\t\tthis._pmrem = null;\n\n\t\tthis.uvNode = uvNode;\n\t\tthis.levelNode = levelNode;\n\n\t\tthis._generator = null;\n\t\tthis._texture = (0,_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_2__.texture)( null );\n\t\tthis._width = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_4__.uniform)( 0 );\n\t\tthis._height = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_4__.uniform)( 0 );\n\t\tthis._maxMip = (0,_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_4__.uniform)( 0 );\n\n\t\tthis.updateBeforeType = _core_constants_js__WEBPACK_IMPORTED_MODULE_5__.NodeUpdateType.RENDER;\n\n\t}\n\n\tset value( value ) {\n\n\t\tthis._value = value;\n\t\tthis._pmrem = null;\n\n\t}\n\n\tget value() {\n\n\t\treturn this._value;\n\n\t}\n\n\tupdateFromTexture( texture ) {\n\n\t\tconst cubeUVSize = _generateCubeUVSize( texture.image.height );\n\n\t\tthis._texture.value = texture;\n\t\tthis._width.value = cubeUVSize.texelWidth;\n\t\tthis._height.value = cubeUVSize.texelHeight;\n\t\tthis._maxMip.value = cubeUVSize.maxMip;\n\n\t}\n\n\tupdateBefore() {\n\n\t\tlet pmrem = this._pmrem;\n\n\t\tconst pmremVersion = pmrem ? pmrem.pmremVersion : - 1;\n\t\tconst texture = this._value;\n\n\t\tif ( pmremVersion !== texture.pmremVersion ) {\n\n\t\t\tif ( texture.isPMREMTexture === true ) {\n\n\t\t\t\tpmrem = texture;\n\n\t\t\t} else {\n\n\t\t\t\tpmrem = _getPMREMFromTexture( texture );\n\n\t\t\t}\n\n\t\t\tthis._pmrem = pmrem;\n\n\t\t\tthis.updateFromTexture( pmrem );\n\n\t\t}\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tif ( _generator === null ) {\n\n\t\t\t_generator = builder.createPMREMGenerator();\n\n\t\t}\n\n\t\t//\n\n\t\tthis.updateBefore( builder );\n\n\t\t//\n\n\t\tlet uvNode = this.uvNode;\n\n\t\tif ( uvNode === null && builder.context.getUV ) {\n\n\t\t\tuvNode = builder.context.getUV( this );\n\n\t\t}\n\n\t\t//\n\n\t\tconst texture = this.value;\n\n\t\tif ( builder.renderer.coordinateSystem === three__WEBPACK_IMPORTED_MODULE_7__.WebGLCoordinateSystem && texture.isPMREMTexture !== true && texture.isRenderTargetTexture === true ) {\n\n\t\t\tuvNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.vec3)( uvNode.x.negate(), uvNode.yz );\n\n\t\t}\n\n\t\t//\n\n\t\tlet levelNode = this.levelNode;\n\n\t\tif ( levelNode === null && builder.context.getTextureLevel ) {\n\n\t\t\tlevelNode = builder.context.getTextureLevel( this );\n\n\t\t}\n\n\t\t//\n\n\t\treturn (0,_PMREMUtils_js__WEBPACK_IMPORTED_MODULE_3__.textureCubeUV)( this._texture, uvNode, levelNode, this._width, this._height, this._maxMip );\n\n\t}\n\n}\n\nconst pmremTexture = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_6__.nodeProxy)( PMREMNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'PMREMNode', PMREMNode );\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PMREMNode);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/pmrem/PMREMNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/pmrem/PMREMUtils.js": +/*!*******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/pmrem/PMREMUtils.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ blur: () => (/* binding */ blur),\n/* harmony export */ getDirection: () => (/* binding */ getDirection),\n/* harmony export */ textureCubeUV: () => (/* binding */ textureCubeUV)\n/* harmony export */ });\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _math_CondNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../math/CondNode.js */ \"./node_modules/three/examples/jsm/nodes/math/CondNode.js\");\n/* harmony import */ var _utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/LoopNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/LoopNode.js\");\n\n\n\n\n\n\n// These defines must match with PMREMGenerator\n\nconst cubeUV_r0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 1.0 );\nconst cubeUV_m0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( - 2.0 );\nconst cubeUV_r1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 0.8 );\nconst cubeUV_m1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( - 1.0 );\nconst cubeUV_r4 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 0.4 );\nconst cubeUV_m4 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 2.0 );\nconst cubeUV_r5 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 0.305 );\nconst cubeUV_m5 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 3.0 );\nconst cubeUV_r6 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 0.21 );\nconst cubeUV_m6 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 4.0 );\n\nconst cubeUV_minMipLevel = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 4.0 );\nconst cubeUV_minTileSize = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 16.0 );\n\n// These shader functions convert between the UV coordinates of a single face of\n// a cubemap, the 0-5 integer index of a cube face, and the direction vector for\n// sampling a textureCube (not generally normalized ).\n\nconst getFace = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ direction ] ) => {\n\n\tconst absDirection = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.abs)( direction ) ).toVar();\n\tconst face = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( - 1.0 ).toVar();\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( absDirection.x.greaterThan( absDirection.z ), () => {\n\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( absDirection.x.greaterThan( absDirection.y ), () => {\n\n\t\t\tface.assign( (0,_math_CondNode_js__WEBPACK_IMPORTED_MODULE_3__.cond)( direction.x.greaterThan( 0.0 ), 0.0, 3.0 ) );\n\n\t\t} ).else( () => {\n\n\t\t\tface.assign( (0,_math_CondNode_js__WEBPACK_IMPORTED_MODULE_3__.cond)( direction.y.greaterThan( 0.0 ), 1.0, 4.0 ) );\n\n\t\t} );\n\n\t} ).else( () => {\n\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( absDirection.z.greaterThan( absDirection.y ), () => {\n\n\t\t\tface.assign( (0,_math_CondNode_js__WEBPACK_IMPORTED_MODULE_3__.cond)( direction.z.greaterThan( 0.0 ), 2.0, 5.0 ) );\n\n\t\t} ).else( () => {\n\n\t\t\tface.assign( (0,_math_CondNode_js__WEBPACK_IMPORTED_MODULE_3__.cond)( direction.y.greaterThan( 0.0 ), 1.0, 4.0 ) );\n\n\t\t} );\n\n\t} );\n\n\treturn face;\n\n} ).setLayout( {\n\tname: 'getFace',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'direction', type: 'vec3' }\n\t]\n} );\n\n// RH coordinate system; PMREM face-indexing convention\nconst getUV = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ direction, face ] ) => {\n\n\tconst uv = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)().toVar();\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( face.equal( 0.0 ), () => {\n\n\t\tuv.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( direction.z, direction.y ).div( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.abs)( direction.x ) ) ); // pos x\n\n\t} ).elseif( face.equal( 1.0 ), () => {\n\n\t\tuv.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( direction.x.negate(), direction.z.negate() ).div( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.abs)( direction.y ) ) ); // pos y\n\n\t} ).elseif( face.equal( 2.0 ), () => {\n\n\t\tuv.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( direction.x.negate(), direction.y ).div( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.abs)( direction.z ) ) ); // pos z\n\n\t} ).elseif( face.equal( 3.0 ), () => {\n\n\t\tuv.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( direction.z.negate(), direction.y ).div( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.abs)( direction.x ) ) ); // neg x\n\n\t} ).elseif( face.equal( 4.0 ), () => {\n\n\t\tuv.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( direction.x.negate(), direction.z ).div( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.abs)( direction.y ) ) ); // neg y\n\n\t} ).else( () => {\n\n\t\tuv.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( direction.x, direction.y ).div( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.abs)( direction.z ) ) ); // neg z\n\n\t} );\n\n\treturn (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( 0.5, uv.add( 1.0 ) );\n\n} ).setLayout( {\n\tname: 'getUV',\n\ttype: 'vec2',\n\tinputs: [\n\t\t{ name: 'direction', type: 'vec3' },\n\t\t{ name: 'face', type: 'float' }\n\t]\n} );\n\nconst roughnessToMip = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ roughness ] ) => {\n\n\tconst mip = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( 0.0 ).toVar();\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( roughness.greaterThanEqual( cubeUV_r1 ), () => {\n\n\t\tmip.assign( cubeUV_r0.sub( roughness ).mul( cubeUV_m1.sub( cubeUV_m0 ) ).div( cubeUV_r0.sub( cubeUV_r1 ) ).add( cubeUV_m0 ) );\n\n\t} ).elseif( roughness.greaterThanEqual( cubeUV_r4 ), () => {\n\n\t\tmip.assign( cubeUV_r1.sub( roughness ).mul( cubeUV_m4.sub( cubeUV_m1 ) ).div( cubeUV_r1.sub( cubeUV_r4 ) ).add( cubeUV_m1 ) );\n\n\t} ).elseif( roughness.greaterThanEqual( cubeUV_r5 ), () => {\n\n\t\tmip.assign( cubeUV_r4.sub( roughness ).mul( cubeUV_m5.sub( cubeUV_m4 ) ).div( cubeUV_r4.sub( cubeUV_r5 ) ).add( cubeUV_m4 ) );\n\n\t} ).elseif( roughness.greaterThanEqual( cubeUV_r6 ), () => {\n\n\t\tmip.assign( cubeUV_r5.sub( roughness ).mul( cubeUV_m6.sub( cubeUV_m5 ) ).div( cubeUV_r5.sub( cubeUV_r6 ) ).add( cubeUV_m5 ) );\n\n\t} ).else( () => {\n\n\t\tmip.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( - 2.0 ).mul( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.log2)( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( 1.16, roughness ) ) ) ); // 1.16 = 1.79^0.25\n\n\t} );\n\n\treturn mip;\n\n} ).setLayout( {\n\tname: 'roughnessToMip',\n\ttype: 'float',\n\tinputs: [\n\t\t{ name: 'roughness', type: 'float' }\n\t]\n} );\n\n// RH coordinate system; PMREM face-indexing convention\nconst getDirection = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ uv_immutable, face ] ) => {\n\n\tconst uv = uv_immutable.toVar();\n\tuv.assign( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( 2.0, uv ).sub( 1.0 ) );\n\tconst direction = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( uv, 1.0 ).toVar();\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( face.equal( 0.0 ), () => {\n\n\t\tdirection.assign( direction.zyx ); // ( 1, v, u ) pos x\n\n\t} ).elseif( face.equal( 1.0 ), () => {\n\n\t\tdirection.assign( direction.xzy );\n\t\tdirection.xz.mulAssign( - 1.0 ); // ( -u, 1, -v ) pos y\n\n\t} ).elseif( face.equal( 2.0 ), () => {\n\n\t\tdirection.x.mulAssign( - 1.0 ); // ( -u, v, 1 ) pos z\n\n\t} ).elseif( face.equal( 3.0 ), () => {\n\n\t\tdirection.assign( direction.zyx );\n\t\tdirection.xz.mulAssign( - 1.0 ); // ( -1, v, -u ) neg x\n\n\t} ).elseif( face.equal( 4.0 ), () => {\n\n\t\tdirection.assign( direction.xzy );\n\t\tdirection.xy.mulAssign( - 1.0 ); // ( -u, -1, v ) neg y\n\n\t} ).elseif( face.equal( 5.0 ), () => {\n\n\t\tdirection.z.mulAssign( - 1.0 ); // ( u, v, -1 ) neg zS\n\n\t} );\n\n\treturn direction;\n\n} ).setLayout( {\n\tname: 'getDirection',\n\ttype: 'vec3',\n\tinputs: [\n\t\t{ name: 'uv', type: 'vec2' },\n\t\t{ name: 'face', type: 'float' }\n\t]\n} );\n\n//\n\nconst textureCubeUV = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ envMap, sampleDir_immutable, roughness_immutable, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP ] ) => {\n\n\tconst roughness = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( roughness_immutable );\n\tconst sampleDir = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( sampleDir_immutable );\n\n\tconst mip = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.clamp)( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\tconst mipF = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.fract)( mip );\n\tconst mipInt = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.floor)( mip );\n\tconst color0 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( bilinearCubeUV( envMap, sampleDir, mipInt, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP ) ).toVar();\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( mipF.notEqual( 0.0 ), () => {\n\n\t\tconst color1 = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( bilinearCubeUV( envMap, sampleDir, mipInt.add( 1.0 ), CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP ) ).toVar();\n\n\t\tcolor0.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.mix)( color0, color1, mipF ) );\n\n\t} );\n\n\treturn color0;\n\n} );\n\nconst bilinearCubeUV = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( [ envMap, direction_immutable, mipInt_immutable, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP ] ) => {\n\n\tconst mipInt = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( mipInt_immutable ).toVar();\n\tconst direction = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( direction_immutable );\n\tconst face = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( getFace( direction ) ).toVar();\n\tconst filterInt = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.max)( cubeUV_minMipLevel.sub( mipInt ), 0.0 ) ).toVar();\n\tmipInt.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.max)( mipInt, cubeUV_minMipLevel ) );\n\tconst faceSize = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.exp2)( mipInt ) ).toVar();\n\tconst uv = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec2)( getUV( direction, face ).mul( faceSize.sub( 2.0 ) ).add( 1.0 ) ).toVar();\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( face.greaterThan( 2.0 ), () => {\n\n\t\tuv.y.addAssign( faceSize );\n\t\tface.subAssign( 3.0 );\n\n\t} );\n\n\tuv.x.addAssign( face.mul( faceSize ) );\n\tuv.x.addAssign( filterInt.mul( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( 3.0, cubeUV_minTileSize ) ) );\n\tuv.y.addAssign( (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_2__.mul)( 4.0, (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.exp2)( CUBEUV_MAX_MIP ).sub( faceSize ) ) );\n\tuv.x.mulAssign( CUBEUV_TEXEL_WIDTH );\n\tuv.y.mulAssign( CUBEUV_TEXEL_HEIGHT );\n\n\treturn envMap.uv( uv );\n\n} );\n\nconst getSample = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( { envMap, mipInt, outputDirection, theta, axis, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) => {\n\n\tconst cosTheta = (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.cos)( theta );\n\n\t// Rodrigues' axis-angle rotation\n\tconst sampleDirection = outputDirection.mul( cosTheta )\n\t\t.add( axis.cross( outputDirection ).mul( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.sin)( theta ) ) )\n\t\t.add( axis.mul( axis.dot( outputDirection ).mul( cosTheta.oneMinus() ) ) );\n\n\treturn bilinearCubeUV( envMap, sampleDirection, mipInt, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP );\n\n} );\n\nconst blur = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.tslFn)( ( { n, latitudinal, poleAxis, outputDirection, weights, samples, dTheta, mipInt, envMap, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) => {\n\n\tconst axis = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( (0,_math_CondNode_js__WEBPACK_IMPORTED_MODULE_3__.cond)( latitudinal, poleAxis, (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.cross)( poleAxis, outputDirection ) ) ).toVar();\n\n\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.all)( axis.equals( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( 0.0 ) ) ), () => {\n\n\t\taxis.assign( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)( outputDirection.z, 0.0, outputDirection.x.negate() ) );\n\n\t} );\n\n\taxis.assign( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_1__.normalize)( axis ) );\n\n\tconst gl_FragColor = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec3)().toVar();\n\tgl_FragColor.addAssign( weights.element( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 0 ) ).mul( getSample( { theta: 0.0, axis, outputDirection, mipInt, envMap, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) ) );\n\n\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_4__.loop)( { start: (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.int)( 1 ), end: n }, ( { i } ) => {\n\n\t\t(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.If)( i.greaterThanEqual( samples ), () => {\n\n\t\t\t(0,_utils_LoopNode_js__WEBPACK_IMPORTED_MODULE_4__.Break)();\n\n\t\t} );\n\n\t\tconst theta = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( dTheta.mul( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.float)( i ) ) ).toVar();\n\t\tgl_FragColor.addAssign( weights.element( i ).mul( getSample( { theta: theta.mul( - 1.0 ), axis, outputDirection, mipInt, envMap, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) ) );\n\t\tgl_FragColor.addAssign( weights.element( i ).mul( getSample( { theta, axis, outputDirection, mipInt, envMap, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) ) );\n\n\t} );\n\n\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_0__.vec4)( gl_FragColor, 1 );\n\n} );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/pmrem/PMREMUtils.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/procedural/CheckerNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/procedural/CheckerNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ checker: () => (/* binding */ checker),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../accessors/UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\nconst checkerShaderNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.tslFn)( ( inputs ) => {\n\n\tconst uv = inputs.uv.mul( 2.0 );\n\n\tconst cx = uv.x.floor();\n\tconst cy = uv.y.floor();\n\tconst result = cx.add( cy ).mod( 2.0 );\n\n\treturn result.sign();\n\n} );\n\nclass CheckerNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( uvNode = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_1__.uv)() ) {\n\n\t\tsuper( 'float' );\n\n\t\tthis.uvNode = uvNode;\n\n\t}\n\n\tsetup() {\n\n\t\treturn checkerShaderNode( { uv: this.uvNode } );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CheckerNode);\n\nconst checker = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( CheckerNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'checker', checker );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_2__.addNodeClass)( 'CheckerNode', CheckerNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/procedural/CheckerNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js": +/*!************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ If: () => (/* binding */ If),\n/* harmony export */ ShaderNode: () => (/* binding */ ShaderNode),\n/* harmony export */ addNodeElement: () => (/* binding */ addNodeElement),\n/* harmony export */ append: () => (/* binding */ append),\n/* harmony export */ arrayBuffer: () => (/* binding */ arrayBuffer),\n/* harmony export */ bmat2: () => (/* binding */ bmat2),\n/* harmony export */ bmat3: () => (/* binding */ bmat3),\n/* harmony export */ bmat4: () => (/* binding */ bmat4),\n/* harmony export */ bool: () => (/* binding */ bool),\n/* harmony export */ bvec2: () => (/* binding */ bvec2),\n/* harmony export */ bvec3: () => (/* binding */ bvec3),\n/* harmony export */ bvec4: () => (/* binding */ bvec4),\n/* harmony export */ color: () => (/* binding */ color),\n/* harmony export */ convert: () => (/* binding */ convert),\n/* harmony export */ element: () => (/* binding */ element),\n/* harmony export */ float: () => (/* binding */ float),\n/* harmony export */ getConstNodeType: () => (/* binding */ getConstNodeType),\n/* harmony export */ getCurrentStack: () => (/* binding */ getCurrentStack),\n/* harmony export */ imat2: () => (/* binding */ imat2),\n/* harmony export */ imat3: () => (/* binding */ imat3),\n/* harmony export */ imat4: () => (/* binding */ imat4),\n/* harmony export */ int: () => (/* binding */ int),\n/* harmony export */ ivec2: () => (/* binding */ ivec2),\n/* harmony export */ ivec3: () => (/* binding */ ivec3),\n/* harmony export */ ivec4: () => (/* binding */ ivec4),\n/* harmony export */ mat2: () => (/* binding */ mat2),\n/* harmony export */ mat3: () => (/* binding */ mat3),\n/* harmony export */ mat4: () => (/* binding */ mat4),\n/* harmony export */ nodeArray: () => (/* binding */ nodeArray),\n/* harmony export */ nodeImmutable: () => (/* binding */ nodeImmutable),\n/* harmony export */ nodeObject: () => (/* binding */ nodeObject),\n/* harmony export */ nodeObjects: () => (/* binding */ nodeObjects),\n/* harmony export */ nodeProxy: () => (/* binding */ nodeProxy),\n/* harmony export */ setCurrentStack: () => (/* binding */ setCurrentStack),\n/* harmony export */ shader: () => (/* binding */ shader),\n/* harmony export */ split: () => (/* binding */ split),\n/* harmony export */ string: () => (/* binding */ string),\n/* harmony export */ tslFn: () => (/* binding */ tslFn),\n/* harmony export */ uint: () => (/* binding */ uint),\n/* harmony export */ umat2: () => (/* binding */ umat2),\n/* harmony export */ umat3: () => (/* binding */ umat3),\n/* harmony export */ umat4: () => (/* binding */ umat4),\n/* harmony export */ uvec2: () => (/* binding */ uvec2),\n/* harmony export */ uvec3: () => (/* binding */ uvec3),\n/* harmony export */ uvec4: () => (/* binding */ uvec4),\n/* harmony export */ vec2: () => (/* binding */ vec2),\n/* harmony export */ vec3: () => (/* binding */ vec3),\n/* harmony export */ vec4: () => (/* binding */ vec4)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _utils_ArrayElementNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/ArrayElementNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/ArrayElementNode.js\");\n/* harmony import */ var _utils_ConvertNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/ConvertNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/ConvertNode.js\");\n/* harmony import */ var _utils_JoinNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/JoinNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/JoinNode.js\");\n/* harmony import */ var _utils_SplitNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/SplitNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/SplitNode.js\");\n/* harmony import */ var _utils_SetNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/SetNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/SetNode.js\");\n/* harmony import */ var _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../core/ConstNode.js */ \"./node_modules/three/examples/jsm/nodes/core/ConstNode.js\");\n/* harmony import */ var _core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../core/NodeUtils.js */ \"./node_modules/three/examples/jsm/nodes/core/NodeUtils.js\");\n\n\n\n\n\n\n\n\n\n//\n\nlet currentStack = null;\n\nconst NodeElements = new Map(); // @TODO: Currently only a few nodes are added, probably also add others\n\nfunction addNodeElement( name, nodeElement ) {\n\n\tif ( NodeElements.has( name ) ) {\n\n\t\tconsole.warn( `Redefinition of node element ${ name }` );\n\t\treturn;\n\n\t}\n\n\tif ( typeof nodeElement !== 'function' ) throw new Error( `Node element ${ name } is not a function` );\n\n\tNodeElements.set( name, nodeElement );\n\n}\n\nconst parseSwizzle = ( props ) => props.replace( /r|s/g, 'x' ).replace( /g|t/g, 'y' ).replace( /b|p/g, 'z' ).replace( /a|q/g, 'w' );\n\nconst shaderNodeHandler = {\n\n\tsetup( NodeClosure, params ) {\n\n\t\tconst inputs = params.shift();\n\n\t\treturn NodeClosure( nodeObjects( inputs ), ...params );\n\n\t},\n\n\tget( node, prop, nodeObj ) {\n\n\t\tif ( typeof prop === 'string' && node[ prop ] === undefined ) {\n\n\t\t\tif ( node.isStackNode !== true && prop === 'assign' ) {\n\n\t\t\t\treturn ( ...params ) => {\n\n\t\t\t\t\tcurrentStack.assign( nodeObj, ...params );\n\n\t\t\t\t\treturn nodeObj;\n\n\t\t\t\t};\n\n\t\t\t} else if ( NodeElements.has( prop ) ) {\n\n\t\t\t\tconst nodeElement = NodeElements.get( prop );\n\n\t\t\t\treturn node.isStackNode ? ( ...params ) => nodeObj.add( nodeElement( ...params ) ) : ( ...params ) => nodeElement( nodeObj, ...params );\n\n\t\t\t} else if ( prop === 'self' ) {\n\n\t\t\t\treturn node;\n\n\t\t\t} else if ( prop.endsWith( 'Assign' ) && NodeElements.has( prop.slice( 0, prop.length - 'Assign'.length ) ) ) {\n\n\t\t\t\tconst nodeElement = NodeElements.get( prop.slice( 0, prop.length - 'Assign'.length ) );\n\n\t\t\t\treturn node.isStackNode ? ( ...params ) => nodeObj.assign( params[ 0 ], nodeElement( ...params ) ) : ( ...params ) => nodeObj.assign( nodeElement( nodeObj, ...params ) );\n\n\t\t\t} else if ( /^[xyzwrgbastpq]{1,4}$/.test( prop ) === true ) {\n\n\t\t\t\t// accessing properties ( swizzle )\n\n\t\t\t\tprop = parseSwizzle( prop );\n\n\t\t\t\treturn nodeObject( new _utils_SplitNode_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]( nodeObj, prop ) );\n\n\t\t\t} else if ( /^set[XYZWRGBASTPQ]{1,4}$/.test( prop ) === true ) {\n\n\t\t\t\t// set properties ( swizzle )\n\n\t\t\t\tprop = parseSwizzle( prop.slice( 3 ).toLowerCase() );\n\n\t\t\t\t// sort to xyzw sequence\n\n\t\t\t\tprop = prop.split( '' ).sort().join( '' );\n\n\t\t\t\treturn ( value ) => nodeObject( new _utils_SetNode_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]( node, prop, value ) );\n\n\t\t\t} else if ( prop === 'width' || prop === 'height' || prop === 'depth' ) {\n\n\t\t\t\t// accessing property\n\n\t\t\t\tif ( prop === 'width' ) prop = 'x';\n\t\t\t\telse if ( prop === 'height' ) prop = 'y';\n\t\t\t\telse if ( prop === 'depth' ) prop = 'z';\n\n\t\t\t\treturn nodeObject( new _utils_SplitNode_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]( node, prop ) );\n\n\t\t\t} else if ( /^\\d+$/.test( prop ) === true ) {\n\n\t\t\t\t// accessing array\n\n\t\t\t\treturn nodeObject( new _utils_ArrayElementNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]( nodeObj, new _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]( Number( prop ), 'uint' ) ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Reflect.get( node, prop, nodeObj );\n\n\t},\n\n\tset( node, prop, value, nodeObj ) {\n\n\t\tif ( typeof prop === 'string' && node[ prop ] === undefined ) {\n\n\t\t\t// setting properties\n\n\t\t\tif ( /^[xyzwrgbastpq]{1,4}$/.test( prop ) === true || prop === 'width' || prop === 'height' || prop === 'depth' || /^\\d+$/.test( prop ) === true ) {\n\n\t\t\t\tnodeObj[ prop ].assign( value );\n\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn Reflect.set( node, prop, value, nodeObj );\n\n\t}\n\n};\n\nconst nodeObjectsCacheMap = new WeakMap();\nconst nodeBuilderFunctionsCacheMap = new WeakMap();\n\nconst ShaderNodeObject = function ( obj, altType = null ) {\n\n\tconst type = (0,_core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_7__.getValueType)( obj );\n\n\tif ( type === 'node' ) {\n\n\t\tlet nodeObject = nodeObjectsCacheMap.get( obj );\n\n\t\tif ( nodeObject === undefined ) {\n\n\t\t\tnodeObject = new Proxy( obj, shaderNodeHandler );\n\n\t\t\tnodeObjectsCacheMap.set( obj, nodeObject );\n\t\t\tnodeObjectsCacheMap.set( nodeObject, nodeObject );\n\n\t\t}\n\n\t\treturn nodeObject;\n\n\t} else if ( ( altType === null && ( type === 'float' || type === 'boolean' ) ) || ( type && type !== 'shader' && type !== 'string' ) ) {\n\n\t\treturn nodeObject( getConstNode( obj, altType ) );\n\n\t} else if ( type === 'shader' ) {\n\n\t\treturn tslFn( obj );\n\n\t}\n\n\treturn obj;\n\n};\n\nconst ShaderNodeObjects = function ( objects, altType = null ) {\n\n\tfor ( const name in objects ) {\n\n\t\tobjects[ name ] = nodeObject( objects[ name ], altType );\n\n\t}\n\n\treturn objects;\n\n};\n\nconst ShaderNodeArray = function ( array, altType = null ) {\n\n\tconst len = array.length;\n\n\tfor ( let i = 0; i < len; i ++ ) {\n\n\t\tarray[ i ] = nodeObject( array[ i ], altType );\n\n\t}\n\n\treturn array;\n\n};\n\nconst ShaderNodeProxy = function ( NodeClass, scope = null, factor = null, settings = null ) {\n\n\tconst assignNode = ( node ) => nodeObject( settings !== null ? Object.assign( node, settings ) : node );\n\n\tif ( scope === null ) {\n\n\t\treturn ( ...params ) => {\n\n\t\t\treturn assignNode( new NodeClass( ...nodeArray( params ) ) );\n\n\t\t};\n\n\t} else if ( factor !== null ) {\n\n\t\tfactor = nodeObject( factor );\n\n\t\treturn ( ...params ) => {\n\n\t\t\treturn assignNode( new NodeClass( scope, ...nodeArray( params ), factor ) );\n\n\t\t};\n\n\t} else {\n\n\t\treturn ( ...params ) => {\n\n\t\t\treturn assignNode( new NodeClass( scope, ...nodeArray( params ) ) );\n\n\t\t};\n\n\t}\n\n};\n\nconst ShaderNodeImmutable = function ( NodeClass, ...params ) {\n\n\treturn nodeObject( new NodeClass( ...nodeArray( params ) ) );\n\n};\n\nclass ShaderCallNodeInternal extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( shaderNode, inputNodes ) {\n\n\t\tsuper();\n\n\t\tthis.shaderNode = shaderNode;\n\t\tthis.inputNodes = inputNodes;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\tconst { outputNode } = builder.getNodeProperties( this );\n\n\t\treturn outputNode ? outputNode.getNodeType( builder ) : super.getNodeType( builder );\n\n\t}\n\n\tcall( builder ) {\n\n\t\tconst { shaderNode, inputNodes } = this;\n\n\t\tif ( shaderNode.layout ) {\n\n\t\t\tlet functionNodesCacheMap = nodeBuilderFunctionsCacheMap.get( builder.constructor );\n\n\t\t\tif ( functionNodesCacheMap === undefined ) {\n\n\t\t\t\tfunctionNodesCacheMap = new WeakMap();\n\n\t\t\t\tnodeBuilderFunctionsCacheMap.set( builder.constructor, functionNodesCacheMap );\n\n\t\t\t}\n\n\t\t\tlet functionNode = functionNodesCacheMap.get( shaderNode );\n\n\t\t\tif ( functionNode === undefined ) {\n\n\t\t\t\tfunctionNode = nodeObject( builder.buildFunctionNode( shaderNode ) );\n\n\t\t\t\tfunctionNodesCacheMap.set( shaderNode, functionNode );\n\n\t\t\t}\n\n\t\t\tif ( builder.currentFunctionNode !== null ) {\n\n\t\t\t\tbuilder.currentFunctionNode.includes.push( functionNode );\n\n\t\t\t}\n\n\t\t\treturn nodeObject( functionNode.call( inputNodes ) );\n\n\t\t}\n\n\t\tconst jsFunc = shaderNode.jsFunc;\n\t\tconst outputNode = inputNodes !== null ? jsFunc( inputNodes, builder.stack, builder ) : jsFunc( builder.stack, builder );\n\n\t\treturn nodeObject( outputNode );\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tbuilder.addStack();\n\n\t\tbuilder.stack.outputNode = this.call( builder );\n\n\t\treturn builder.removeStack();\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst { outputNode } = builder.getNodeProperties( this );\n\n\t\tif ( outputNode === null ) {\n\n\t\t\t// TSL: It's recommended to use `tslFn` in setup() pass.\n\n\t\t\treturn this.call( builder ).build( builder, output );\n\n\t\t}\n\n\t\treturn super.generate( builder, output );\n\n\t}\n\n}\n\nclass ShaderNodeInternal extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( jsFunc ) {\n\n\t\tsuper();\n\n\t\tthis.jsFunc = jsFunc;\n\t\tthis.layout = null;\n\n\t}\n\n\tget isArrayInput() {\n\n\t\treturn /^\\((\\s+)?\\[/.test( this.jsFunc.toString() );\n\n\t}\n\n\tsetLayout( layout ) {\n\n\t\tthis.layout = layout;\n\n\t\treturn this;\n\n\t}\n\n\tcall( inputs = null ) {\n\n\t\tnodeObjects( inputs );\n\n\t\treturn nodeObject( new ShaderCallNodeInternal( this, inputs ) );\n\n\t}\n\n\tsetup() {\n\n\t\treturn this.call();\n\n\t}\n\n}\n\nconst bools = [ false, true ];\nconst uints = [ 0, 1, 2, 3 ];\nconst ints = [ - 1, - 2 ];\nconst floats = [ 0.5, 1.5, 1 / 3, 1e-6, 1e6, Math.PI, Math.PI * 2, 1 / Math.PI, 2 / Math.PI, 1 / ( Math.PI * 2 ), Math.PI / 2 ];\n\nconst boolsCacheMap = new Map();\nfor ( const bool of bools ) boolsCacheMap.set( bool, new _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]( bool ) );\n\nconst uintsCacheMap = new Map();\nfor ( const uint of uints ) uintsCacheMap.set( uint, new _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]( uint, 'uint' ) );\n\nconst intsCacheMap = new Map( [ ...uintsCacheMap ].map( el => new _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]( el.value, 'int' ) ) );\nfor ( const int of ints ) intsCacheMap.set( int, new _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]( int, 'int' ) );\n\nconst floatsCacheMap = new Map( [ ...intsCacheMap ].map( el => new _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]( el.value ) ) );\nfor ( const float of floats ) floatsCacheMap.set( float, new _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]( float ) );\nfor ( const float of floats ) floatsCacheMap.set( - float, new _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]( - float ) );\n\nconst cacheMaps = { bool: boolsCacheMap, uint: uintsCacheMap, ints: intsCacheMap, float: floatsCacheMap };\n\nconst constNodesCacheMap = new Map( [ ...boolsCacheMap, ...floatsCacheMap ] );\n\nconst getConstNode = ( value, type ) => {\n\n\tif ( constNodesCacheMap.has( value ) ) {\n\n\t\treturn constNodesCacheMap.get( value );\n\n\t} else if ( value.isNode === true ) {\n\n\t\treturn value;\n\n\t} else {\n\n\t\treturn new _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]( value, type );\n\n\t}\n\n};\n\nconst safeGetNodeType = ( node ) => {\n\n\ttry {\n\n\t\treturn node.getNodeType();\n\n\t} catch ( _ ) {\n\n\t\treturn undefined;\n\n\t}\n\n};\n\nconst ConvertType = function ( type, cacheMap = null ) {\n\n\treturn ( ...params ) => {\n\n\t\tif ( params.length === 0 || ( ! [ 'bool', 'float', 'int', 'uint' ].includes( type ) && params.every( param => typeof param !== 'object' ) ) ) {\n\n\t\t\tparams = [ (0,_core_NodeUtils_js__WEBPACK_IMPORTED_MODULE_7__.getValueFromType)( type, ...params ) ];\n\n\t\t}\n\n\t\tif ( params.length === 1 && cacheMap !== null && cacheMap.has( params[ 0 ] ) ) {\n\n\t\t\treturn nodeObject( cacheMap.get( params[ 0 ] ) );\n\n\t\t}\n\n\t\tif ( params.length === 1 ) {\n\n\t\t\tconst node = getConstNode( params[ 0 ], type );\n\t\t\tif ( safeGetNodeType( node ) === type ) return nodeObject( node );\n\t\t\treturn nodeObject( new _utils_ConvertNode_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]( node, type ) );\n\n\t\t}\n\n\t\tconst nodes = params.map( param => getConstNode( param ) );\n\t\treturn nodeObject( new _utils_JoinNode_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]( nodes, type ) );\n\n\t};\n\n};\n\n// exports\n\n// utils\n\nconst getConstNodeType = ( value ) => ( value !== undefined && value !== null ) ? ( value.nodeType || value.convertTo || ( typeof value === 'string' ? value : null ) ) : null;\n\n// shader node base\n\nfunction ShaderNode( jsFunc ) {\n\n\treturn new Proxy( new ShaderNodeInternal( jsFunc ), shaderNodeHandler );\n\n}\n\nconst nodeObject = ( val, altType = null ) => /* new */ ShaderNodeObject( val, altType );\nconst nodeObjects = ( val, altType = null ) => new ShaderNodeObjects( val, altType );\nconst nodeArray = ( val, altType = null ) => new ShaderNodeArray( val, altType );\nconst nodeProxy = ( ...params ) => new ShaderNodeProxy( ...params );\nconst nodeImmutable = ( ...params ) => new ShaderNodeImmutable( ...params );\n\nconst shader = ( jsFunc ) => { // @deprecated, r154\n\n\tconsole.warn( 'TSL: shader() is deprecated. Use tslFn() instead.' );\n\n\treturn new ShaderNode( jsFunc );\n\n};\n\nconst tslFn = ( jsFunc ) => {\n\n\tconst shaderNode = new ShaderNode( jsFunc );\n\n\tconst fn = ( ...params ) => {\n\n\t\tlet inputs;\n\n\t\tnodeObjects( params );\n\n\t\tif ( params[ 0 ] && params[ 0 ].isNode ) {\n\n\t\t\tinputs = [ ...params ];\n\n\t\t} else {\n\n\t\t\tinputs = params[ 0 ];\n\n\t\t}\n\n\t\treturn shaderNode.call( inputs );\n\n\t};\n\n\tfn.shaderNode = shaderNode;\n\tfn.setLayout = ( layout ) => {\n\n\t\tshaderNode.setLayout( layout );\n\n\t\treturn fn;\n\n\t};\n\n\treturn fn;\n\n};\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ShaderNode', ShaderNode );\n\n//\n\nconst setCurrentStack = ( stack ) => {\n\n\tif ( currentStack === stack ) {\n\n\t\t//throw new Error( 'Stack already defined.' );\n\n\t}\n\n\tcurrentStack = stack;\n\n};\n\nconst getCurrentStack = () => currentStack;\n\nconst If = ( ...params ) => currentStack.if( ...params );\n\nfunction append( node ) {\n\n\tif ( currentStack ) currentStack.add( node );\n\n\treturn node;\n\n}\n\naddNodeElement( 'append', append );\n\n// types\n// @TODO: Maybe export from ConstNode.js?\n\nconst color = new ConvertType( 'color' );\n\nconst float = new ConvertType( 'float', cacheMaps.float );\nconst int = new ConvertType( 'int', cacheMaps.ints );\nconst uint = new ConvertType( 'uint', cacheMaps.uint );\nconst bool = new ConvertType( 'bool', cacheMaps.bool );\n\nconst vec2 = new ConvertType( 'vec2' );\nconst ivec2 = new ConvertType( 'ivec2' );\nconst uvec2 = new ConvertType( 'uvec2' );\nconst bvec2 = new ConvertType( 'bvec2' );\n\nconst vec3 = new ConvertType( 'vec3' );\nconst ivec3 = new ConvertType( 'ivec3' );\nconst uvec3 = new ConvertType( 'uvec3' );\nconst bvec3 = new ConvertType( 'bvec3' );\n\nconst vec4 = new ConvertType( 'vec4' );\nconst ivec4 = new ConvertType( 'ivec4' );\nconst uvec4 = new ConvertType( 'uvec4' );\nconst bvec4 = new ConvertType( 'bvec4' );\n\nconst mat2 = new ConvertType( 'mat2' );\nconst imat2 = new ConvertType( 'imat2' );\nconst umat2 = new ConvertType( 'umat2' );\nconst bmat2 = new ConvertType( 'bmat2' );\n\nconst mat3 = new ConvertType( 'mat3' );\nconst imat3 = new ConvertType( 'imat3' );\nconst umat3 = new ConvertType( 'umat3' );\nconst bmat3 = new ConvertType( 'bmat3' );\n\nconst mat4 = new ConvertType( 'mat4' );\nconst imat4 = new ConvertType( 'imat4' );\nconst umat4 = new ConvertType( 'umat4' );\nconst bmat4 = new ConvertType( 'bmat4' );\n\nconst string = ( value = '' ) => nodeObject( new _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]( value, 'string' ) );\nconst arrayBuffer = ( value ) => nodeObject( new _core_ConstNode_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]( value, 'ArrayBuffer' ) );\n\naddNodeElement( 'color', color );\naddNodeElement( 'float', float );\naddNodeElement( 'int', int );\naddNodeElement( 'uint', uint );\naddNodeElement( 'bool', bool );\naddNodeElement( 'vec2', vec2 );\naddNodeElement( 'ivec2', ivec2 );\naddNodeElement( 'uvec2', uvec2 );\naddNodeElement( 'bvec2', bvec2 );\naddNodeElement( 'vec3', vec3 );\naddNodeElement( 'ivec3', ivec3 );\naddNodeElement( 'uvec3', uvec3 );\naddNodeElement( 'bvec3', bvec3 );\naddNodeElement( 'vec4', vec4 );\naddNodeElement( 'ivec4', ivec4 );\naddNodeElement( 'uvec4', uvec4 );\naddNodeElement( 'bvec4', bvec4 );\naddNodeElement( 'mat2', mat2 );\naddNodeElement( 'imat2', imat2 );\naddNodeElement( 'umat2', umat2 );\naddNodeElement( 'bmat2', bmat2 );\naddNodeElement( 'mat3', mat3 );\naddNodeElement( 'imat3', imat3 );\naddNodeElement( 'umat3', umat3 );\naddNodeElement( 'bmat3', bmat3 );\naddNodeElement( 'mat4', mat4 );\naddNodeElement( 'imat4', imat4 );\naddNodeElement( 'umat4', umat4 );\naddNodeElement( 'bmat4', bmat4 );\naddNodeElement( 'string', string );\naddNodeElement( 'arrayBuffer', arrayBuffer );\n\n// basic nodes\n// HACK - we cannot export them from the corresponding files because of the cyclic dependency\nconst element = nodeProxy( _utils_ArrayElementNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] );\nconst convert = ( node, types ) => nodeObject( new _utils_ConvertNode_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]( nodeObject( node ), types ) );\nconst split = ( node, channels ) => nodeObject( new _utils_SplitNode_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]( nodeObject( node ), channels ) );\n\naddNodeElement( 'element', element );\naddNodeElement( 'convert', convert );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/ArrayElementNode.js": +/*!*************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/ArrayElementNode.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n\n\nclass ArrayElementNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] { // @TODO: If extending from TempNode it breaks webgpu_compute\n\n\tconstructor( node, indexNode ) {\n\n\t\tsuper();\n\n\t\tthis.node = node;\n\t\tthis.indexNode = indexNode;\n\n\t\tthis.isArrayElementNode = true;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.node.getNodeType( builder );\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst nodeSnippet = this.node.build( builder );\n\t\tconst indexSnippet = this.indexNode.build( builder, 'uint' );\n\n\t\treturn `${nodeSnippet}[ ${indexSnippet} ]`;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ArrayElementNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ArrayElementNode', ArrayElementNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/ArrayElementNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/ConvertNode.js": +/*!********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/ConvertNode.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n\n\nclass ConvertNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( node, convertTo ) {\n\n\t\tsuper();\n\n\t\tthis.node = node;\n\t\tthis.convertTo = convertTo;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\tconst requestType = this.node.getNodeType( builder );\n\n\t\tlet convertTo = null;\n\n\t\tfor ( const overloadingType of this.convertTo.split( '|' ) ) {\n\n\t\t\tif ( convertTo === null || builder.getTypeLength( requestType ) === builder.getTypeLength( overloadingType ) ) {\n\n\t\t\t\tconvertTo = overloadingType;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn convertTo;\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.convertTo = this.convertTo;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.convertTo = data.convertTo;\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst node = this.node;\n\t\tconst type = this.getNodeType( builder );\n\n\t\tconst snippet = node.build( builder, type );\n\n\t\treturn builder.format( snippet, type, output );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ConvertNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'ConvertNode', ConvertNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/ConvertNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/DiscardNode.js": +/*!********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/DiscardNode.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ discard: () => (/* binding */ discard),\n/* harmony export */ inlineDiscard: () => (/* binding */ inlineDiscard)\n/* harmony export */ });\n/* harmony import */ var _math_CondNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../math/CondNode.js */ \"./node_modules/three/examples/jsm/nodes/math/CondNode.js\");\n/* harmony import */ var _code_ExpressionNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../code/ExpressionNode.js */ \"./node_modules/three/examples/jsm/nodes/code/ExpressionNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\nlet discardExpression;\n\nclass DiscardNode extends _math_CondNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( condNode ) {\n\n\t\tdiscardExpression = discardExpression || (0,_code_ExpressionNode_js__WEBPACK_IMPORTED_MODULE_1__.expression)( 'discard' );\n\n\t\tsuper( condNode, discardExpression );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DiscardNode);\n\nconst inlineDiscard = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeProxy)( DiscardNode );\nconst discard = ( condNode ) => inlineDiscard( condNode ).append();\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.addNodeElement)( 'discard', discard ); // @TODO: Check... this cause a little confusing using in chaining\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_2__.addNodeClass)( 'DiscardNode', DiscardNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/DiscardNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/EquirectUVNode.js": +/*!***********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/EquirectUVNode.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ equirectUV: () => (/* binding */ equirectUV)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n\n\n\n\n\nclass EquirectUVNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( dirNode = _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_1__.positionWorldDirection ) {\n\n\t\tsuper( 'vec2' );\n\n\t\tthis.dirNode = dirNode;\n\n\t}\n\n\tsetup() {\n\n\t\tconst dir = this.dirNode;\n\n\t\tconst u = dir.z.atan2( dir.x ).mul( 1 / ( Math.PI * 2 ) ).add( 0.5 );\n\t\tconst v = dir.y.clamp( - 1.0, 1.0 ).asin().mul( 1 / Math.PI ).add( 0.5 );\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec2)( u, v );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EquirectUVNode);\n\nconst equirectUV = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( EquirectUVNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_3__.addNodeClass)( 'EquirectUVNode', EquirectUVNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/EquirectUVNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/FunctionOverloadingNode.js": +/*!********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/FunctionOverloadingNode.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ overloadingFn: () => (/* binding */ overloadingFn)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nclass FunctionOverloadingNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( functionNodes = [], ...parametersNodes ) {\n\n\t\tsuper();\n\n\t\tthis.functionNodes = functionNodes;\n\t\tthis.parametersNodes = parametersNodes;\n\n\t\tthis._candidateFnCall = null;\n\n\t}\n\n\tgetNodeType() {\n\n\t\treturn this.functionNodes[ 0 ].shaderNode.layout.type;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst params = this.parametersNodes;\n\n\t\tlet candidateFnCall = this._candidateFnCall;\n\n\t\tif ( candidateFnCall === null ) {\n\n\t\t\tlet candidateFn = null;\n\t\t\tlet candidateScore = - 1;\n\n\t\t\tfor ( const functionNode of this.functionNodes ) {\n\n\t\t\t\tconst shaderNode = functionNode.shaderNode;\n\t\t\t\tconst layout = shaderNode.layout;\n\n\t\t\t\tif ( layout === null ) {\n\n\t\t\t\t\tthrow new Error( 'FunctionOverloadingNode: FunctionNode must be a layout.' );\n\n\t\t\t\t}\n\n\t\t\t\tconst inputs = layout.inputs;\n\n\t\t\t\tif ( params.length === inputs.length ) {\n\n\t\t\t\t\tlet score = 0;\n\n\t\t\t\t\tfor ( let i = 0; i < params.length; i ++ ) {\n\n\t\t\t\t\t\tconst param = params[ i ];\n\t\t\t\t\t\tconst input = inputs[ i ];\n\n\t\t\t\t\t\tif ( param.getNodeType( builder ) === input.type ) {\n\n\t\t\t\t\t\t\tscore ++;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tscore = 0;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( score > candidateScore ) {\n\n\t\t\t\t\t\tcandidateFn = functionNode;\n\t\t\t\t\t\tcandidateScore = score;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._candidateFnCall = candidateFnCall = candidateFn( ...params );\n\n\t\t}\n\n\t\treturn candidateFnCall;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FunctionOverloadingNode);\n\nconst overloadingBaseFn = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( FunctionOverloadingNode );\n\nconst overloadingFn = ( functionNodes ) => ( ...params ) => overloadingBaseFn( functionNodes, ...params );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'FunctionOverloadingNode', FunctionOverloadingNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/FunctionOverloadingNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/JoinNode.js": +/*!*****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/JoinNode.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n\n\n\nclass JoinNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n\n\tconstructor( nodes = [], nodeType = null ) {\n\n\t\tsuper( nodeType );\n\n\t\tthis.nodes = nodes;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\tif ( this.nodeType !== null ) {\n\n\t\t\treturn builder.getVectorType( this.nodeType );\n\n\t\t}\n\n\t\treturn builder.getTypeFromLength( this.nodes.reduce( ( count, cur ) => count + builder.getTypeLength( cur.getNodeType( builder ) ), 0 ) );\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst type = this.getNodeType( builder );\n\t\tconst nodes = this.nodes;\n\n\t\tconst primitiveType = builder.getComponentType( type );\n\n\t\tconst snippetValues = [];\n\n\t\tfor ( const input of nodes ) {\n\n\t\t\tlet inputSnippet = input.build( builder );\n\n\t\t\tconst inputPrimitiveType = builder.getComponentType( input.getNodeType( builder ) );\n\n\t\t\tif ( inputPrimitiveType !== primitiveType ) {\n\n\t\t\t\tinputSnippet = builder.format( inputSnippet, inputPrimitiveType, primitiveType );\n\n\t\t\t}\n\n\t\t\tsnippetValues.push( inputSnippet );\n\n\t\t}\n\n\t\tconst snippet = `${ builder.getType( type ) }( ${ snippetValues.join( ', ' ) } )`;\n\n\t\treturn builder.format( snippet, type, output );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (JoinNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'JoinNode', JoinNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/JoinNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/LoopNode.js": +/*!*****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/LoopNode.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Break: () => (/* binding */ Break),\n/* harmony export */ Continue: () => (/* binding */ Continue),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ loop: () => (/* binding */ loop)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _code_ExpressionNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../code/ExpressionNode.js */ \"./node_modules/three/examples/jsm/nodes/code/ExpressionNode.js\");\n/* harmony import */ var _core_BypassNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/BypassNode.js */ \"./node_modules/three/examples/jsm/nodes/core/BypassNode.js\");\n/* harmony import */ var _core_ContextNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/ContextNode.js */ \"./node_modules/three/examples/jsm/nodes/core/ContextNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\nclass LoopNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( params = [] ) {\n\n\t\tsuper();\n\n\t\tthis.params = params;\n\n\t}\n\n\tgetVarName( index ) {\n\n\t\treturn String.fromCharCode( 'i'.charCodeAt() + index );\n\n\t}\n\n\tgetProperties( builder ) {\n\n\t\tconst properties = builder.getNodeProperties( this );\n\n\t\tif ( properties.stackNode !== undefined ) return properties;\n\n\t\t//\n\n\t\tconst inputs = {};\n\n\t\tfor ( let i = 0, l = this.params.length - 1; i < l; i ++ ) {\n\n\t\t\tconst param = this.params[ i ];\n\n\t\t\tconst name = ( param.isNode !== true && param.name ) || this.getVarName( i );\n\t\t\tconst type = ( param.isNode !== true && param.type ) || 'int';\n\n\t\t\tinputs[ name ] = (0,_code_ExpressionNode_js__WEBPACK_IMPORTED_MODULE_1__.expression)( name, type );\n\n\t\t}\n\n\t\tproperties.returnsNode = this.params[ this.params.length - 1 ]( inputs, builder.addStack(), builder );\n\t\tproperties.stackNode = builder.removeStack();\n\n\t\treturn properties;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\tconst { returnsNode } = this.getProperties( builder );\n\n\t\treturn returnsNode ? returnsNode.getNodeType( builder ) : 'void';\n\n\t}\n\n\tsetup( builder ) {\n\n\t\t// setup properties\n\n\t\tthis.getProperties( builder );\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst properties = this.getProperties( builder );\n\n\t\tconst contextData = { tempWrite: false };\n\n\t\tconst params = this.params;\n\t\tconst stackNode = properties.stackNode;\n\n\t\tfor ( let i = 0, l = params.length - 1; i < l; i ++ ) {\n\n\t\t\tconst param = params[ i ];\n\n\t\t\tlet start = null, end = null, name = null, type = null, condition = null, update = null;\n\n\t\t\tif ( param.isNode ) {\n\n\t\t\t\ttype = 'int';\n\t\t\t\tname = this.getVarName( i );\n\t\t\t\tstart = '0';\n\t\t\t\tend = param.build( builder, type );\n\t\t\t\tcondition = '<';\n\n\t\t\t} else {\n\n\t\t\t\ttype = param.type || 'int';\n\t\t\t\tname = param.name || this.getVarName( i );\n\t\t\t\tstart = param.start;\n\t\t\t\tend = param.end;\n\t\t\t\tcondition = param.condition;\n\t\t\t\tupdate = param.update;\n\n\t\t\t\tif ( typeof start === 'number' ) start = start.toString();\n\t\t\t\telse if ( start && start.isNode ) start = start.build( builder, type );\n\n\t\t\t\tif ( typeof end === 'number' ) end = end.toString();\n\t\t\t\telse if ( end && end.isNode ) end = end.build( builder, type );\n\n\t\t\t\tif ( start !== undefined && end === undefined ) {\n\n\t\t\t\t\tstart = start + ' - 1';\n\t\t\t\t\tend = '0';\n\t\t\t\t\tcondition = '>=';\n\n\t\t\t\t} else if ( end !== undefined && start === undefined ) {\n\n\t\t\t\t\tstart = '0';\n\t\t\t\t\tcondition = '<';\n\n\t\t\t\t}\n\n\t\t\t\tif ( condition === undefined ) {\n\n\t\t\t\t\tif ( Number( start ) > Number( end ) ) {\n\n\t\t\t\t\t\tcondition = '>=';\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tcondition = '<';\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst internalParam = { start, end, condition };\n\n\t\t\t//\n\n\t\t\tconst startSnippet = internalParam.start;\n\t\t\tconst endSnippet = internalParam.end;\n\n\t\t\tlet declarationSnippet = '';\n\t\t\tlet conditionalSnippet = '';\n\t\t\tlet updateSnippet = '';\n\n\t\t\tif ( ! update ) {\n\n\t\t\t\tif ( type === 'int' || type === 'uint' ) {\n\n\t\t\t\t\tif ( condition.includes( '<' ) ) update = '++';\n\t\t\t\t\telse update = '--';\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( condition.includes( '<' ) ) update = '+= 1.';\n\t\t\t\t\telse update = '-= 1.';\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tdeclarationSnippet += builder.getVar( type, name ) + ' = ' + startSnippet;\n\n\t\t\tconditionalSnippet += name + ' ' + condition + ' ' + endSnippet;\n\t\t\tupdateSnippet += name + ' ' + update;\n\n\t\t\tconst forSnippet = `for ( ${ declarationSnippet }; ${ conditionalSnippet }; ${ updateSnippet } )`;\n\n\t\t\tbuilder.addFlowCode( ( i === 0 ? '\\n' : '' ) + builder.tab + forSnippet + ' {\\n\\n' ).addFlowTab();\n\n\t\t}\n\n\t\tconst stackSnippet = (0,_core_ContextNode_js__WEBPACK_IMPORTED_MODULE_3__.context)( stackNode, contextData ).build( builder, 'void' );\n\n\t\tconst returnsSnippet = properties.returnsNode ? properties.returnsNode.build( builder ) : '';\n\n\t\tbuilder.removeFlowTab().addFlowCode( '\\n' + builder.tab + stackSnippet );\n\n\t\tfor ( let i = 0, l = this.params.length - 1; i < l; i ++ ) {\n\n\t\t\tbuilder.addFlowCode( ( i === 0 ? '' : builder.tab ) + '}\\n\\n' ).removeFlowTab();\n\n\t\t}\n\n\t\tbuilder.addFlowTab();\n\n\t\treturn returnsSnippet;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LoopNode);\n\nconst loop = ( ...params ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeObject)( new LoopNode( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.nodeArray)( params, 'int' ) ) ).append();\nconst Continue = () => (0,_code_ExpressionNode_js__WEBPACK_IMPORTED_MODULE_1__.expression)( 'continue' ).append();\nconst Break = () => (0,_code_ExpressionNode_js__WEBPACK_IMPORTED_MODULE_1__.expression)( 'break' ).append();\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_4__.addNodeElement)( 'loop', ( returns, ...params ) => (0,_core_BypassNode_js__WEBPACK_IMPORTED_MODULE_2__.bypass)( returns, loop( ...params ) ) );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'LoopNode', LoopNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/LoopNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/MatcapUVNode.js": +/*!*********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/MatcapUVNode.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ matcapUV: () => (/* binding */ matcapUV)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n\n\n\n\n\n\nclass MatcapUVNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor() {\n\n\t\tsuper( 'vec2' );\n\n\t}\n\n\tsetup() {\n\n\t\tconst x = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec3)( _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_2__.positionViewDirection.z, 0, _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_2__.positionViewDirection.x.negate() ).normalize();\n\t\tconst y = _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_2__.positionViewDirection.cross( x );\n\n\t\treturn (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.vec2)( x.dot( _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_1__.transformedNormalView ), y.dot( _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_1__.transformedNormalView ) ).mul( 0.495 ).add( 0.5 );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MatcapUVNode);\n\nconst matcapUV = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_3__.nodeImmutable)( MatcapUVNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_4__.addNodeClass)( 'MatcapUVNode', MatcapUVNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/MatcapUVNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/MaxMipLevelNode.js": +/*!************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/MaxMipLevelNode.js ***! + \************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ maxMipLevel: () => (/* binding */ maxMipLevel)\n/* harmony export */ });\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n\n\n\n\n\nclass MaxMipLevelNode extends _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( textureNode ) {\n\n\t\tsuper( 0 );\n\n\t\tthis.textureNode = textureNode;\n\n\t\tthis.updateType = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeUpdateType.FRAME;\n\n\t}\n\n\tget texture() {\n\n\t\treturn this.textureNode.value;\n\n\t}\n\n\tupdate() {\n\n\t\tconst texture = this.texture;\n\t\tconst images = texture.images;\n\t\tconst image = ( images && images.length > 0 ) ? ( ( images[ 0 ] && images[ 0 ].image ) || images[ 0 ] ) : texture.image;\n\n\t\tif ( image && image.width !== undefined ) {\n\n\t\t\tconst { width, height } = image;\n\n\t\t\tthis.value = Math.log2( Math.max( width, height ) );\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MaxMipLevelNode);\n\nconst maxMipLevel = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( MaxMipLevelNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_3__.addNodeClass)( 'MaxMipLevelNode', MaxMipLevelNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/MaxMipLevelNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/OscNode.js": +/*!****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/OscNode.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ oscSawtooth: () => (/* binding */ oscSawtooth),\n/* harmony export */ oscSine: () => (/* binding */ oscSine),\n/* harmony export */ oscSquare: () => (/* binding */ oscSquare),\n/* harmony export */ oscTriangle: () => (/* binding */ oscTriangle)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _TimerNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TimerNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/TimerNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass OscNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( method = OscNode.SINE, timeNode = (0,_TimerNode_js__WEBPACK_IMPORTED_MODULE_1__.timerLocal)() ) {\n\n\t\tsuper();\n\n\t\tthis.method = method;\n\t\tthis.timeNode = timeNode;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.timeNode.getNodeType( builder );\n\n\t}\n\n\tsetup() {\n\n\t\tconst method = this.method;\n\t\tconst timeNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( this.timeNode );\n\n\t\tlet outputNode = null;\n\n\t\tif ( method === OscNode.SINE ) {\n\n\t\t\toutputNode = timeNode.add( 0.75 ).mul( Math.PI * 2 ).sin().mul( 0.5 ).add( 0.5 );\n\n\t\t} else if ( method === OscNode.SQUARE ) {\n\n\t\t\toutputNode = timeNode.fract().round();\n\n\t\t} else if ( method === OscNode.TRIANGLE ) {\n\n\t\t\toutputNode = timeNode.add( 0.5 ).fract().mul( 2 ).sub( 1 ).abs();\n\n\t\t} else if ( method === OscNode.SAWTOOTH ) {\n\n\t\t\toutputNode = timeNode.fract();\n\n\t\t}\n\n\t\treturn outputNode;\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.method = this.method;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.method = data.method;\n\n\t}\n\n}\n\nOscNode.SINE = 'sine';\nOscNode.SQUARE = 'square';\nOscNode.TRIANGLE = 'triangle';\nOscNode.SAWTOOTH = 'sawtooth';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (OscNode);\n\nconst oscSine = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OscNode, OscNode.SINE );\nconst oscSquare = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OscNode, OscNode.SQUARE );\nconst oscTriangle = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OscNode, OscNode.TRIANGLE );\nconst oscSawtooth = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( OscNode, OscNode.SAWTOOTH );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'OscNode', OscNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/OscNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/PackingNode.js": +/*!********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/PackingNode.js ***! + \********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ colorToDirection: () => (/* binding */ colorToDirection),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ directionToColor: () => (/* binding */ directionToColor)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass PackingNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope, node ) {\n\n\t\tsuper();\n\n\t\tthis.scope = scope;\n\t\tthis.node = node;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.node.getNodeType( builder );\n\n\t}\n\n\tsetup() {\n\n\t\tconst { scope, node } = this;\n\n\t\tlet result = null;\n\n\t\tif ( scope === PackingNode.DIRECTION_TO_COLOR ) {\n\n\t\t\tresult = node.mul( 0.5 ).add( 0.5 );\n\n\t\t} else if ( scope === PackingNode.COLOR_TO_DIRECTION ) {\n\n\t\t\tresult = node.mul( 2.0 ).sub( 1 );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\nPackingNode.DIRECTION_TO_COLOR = 'directionToColor';\nPackingNode.COLOR_TO_DIRECTION = 'colorToDirection';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PackingNode);\n\nconst directionToColor = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( PackingNode, PackingNode.DIRECTION_TO_COLOR );\nconst colorToDirection = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( PackingNode, PackingNode.COLOR_TO_DIRECTION );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'directionToColor', directionToColor );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'colorToDirection', colorToDirection );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'PackingNode', PackingNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/PackingNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/ReflectorNode.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/ReflectorNode.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ reflector: () => (/* binding */ reflector)\n/* harmony export */ });\n/* harmony import */ var _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../accessors/TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../display/ViewportNode.js */ \"./node_modules/three/examples/jsm/nodes/display/ViewportNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\nconst _reflectorPlane = new three__WEBPACK_IMPORTED_MODULE_4__.Plane();\nconst _normal = new three__WEBPACK_IMPORTED_MODULE_4__.Vector3();\nconst _reflectorWorldPosition = new three__WEBPACK_IMPORTED_MODULE_4__.Vector3();\nconst _cameraWorldPosition = new three__WEBPACK_IMPORTED_MODULE_4__.Vector3();\nconst _rotationMatrix = new three__WEBPACK_IMPORTED_MODULE_4__.Matrix4();\nconst _lookAtPosition = new three__WEBPACK_IMPORTED_MODULE_4__.Vector3( 0, 0, - 1 );\nconst clipPlane = new three__WEBPACK_IMPORTED_MODULE_4__.Vector4();\n\nconst _view = new three__WEBPACK_IMPORTED_MODULE_4__.Vector3();\nconst _target = new three__WEBPACK_IMPORTED_MODULE_4__.Vector3();\nconst _q = new three__WEBPACK_IMPORTED_MODULE_4__.Vector4();\n\nconst _size = new three__WEBPACK_IMPORTED_MODULE_4__.Vector2();\n\nconst _defaultRT = new three__WEBPACK_IMPORTED_MODULE_4__.RenderTarget();\nconst _defaultUV = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.vec2)( _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_3__.viewportTopLeft.x.oneMinus(), _display_ViewportNode_js__WEBPACK_IMPORTED_MODULE_3__.viewportTopLeft.y );\n\nlet _inReflector = false;\n\nclass ReflectorNode extends _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( parameters = {} ) {\n\n\t\tsuper( _defaultRT.texture, _defaultUV );\n\n\t\tconst {\n\t\t\ttarget = new three__WEBPACK_IMPORTED_MODULE_4__.Object3D(),\n\t\t\tresolution = 1,\n\t\t\tgenerateMipmaps = false,\n\t\t\tbounces = true\n\t\t} = parameters;\n\n\t\t//\n\n\t\tthis.target = target;\n\t\tthis.resolution = resolution;\n\t\tthis.generateMipmaps = generateMipmaps;\n\t\tthis.bounces = bounces;\n\n\t\tthis.updateBeforeType = bounces ? _core_constants_js__WEBPACK_IMPORTED_MODULE_2__.NodeUpdateType.RENDER : _core_constants_js__WEBPACK_IMPORTED_MODULE_2__.NodeUpdateType.FRAME;\n\n\t\tthis.virtualCameras = new WeakMap();\n\t\tthis.renderTargets = new WeakMap();\n\n\n\t}\n\n\t_updateResolution( renderTarget, renderer ) {\n\n\t\tconst resolution = this.resolution;\n\n\t\trenderer.getDrawingBufferSize( _size );\n\n\t\trenderTarget.setSize( Math.round( _size.width * resolution ), Math.round( _size.height * resolution ) );\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tthis._updateResolution( _defaultRT, builder.renderer );\n\n\t\treturn super.setup( builder );\n\n\t}\n\n\tgetTextureNode() {\n\n\t\treturn this.textureNode;\n\n\t}\n\n\tgetVirtualCamera( camera ) {\n\n\t\tlet virtualCamera = this.virtualCameras.get( camera );\n\n\t\tif ( virtualCamera === undefined ) {\n\n\t\t\tvirtualCamera = camera.clone();\n\n\t\t\tthis.virtualCameras.set( camera, virtualCamera );\n\n\t\t}\n\n\t\treturn virtualCamera;\n\n\t}\n\n\tgetRenderTarget( camera ) {\n\n\t\tlet renderTarget = this.renderTargets.get( camera );\n\n\t\tif ( renderTarget === undefined ) {\n\n\t\t\trenderTarget = new three__WEBPACK_IMPORTED_MODULE_4__.RenderTarget( 0, 0, { type: three__WEBPACK_IMPORTED_MODULE_4__.HalfFloatType } );\n\n\t\t\tif ( this.generateMipmaps === true ) {\n\n\t\t\t renderTarget.texture.minFilter = three__WEBPACK_IMPORTED_MODULE_4__.LinearMipMapLinearFilter;\n\t\t\t renderTarget.texture.generateMipmaps = true;\n\n\t\t\t}\n\n\t\t\tthis.renderTargets.set( camera, renderTarget );\n\n\t\t}\n\n\t\treturn renderTarget;\n\n\t}\n\n\tupdateBefore( frame ) {\n\n\t\tif ( this.bounces === false && _inReflector ) return false;\n\n\t\t_inReflector = true;\n\n\t\tconst { scene, camera, renderer, material } = frame;\n\t\tconst { target } = this;\n\n\t\tconst virtualCamera = this.getVirtualCamera( camera );\n\t\tconst renderTarget = this.getRenderTarget( virtualCamera );\n\n\t\trenderer.getDrawingBufferSize( _size );\n\n\t\tthis._updateResolution( renderTarget, renderer );\n\n\t\t//\n\n\t\t_reflectorWorldPosition.setFromMatrixPosition( target.matrixWorld );\n\t\t_cameraWorldPosition.setFromMatrixPosition( camera.matrixWorld );\n\n\t\t_rotationMatrix.extractRotation( target.matrixWorld );\n\n\t\t_normal.set( 0, 0, 1 );\n\t\t_normal.applyMatrix4( _rotationMatrix );\n\n\t\t_view.subVectors( _reflectorWorldPosition, _cameraWorldPosition );\n\n\t\t// Avoid rendering when reflector is facing away\n\n\t\tif ( _view.dot( _normal ) > 0 ) return;\n\n\t\t_view.reflect( _normal ).negate();\n\t\t_view.add( _reflectorWorldPosition );\n\n\t\t_rotationMatrix.extractRotation( camera.matrixWorld );\n\n\t\t_lookAtPosition.set( 0, 0, - 1 );\n\t\t_lookAtPosition.applyMatrix4( _rotationMatrix );\n\t\t_lookAtPosition.add( _cameraWorldPosition );\n\n\t\t_target.subVectors( _reflectorWorldPosition, _lookAtPosition );\n\t\t_target.reflect( _normal ).negate();\n\t\t_target.add( _reflectorWorldPosition );\n\n\t\t//\n\n\t\tvirtualCamera.coordinateSystem = camera.coordinateSystem;\n\t\tvirtualCamera.position.copy( _view );\n\t\tvirtualCamera.up.set( 0, 1, 0 );\n\t\tvirtualCamera.up.applyMatrix4( _rotationMatrix );\n\t\tvirtualCamera.up.reflect( _normal );\n\t\tvirtualCamera.lookAt( _target );\n\n\t\tvirtualCamera.near = camera.near;\n\t\tvirtualCamera.far = camera.far;\n\n\t\tvirtualCamera.updateMatrixWorld();\n\t\tvirtualCamera.projectionMatrix.copy( camera.projectionMatrix );\n\n\t\t// Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html\n\t\t// Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf\n\t\t_reflectorPlane.setFromNormalAndCoplanarPoint( _normal, _reflectorWorldPosition );\n\t\t_reflectorPlane.applyMatrix4( virtualCamera.matrixWorldInverse );\n\n\t\tclipPlane.set( _reflectorPlane.normal.x, _reflectorPlane.normal.y, _reflectorPlane.normal.z, _reflectorPlane.constant );\n\n\t\tconst projectionMatrix = virtualCamera.projectionMatrix;\n\n\t\t_q.x = ( Math.sign( clipPlane.x ) + projectionMatrix.elements[ 8 ] ) / projectionMatrix.elements[ 0 ];\n\t\t_q.y = ( Math.sign( clipPlane.y ) + projectionMatrix.elements[ 9 ] ) / projectionMatrix.elements[ 5 ];\n\t\t_q.z = - 1.0;\n\t\t_q.w = ( 1.0 + projectionMatrix.elements[ 10 ] ) / projectionMatrix.elements[ 14 ];\n\n\t\t// Calculate the scaled plane vector\n\t\tclipPlane.multiplyScalar( 1.0 / clipPlane.dot( _q ) );\n\n\t\tconst clipBias = 0;\n\n\t\t// Replacing the third row of the projection matrix\n\t\tprojectionMatrix.elements[ 2 ] = clipPlane.x;\n\t\tprojectionMatrix.elements[ 6 ] = clipPlane.y;\n\t\tprojectionMatrix.elements[ 10 ] = clipPlane.z - clipBias;\n\t\tprojectionMatrix.elements[ 14 ] = clipPlane.w;\n\n\t\t//\n\n\t\tthis.value = renderTarget.texture;\n\n\t\tmaterial.visible = false;\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\trenderer.setRenderTarget( renderTarget );\n\n\t\trenderer.render( scene, virtualCamera );\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t\tmaterial.visible = true;\n\n\t\t_inReflector = false;\n\n\t}\n\n}\n\nconst reflector = ( parameters ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeObject)( new ReflectorNode( parameters ) );\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ReflectorNode);\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/ReflectorNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/RemapNode.js": +/*!******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/RemapNode.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ remap: () => (/* binding */ remap),\n/* harmony export */ remapClamp: () => (/* binding */ remapClamp)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\nclass RemapNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( node, inLowNode, inHighNode, outLowNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( 0 ), outHighNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.float)( 1 ) ) {\n\n\t\tsuper();\n\n\t\tthis.node = node;\n\t\tthis.inLowNode = inLowNode;\n\t\tthis.inHighNode = inHighNode;\n\t\tthis.outLowNode = outLowNode;\n\t\tthis.outHighNode = outHighNode;\n\n\t\tthis.doClamp = true;\n\n\t}\n\n\tsetup() {\n\n\t\tconst { node, inLowNode, inHighNode, outLowNode, outHighNode, doClamp } = this;\n\n\t\tlet t = node.sub( inLowNode ).div( inHighNode.sub( inLowNode ) );\n\n\t\tif ( doClamp === true ) t = t.clamp();\n\n\t\treturn t.mul( outHighNode.sub( outLowNode ) ).add( outLowNode );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RemapNode);\n\nconst remap = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( RemapNode, null, null, { doClamp: false } );\nconst remapClamp = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( RemapNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'remap', remap );\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'remapClamp', remapClamp );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'RemapNode', RemapNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/RemapNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/RotateNode.js": +/*!*******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/RotateNode.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ rotate: () => (/* binding */ rotate)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../math/MathNode.js */ \"./node_modules/three/examples/jsm/nodes/math/MathNode.js\");\n\n\n\n\n\nclass RotateNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( positionNode, rotationNode ) {\n\n\t\tsuper();\n\n\t\tthis.positionNode = positionNode;\n\t\tthis.rotationNode = rotationNode;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.positionNode.getNodeType( builder );\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tconst { rotationNode, positionNode } = this;\n\n\t\tconst nodeType = this.getNodeType( builder );\n\n\t\tif ( nodeType === 'vec2' ) {\n\n\t\t\tconst cosAngle = rotationNode.cos();\n\t\t\tconst sinAngle = rotationNode.sin();\n\n\t\t\tconst rotationMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.mat2)(\n\t\t\t\tcosAngle, sinAngle,\n\t\t\t\tsinAngle.negate(), cosAngle\n\t\t\t);\n\n\t\t\treturn rotationMatrix.mul( positionNode );\n\n\t\t} else {\n\n\t\t\tconst rotation = rotationNode;\n\t\t\tconst rotationXMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.mat4)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( 1.0, 0.0, 0.0, 0.0 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( 0.0, (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.cos)( rotation.x ), (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.sin)( rotation.x ).negate(), 0.0 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( 0.0, (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.sin)( rotation.x ), (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.cos)( rotation.x ), 0.0 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( 0.0, 0.0, 0.0, 1.0 ) );\n\t\t\tconst rotationYMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.mat4)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.cos)( rotation.y ), 0.0, (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.sin)( rotation.y ), 0.0 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( 0.0, 1.0, 0.0, 0.0 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.sin)( rotation.y ).negate(), 0.0, (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.cos)( rotation.y ), 0.0 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( 0.0, 0.0, 0.0, 1.0 ) );\n\t\t\tconst rotationZMatrix = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.mat4)( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.cos)( rotation.z ), (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.sin)( rotation.z ).negate(), 0.0, 0.0 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.sin)( rotation.z ), (0,_math_MathNode_js__WEBPACK_IMPORTED_MODULE_3__.cos)( rotation.z ), 0.0, 0.0 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( 0.0, 0.0, 1.0, 0.0 ), (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( 0.0, 0.0, 0.0, 1.0 ) );\n\n\t\t\treturn rotationXMatrix.mul( rotationYMatrix ).mul( rotationZMatrix ).mul( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec4)( positionNode, 1.0 ) ).xyz;\n\n\t\t}\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RotateNode);\n\nconst rotate = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( RotateNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'rotate', rotate );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'RotateNode', RotateNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/RotateNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/RotateUVNode.js": +/*!*********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/RotateUVNode.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ rotateUV: () => (/* binding */ rotateUV)\n/* harmony export */ });\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass RotateUVNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( uvNode, rotationNode, centerNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec2)( 0.5 ) ) {\n\n\t\tsuper( 'vec2' );\n\n\t\tthis.uvNode = uvNode;\n\t\tthis.rotationNode = rotationNode;\n\t\tthis.centerNode = centerNode;\n\n\t}\n\n\tsetup() {\n\n\t\tconst { uvNode, rotationNode, centerNode } = this;\n\n\t\tconst vector = uvNode.sub( centerNode );\n\n\t\treturn vector.rotate( rotationNode ).add( centerNode );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RotateUVNode);\n\nconst rotateUV = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( RotateUVNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.addNodeElement)( 'rotateUV', rotateUV );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_1__.addNodeClass)( 'RotateUVNode', RotateUVNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/RotateUVNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/SetNode.js": +/*!****************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/SetNode.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_TempNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/TempNode.js */ \"./node_modules/three/examples/jsm/nodes/core/TempNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n\n\n\n\nclass SetNode extends _core_TempNode_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n\n\tconstructor( sourceNode, components, targetNode ) {\n\n\t\tsuper();\n\n\t\tthis.sourceNode = sourceNode;\n\t\tthis.components = components;\n\t\tthis.targetNode = targetNode;\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn this.sourceNode.getNodeType( builder );\n\n\t}\n\n\tgenerate( builder ) {\n\n\t\tconst { sourceNode, components, targetNode } = this;\n\n\t\tconst sourceType = this.getNodeType( builder );\n\t\tconst targetType = builder.getTypeFromLength( components.length );\n\n\t\tconst targetSnippet = targetNode.build( builder, targetType );\n\t\tconst sourceSnippet = sourceNode.build( builder, sourceType );\n\n\t\tconst length = builder.getTypeLength( sourceType );\n\t\tconst snippetValues = [];\n\n\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\tconst component = _core_constants_js__WEBPACK_IMPORTED_MODULE_2__.vectorComponents[ i ];\n\n\t\t\tif ( component === components[ 0 ] ) {\n\n\t\t\t\tsnippetValues.push( targetSnippet );\n\n\t\t\t\ti += components.length - 1;\n\n\t\t\t} else {\n\n\t\t\t\tsnippetValues.push( sourceSnippet + '.' + component );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn `${ builder.getType( sourceType ) }( ${ snippetValues.join( ', ' ) } )`;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SetNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'SetNode', SetNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/SetNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/SplitNode.js": +/*!******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/SplitNode.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n\n\n\nconst stringVectorComponents = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.vectorComponents.join( '' );\n\nclass SplitNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( node, components = 'x' ) {\n\n\t\tsuper();\n\n\t\tthis.node = node;\n\t\tthis.components = components;\n\n\t\tthis.isSplitNode = true;\n\n\t}\n\n\tgetVectorLength() {\n\n\t\tlet vectorLength = this.components.length;\n\n\t\tfor ( const c of this.components ) {\n\n\t\t\tvectorLength = Math.max( _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.vectorComponents.indexOf( c ) + 1, vectorLength );\n\n\t\t}\n\n\t\treturn vectorLength;\n\n\t}\n\n\tgetComponentType( builder ) {\n\n\t\treturn builder.getComponentType( this.node.getNodeType( builder ) );\n\n\t}\n\n\tgetNodeType( builder ) {\n\n\t\treturn builder.getTypeFromLength( this.components.length, this.getComponentType( builder ) );\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tconst node = this.node;\n\t\tconst nodeTypeLength = builder.getTypeLength( node.getNodeType( builder ) );\n\n\t\tlet snippet = null;\n\n\t\tif ( nodeTypeLength > 1 ) {\n\n\t\t\tlet type = null;\n\n\t\t\tconst componentsLength = this.getVectorLength();\n\n\t\t\tif ( componentsLength >= nodeTypeLength ) {\n\n\t\t\t\t// needed expand the input node\n\n\t\t\t\ttype = builder.getTypeFromLength( this.getVectorLength(), this.getComponentType( builder ) );\n\n\t\t\t}\n\n\t\t\tconst nodeSnippet = node.build( builder, type );\n\n\t\t\tif ( this.components.length === nodeTypeLength && this.components === stringVectorComponents.slice( 0, this.components.length ) ) {\n\n\t\t\t\t// unnecessary swizzle\n\n\t\t\t\tsnippet = builder.format( nodeSnippet, type, output );\n\n\t\t\t} else {\n\n\t\t\t\tsnippet = builder.format( `${nodeSnippet}.${this.components}`, this.getNodeType( builder ), output );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// ignore .components if .node returns float/integer\n\n\t\t\tsnippet = node.build( builder, output );\n\n\t\t}\n\n\t\treturn snippet;\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.components = this.components;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.components = data.components;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SplitNode);\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'SplitNode', SplitNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/SplitNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/SpriteSheetUVNode.js": +/*!**************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/SpriteSheetUVNode.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ spritesheetUV: () => (/* binding */ spritesheetUV)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../accessors/UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\nclass SpriteSheetUVNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( countNode, uvNode = (0,_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_1__.uv)(), frameNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.float)( 0 ) ) {\n\n\t\tsuper( 'vec2' );\n\n\t\tthis.countNode = countNode;\n\t\tthis.uvNode = uvNode;\n\t\tthis.frameNode = frameNode;\n\n\t}\n\n\tsetup() {\n\n\t\tconst { frameNode, uvNode, countNode } = this;\n\n\t\tconst { width, height } = countNode;\n\n\t\tconst frameNum = frameNode.mod( width.mul( height ) ).floor();\n\n\t\tconst column = frameNum.mod( width );\n\t\tconst row = height.sub( frameNum.add( 1 ).div( width ).ceil() );\n\n\t\tconst scale = countNode.reciprocal();\n\t\tconst uvFrameOffset = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.vec2)( column, row );\n\n\t\treturn uvNode.add( uvFrameOffset ).mul( scale );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SpriteSheetUVNode);\n\nconst spritesheetUV = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeProxy)( SpriteSheetUVNode );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'SpriteSheetUVNode', SpriteSheetUVNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/SpriteSheetUVNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/StorageArrayElementNode.js": +/*!********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/StorageArrayElementNode.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ storageElement: () => (/* binding */ storageElement)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _ArrayElementNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ArrayElementNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/ArrayElementNode.js\");\n\n\n\n\nclass StorageArrayElementNode extends _ArrayElementNode_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n\n\tconstructor( storageBufferNode, indexNode ) {\n\n\t\tsuper( storageBufferNode, indexNode );\n\n\t\tthis.isStorageArrayElementNode = true;\n\n\t}\n\n\tset storageBufferNode( value ) {\n\n\t\tthis.node = value;\n\n\t}\n\n\tget storageBufferNode() {\n\n\t\treturn this.node;\n\n\t}\n\n\tsetup( builder ) {\n\n\t\tif ( builder.isAvailable( 'storageBuffer' ) === false ) {\n\n\t\t\tif ( ! this.node.instanceIndex && this.node.bufferObject === true ) {\n\n\t\t\t\tbuilder.setupPBO( this.node );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn super.setup( builder );\n\n\t}\n\n\tgenerate( builder, output ) {\n\n\t\tlet snippet;\n\n\t\tconst isAssignContext = builder.context.assign;\n\n\t\t//\n\n\t\tif ( builder.isAvailable( 'storageBuffer' ) === false ) {\n\n\t\t\tconst { node } = this;\n\n\t\t\tif ( ! node.instanceIndex && this.node.bufferObject === true && isAssignContext !== true ) {\n\n\t\t\t\tsnippet = builder.generatePBO( this );\n\n\t\t\t} else {\n\n\t\t\t\tsnippet = node.build( builder );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tsnippet = super.generate( builder );\n\n\t\t}\n\n\t\tif ( isAssignContext !== true ) {\n\n\t\t\tconst type = this.getNodeType( builder );\n\n\t\t\tsnippet = builder.format( snippet, type, output );\n\n\t\t}\n\n\t\treturn snippet;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StorageArrayElementNode);\n\nconst storageElement = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.nodeProxy)( StorageArrayElementNode );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_1__.addNodeElement)( 'storageElement', storageElement );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'StorageArrayElementNode', StorageArrayElementNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/StorageArrayElementNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/TimerNode.js": +/*!******************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/TimerNode.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ frameId: () => (/* binding */ frameId),\n/* harmony export */ timerDelta: () => (/* binding */ timerDelta),\n/* harmony export */ timerGlobal: () => (/* binding */ timerGlobal),\n/* harmony export */ timerLocal: () => (/* binding */ timerLocal)\n/* harmony export */ });\n/* harmony import */ var _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _core_constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/constants.js */ \"./node_modules/three/examples/jsm/nodes/core/constants.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n\n\n\n\n\nclass TimerNode extends _core_UniformNode_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( scope = TimerNode.LOCAL, scale = 1, value = 0 ) {\n\n\t\tsuper( value );\n\n\t\tthis.scope = scope;\n\t\tthis.scale = scale;\n\n\t\tthis.updateType = _core_constants_js__WEBPACK_IMPORTED_MODULE_1__.NodeUpdateType.FRAME;\n\n\t}\n\t/*\n\t@TODO:\n\tgetNodeType( builder ) {\n\n\t\tconst scope = this.scope;\n\n\t\tif ( scope === TimerNode.FRAME ) {\n\n\t\t\treturn 'uint';\n\n\t\t}\n\n\t\treturn 'float';\n\n\t}\n*/\n\tupdate( frame ) {\n\n\t\tconst scope = this.scope;\n\t\tconst scale = this.scale;\n\n\t\tif ( scope === TimerNode.LOCAL ) {\n\n\t\t\tthis.value += frame.deltaTime * scale;\n\n\t\t} else if ( scope === TimerNode.DELTA ) {\n\n\t\t\tthis.value = frame.deltaTime * scale;\n\n\t\t} else if ( scope === TimerNode.FRAME ) {\n\n\t\t\tthis.value = frame.frameId;\n\n\t\t} else {\n\n\t\t\t// global\n\n\t\t\tthis.value = frame.time * scale;\n\n\t\t}\n\n\t}\n\n\tserialize( data ) {\n\n\t\tsuper.serialize( data );\n\n\t\tdata.scope = this.scope;\n\t\tdata.scale = this.scale;\n\n\t}\n\n\tdeserialize( data ) {\n\n\t\tsuper.deserialize( data );\n\n\t\tthis.scope = data.scope;\n\t\tthis.scale = data.scale;\n\n\t}\n\n}\n\nTimerNode.LOCAL = 'local';\nTimerNode.GLOBAL = 'global';\nTimerNode.DELTA = 'delta';\nTimerNode.FRAME = 'frame';\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TimerNode);\n\n// @TODO: add support to use node in timeScale\nconst timerLocal = ( timeScale, value = 0 ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new TimerNode( TimerNode.LOCAL, timeScale, value ) );\nconst timerGlobal = ( timeScale, value = 0 ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new TimerNode( TimerNode.GLOBAL, timeScale, value ) );\nconst timerDelta = ( timeScale, value = 0 ) => (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeObject)( new TimerNode( TimerNode.DELTA, timeScale, value ) );\nconst frameId = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_2__.nodeImmutable)( TimerNode, TimerNode.FRAME ).uint();\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_3__.addNodeClass)( 'TimerNode', TimerNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/TimerNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/nodes/utils/TriplanarTexturesNode.js": +/*!******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/nodes/utils/TriplanarTexturesNode.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ triplanarTexture: () => (/* binding */ triplanarTexture),\n/* harmony export */ triplanarTextures: () => (/* binding */ triplanarTextures)\n/* harmony export */ });\n/* harmony import */ var _core_Node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Node.js */ \"./node_modules/three/examples/jsm/nodes/core/Node.js\");\n/* harmony import */ var _math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../math/OperatorNode.js */ \"./node_modules/three/examples/jsm/nodes/math/OperatorNode.js\");\n/* harmony import */ var _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../accessors/NormalNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/NormalNode.js\");\n/* harmony import */ var _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accessors/TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n\n\n\n\n\n\n\nclass TriplanarTexturesNode extends _core_Node_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n\n\tconstructor( textureXNode, textureYNode = null, textureZNode = null, scaleNode = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.float)( 1 ), positionNode = _accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_3__.positionLocal, normalNode = _accessors_NormalNode_js__WEBPACK_IMPORTED_MODULE_2__.normalLocal ) {\n\n\t\tsuper( 'vec4' );\n\n\t\tthis.textureXNode = textureXNode;\n\t\tthis.textureYNode = textureYNode;\n\t\tthis.textureZNode = textureZNode;\n\n\t\tthis.scaleNode = scaleNode;\n\n\t\tthis.positionNode = positionNode;\n\t\tthis.normalNode = normalNode;\n\n\t}\n\n\tsetup() {\n\n\t\tconst { textureXNode, textureYNode, textureZNode, scaleNode, positionNode, normalNode } = this;\n\n\t\t// Ref: https://github.com/keijiro/StandardTriplanar\n\n\t\t// Blending factor of triplanar mapping\n\t\tlet bf = normalNode.abs().normalize();\n\t\tbf = bf.div( bf.dot( (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.vec3)( 1.0 ) ) );\n\n\t\t// Triplanar mapping\n\t\tconst tx = positionNode.yz.mul( scaleNode );\n\t\tconst ty = positionNode.zx.mul( scaleNode );\n\t\tconst tz = positionNode.xy.mul( scaleNode );\n\n\t\t// Base color\n\t\tconst textureX = textureXNode.value;\n\t\tconst textureY = textureYNode !== null ? textureYNode.value : textureX;\n\t\tconst textureZ = textureZNode !== null ? textureZNode.value : textureX;\n\n\t\tconst cx = (0,_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_4__.texture)( textureX, tx ).mul( bf.x );\n\t\tconst cy = (0,_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_4__.texture)( textureY, ty ).mul( bf.y );\n\t\tconst cz = (0,_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_4__.texture)( textureZ, tz ).mul( bf.z );\n\n\t\treturn (0,_math_OperatorNode_js__WEBPACK_IMPORTED_MODULE_1__.add)( cx, cy, cz );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TriplanarTexturesNode);\n\nconst triplanarTextures = (0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.nodeProxy)( TriplanarTexturesNode );\nconst triplanarTexture = ( ...params ) => triplanarTextures( ...params );\n\n(0,_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_5__.addNodeElement)( 'triplanarTexture', triplanarTexture );\n\n(0,_core_Node_js__WEBPACK_IMPORTED_MODULE_0__.addNodeClass)( 'TriplanarTexturesNode', TriplanarTexturesNode );\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/nodes/utils/TriplanarTexturesNode.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/objects/QuadMesh.js": +/*!*************************************************************!*\ + !*** ./node_modules/three/examples/jsm/objects/QuadMesh.js ***! + \*************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n// Helper for passes that need to fill the viewport with a single quad.\n\nconst _camera = new three__WEBPACK_IMPORTED_MODULE_0__.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n\n// https://github.com/mrdoob/three.js/pull/21358\n\nclass QuadGeometry extends three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry {\n\n\tconstructor( flipY = false ) {\n\n\t\tsuper();\n\n\t\tconst uv = flipY === false ? [ 0, - 1, 0, 1, 2, 1 ] : [ 0, 2, 0, 0, 2, 0 ];\n\n\t\tthis.setAttribute( 'position', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );\n\t\tthis.setAttribute( 'uv', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( uv, 2 ) );\n\n\t}\n\n}\n\nconst _geometry = new QuadGeometry();\n\nclass QuadMesh extends three__WEBPACK_IMPORTED_MODULE_0__.Mesh {\n\n\tconstructor( material = null ) {\n\n\t\tsuper( _geometry, material );\n\n\t\tthis.camera = _camera;\n\n\t}\n\n\trenderAsync( renderer ) {\n\n\t\treturn renderer.renderAsync( this, _camera );\n\n\t}\n\n\trender( renderer ) {\n\n\t\trenderer.render( this, _camera );\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (QuadMesh);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/objects/QuadMesh.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/renderers/common/ChainMap.js": +/*!**********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/renderers/common/ChainMap.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ ChainMap)\n/* harmony export */ });\nclass ChainMap {\n\n\tconstructor() {\n\n\t\tthis.weakMap = new WeakMap();\n\n\t}\n\n\tget( keys ) {\n\n\t\tif ( Array.isArray( keys ) ) {\n\n\t\t\tlet map = this.weakMap;\n\n\t\t\tfor ( let i = 0; i < keys.length; i ++ ) {\n\n\t\t\t\tmap = map.get( keys[ i ] );\n\n\t\t\t\tif ( map === undefined ) return undefined;\n\n\t\t\t}\n\n\t\t\treturn map.get( keys[ keys.length - 1 ] );\n\n\t\t} else {\n\n\t\t\treturn super.get( keys );\n\n\t\t}\n\n\t}\n\n\tset( keys, value ) {\n\n\t\tif ( Array.isArray( keys ) ) {\n\n\t\t\tlet map = this.weakMap;\n\n\t\t\tfor ( let i = 0; i < keys.length; i ++ ) {\n\n\t\t\t\tconst key = keys[ i ];\n\n\t\t\t\tif ( map.has( key ) === false ) map.set( key, new WeakMap() );\n\n\t\t\t\tmap = map.get( key );\n\n\t\t\t}\n\n\t\t\treturn map.set( keys[ keys.length - 1 ], value );\n\n\t\t} else {\n\n\t\t\treturn super.set( keys, value );\n\n\t\t}\n\n\t}\n\n\tdelete( keys ) {\n\n\t\tif ( Array.isArray( keys ) ) {\n\n\t\t\tlet map = this.weakMap;\n\n\t\t\tfor ( let i = 0; i < keys.length; i ++ ) {\n\n\t\t\t\tmap = map.get( keys[ i ] );\n\n\t\t\t\tif ( map === undefined ) return false;\n\n\t\t\t}\n\n\t\t\treturn map.delete( keys[ keys.length - 1 ] );\n\n\t\t} else {\n\n\t\t\treturn super.delete( keys );\n\n\t\t}\n\n\t}\n\n\tdispose() {\n\n\t\tthis.weakMap.clear();\n\n\t}\n\n}\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/renderers/common/ChainMap.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/renderers/common/CubeRenderTarget.js": +/*!******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/renderers/common/CubeRenderTarget.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _nodes_utils_EquirectUVNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../nodes/utils/EquirectUVNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/EquirectUVNode.js\");\n/* harmony import */ var _nodes_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../nodes/accessors/TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _nodes_accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../nodes/accessors/PositionNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/PositionNode.js\");\n/* harmony import */ var _nodes_materials_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../nodes/materials/NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n\n\n\n\n\n\n// @TODO: Consider rename WebGLCubeRenderTarget to just CubeRenderTarget\n\nclass CubeRenderTarget extends three__WEBPACK_IMPORTED_MODULE_4__.WebGLCubeRenderTarget {\n\n\tconstructor( size = 1, options = {} ) {\n\n\t\tsuper( size, options );\n\n\t\tthis.isCubeRenderTarget = true;\n\n\t}\n\n\tfromEquirectangularTexture( renderer, texture ) {\n\n\t\tconst currentMinFilter = texture.minFilter;\n\t\tconst currentGenerateMipmaps = texture.generateMipmaps;\n\n\t\ttexture.generateMipmaps = true;\n\n\t\tthis.texture.type = texture.type;\n\t\tthis.texture.colorSpace = texture.colorSpace;\n\n\t\tthis.texture.generateMipmaps = texture.generateMipmaps;\n\t\tthis.texture.minFilter = texture.minFilter;\n\t\tthis.texture.magFilter = texture.magFilter;\n\n\t\tconst geometry = new three__WEBPACK_IMPORTED_MODULE_4__.BoxGeometry( 5, 5, 5 );\n\n\t\tconst uvNode = (0,_nodes_utils_EquirectUVNode_js__WEBPACK_IMPORTED_MODULE_0__.equirectUV)( _nodes_accessors_PositionNode_js__WEBPACK_IMPORTED_MODULE_2__.positionWorldDirection );\n\n\t\tconst material = (0,_nodes_materials_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_3__.createNodeMaterialFromType)( 'MeshBasicNodeMaterial' );\n\t\tmaterial.colorNode = (0,_nodes_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_1__.texture)( texture, uvNode, 0 );\n\t\tmaterial.side = three__WEBPACK_IMPORTED_MODULE_4__.BackSide;\n\t\tmaterial.blending = three__WEBPACK_IMPORTED_MODULE_4__.NoBlending;\n\n\t\tconst mesh = new three__WEBPACK_IMPORTED_MODULE_4__.Mesh( geometry, material );\n\n\t\tconst scene = new three__WEBPACK_IMPORTED_MODULE_4__.Scene();\n\t\tscene.add( mesh );\n\n\t\t// Avoid blurred poles\n\t\tif ( texture.minFilter === three__WEBPACK_IMPORTED_MODULE_4__.LinearMipmapLinearFilter ) texture.minFilter = three__WEBPACK_IMPORTED_MODULE_4__.LinearFilter;\n\n\t\tconst camera = new three__WEBPACK_IMPORTED_MODULE_4__.CubeCamera( 1, 10, this );\n\t\tcamera.update( renderer, scene );\n\n\t\ttexture.minFilter = currentMinFilter;\n\t\ttexture.currentGenerateMipmaps = currentGenerateMipmaps;\n\n\t\tmesh.geometry.dispose();\n\t\tmesh.material.dispose();\n\n\t\treturn this;\n\n\t}\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CubeRenderTarget);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/renderers/common/CubeRenderTarget.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/renderers/common/Uniform.js": +/*!*********************************************************************!*\ + !*** ./node_modules/three/examples/jsm/renderers/common/Uniform.js ***! + \*********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ColorUniform: () => (/* binding */ ColorUniform),\n/* harmony export */ FloatUniform: () => (/* binding */ FloatUniform),\n/* harmony export */ Matrix3Uniform: () => (/* binding */ Matrix3Uniform),\n/* harmony export */ Matrix4Uniform: () => (/* binding */ Matrix4Uniform),\n/* harmony export */ Vector2Uniform: () => (/* binding */ Vector2Uniform),\n/* harmony export */ Vector3Uniform: () => (/* binding */ Vector3Uniform),\n/* harmony export */ Vector4Uniform: () => (/* binding */ Vector4Uniform)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\nclass Uniform {\n\n\tconstructor( name, value = null ) {\n\n\t\tthis.name = name;\n\t\tthis.value = value;\n\n\t\tthis.boundary = 0; // used to build the uniform buffer according to the STD140 layout\n\t\tthis.itemSize = 0;\n\n\t\tthis.offset = 0; // this property is set by WebGPUUniformsGroup and marks the start position in the uniform buffer\n\n\t}\n\n\tsetValue( value ) {\n\n\t\tthis.value = value;\n\n\t}\n\n\tgetValue() {\n\n\t\treturn this.value;\n\n\t}\n\n}\n\nclass FloatUniform extends Uniform {\n\n\tconstructor( name, value = 0 ) {\n\n\t\tsuper( name, value );\n\n\t\tthis.isFloatUniform = true;\n\n\t\tthis.boundary = 4;\n\t\tthis.itemSize = 1;\n\n\t}\n\n}\n\nclass Vector2Uniform extends Uniform {\n\n\tconstructor( name, value = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2() ) {\n\n\t\tsuper( name, value );\n\n\t\tthis.isVector2Uniform = true;\n\n\t\tthis.boundary = 8;\n\t\tthis.itemSize = 2;\n\n\t}\n\n}\n\nclass Vector3Uniform extends Uniform {\n\n\tconstructor( name, value = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3() ) {\n\n\t\tsuper( name, value );\n\n\t\tthis.isVector3Uniform = true;\n\n\t\tthis.boundary = 16;\n\t\tthis.itemSize = 3;\n\n\t}\n\n}\n\nclass Vector4Uniform extends Uniform {\n\n\tconstructor( name, value = new three__WEBPACK_IMPORTED_MODULE_0__.Vector4() ) {\n\n\t\tsuper( name, value );\n\n\t\tthis.isVector4Uniform = true;\n\n\t\tthis.boundary = 16;\n\t\tthis.itemSize = 4;\n\n\t}\n\n}\n\nclass ColorUniform extends Uniform {\n\n\tconstructor( name, value = new three__WEBPACK_IMPORTED_MODULE_0__.Color() ) {\n\n\t\tsuper( name, value );\n\n\t\tthis.isColorUniform = true;\n\n\t\tthis.boundary = 16;\n\t\tthis.itemSize = 3;\n\n\t}\n\n}\n\nclass Matrix3Uniform extends Uniform {\n\n\tconstructor( name, value = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix3() ) {\n\n\t\tsuper( name, value );\n\n\t\tthis.isMatrix3Uniform = true;\n\n\t\tthis.boundary = 48;\n\t\tthis.itemSize = 12;\n\n\t}\n\n}\n\nclass Matrix4Uniform extends Uniform {\n\n\tconstructor( name, value = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4() ) {\n\n\t\tsuper( name, value );\n\n\t\tthis.isMatrix4Uniform = true;\n\n\t\tthis.boundary = 64;\n\t\tthis.itemSize = 16;\n\n\t}\n\n}\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/renderers/common/Uniform.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/renderers/common/extras/PMREMGenerator.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/renderers/common/extras/PMREMGenerator.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _nodes_materials_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../nodes/materials/NodeMaterial.js */ \"./node_modules/three/examples/jsm/nodes/materials/NodeMaterial.js\");\n/* harmony import */ var _nodes_pmrem_PMREMUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../nodes/pmrem/PMREMUtils.js */ \"./node_modules/three/examples/jsm/nodes/pmrem/PMREMUtils.js\");\n/* harmony import */ var _nodes_utils_EquirectUVNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../nodes/utils/EquirectUVNode.js */ \"./node_modules/three/examples/jsm/nodes/utils/EquirectUVNode.js\");\n/* harmony import */ var _nodes_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../nodes/core/UniformNode.js */ \"./node_modules/three/examples/jsm/nodes/core/UniformNode.js\");\n/* harmony import */ var _nodes_accessors_UniformsNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../nodes/accessors/UniformsNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UniformsNode.js\");\n/* harmony import */ var _nodes_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../nodes/accessors/TextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/TextureNode.js\");\n/* harmony import */ var _nodes_accessors_CubeTextureNode_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../nodes/accessors/CubeTextureNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/CubeTextureNode.js\");\n/* harmony import */ var _nodes_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../nodes/shadernode/ShaderNode.js */ \"./node_modules/three/examples/jsm/nodes/shadernode/ShaderNode.js\");\n/* harmony import */ var _nodes_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../nodes/accessors/UVNode.js */ \"./node_modules/three/examples/jsm/nodes/accessors/UVNode.js\");\n/* harmony import */ var _nodes_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../nodes/core/AttributeNode.js */ \"./node_modules/three/examples/jsm/nodes/core/AttributeNode.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n\n\n\n\n\n\n\n\n\n\n\n\nconst LOD_MIN = 4;\n\n// The standard deviations (radians) associated with the extra mips. These are\n// chosen to approximate a Trowbridge-Reitz distribution function times the\n// geometric shadowing function. These sigma values squared must match the\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\nconst EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];\n\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\nconst MAX_SAMPLES = 20;\n\nconst _flatCamera = /*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\nconst _cubeCamera = /*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.PerspectiveCamera( 90, 1 );\nconst _clearColor = /*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.Color();\nlet _oldTarget = null;\nlet _oldActiveCubeFace = 0;\nlet _oldActiveMipmapLevel = 0;\n\n// Golden Ratio\nconst PHI = ( 1 + Math.sqrt( 5 ) ) / 2;\nconst INV_PHI = 1 / PHI;\n\n// Vertices of a dodecahedron (except the opposites, which represent the\n// same axis), used as axis directions evenly spread on a sphere.\nconst _axisDirections = [\n\t/*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.Vector3( 1, 1, 1 ),\n\t/*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.Vector3( - 1, 1, 1 ),\n\t/*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.Vector3( 1, 1, - 1 ),\n\t/*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.Vector3( - 1, 1, - 1 ),\n\t/*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.Vector3( 0, PHI, INV_PHI ),\n\t/*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.Vector3( 0, PHI, - INV_PHI ),\n\t/*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.Vector3( INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.Vector3( - INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.Vector3( PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new three__WEBPACK_IMPORTED_MODULE_10__.Vector3( - PHI, INV_PHI, 0 )\n];\n\n//\n\n// WebGPU Face indices\nconst _faceLib = [\n\t3, 1, 5,\n\t0, 4, 2\n];\n\nconst direction = (0,_nodes_pmrem_PMREMUtils_js__WEBPACK_IMPORTED_MODULE_1__.getDirection)( (0,_nodes_accessors_UVNode_js__WEBPACK_IMPORTED_MODULE_8__.uv)(), (0,_nodes_core_AttributeNode_js__WEBPACK_IMPORTED_MODULE_9__.attribute)( 'faceIndex' ) ).normalize();\nconst outputDirection = (0,_nodes_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.vec3)( direction.x, direction.y.negate(), direction.z );\n\n/**\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n *\n * Paper: Fast, Accurate Image-Based Lighting\n * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view\n*/\n\nclass PMREMGenerator {\n\n\tconstructor( renderer ) {\n\n\t\tthis._renderer = renderer;\n\t\tthis._pingPongRenderTarget = null;\n\n\t\tthis._lodMax = 0;\n\t\tthis._cubeSize = 0;\n\t\tthis._lodPlanes = [];\n\t\tthis._sizeLods = [];\n\t\tthis._sigmas = [];\n\t\tthis._lodMeshes = [];\n\n\t\tthis._blurMaterial = null;\n\t\tthis._cubemapMaterial = null;\n\t\tthis._equirectMaterial = null;\n\t\tthis._backgroundBox = null;\n\n\t}\n\n\t/**\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\n\t * in radians to be applied to the scene before PMREM generation. Optional near\n\t * and far planes ensure the scene is rendered in its entirety (the cubeCamera\n\t * is placed at the origin).\n\t */\n\tfromScene( scene, sigma = 0, near = 0.1, far = 100 ) {\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\n\t\tthis._setSize( 256 );\n\n\t\tconst cubeUVRenderTarget = this._allocateTargets();\n\t\tcubeUVRenderTarget.depthBuffer = true;\n\n\t\tthis._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );\n\n\t\tif ( sigma > 0 ) {\n\n\t\t\tthis._blur( cubeUVRenderTarget, 0, 0, sigma );\n\n\t\t}\n\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * or HDR. The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromEquirectangular( equirectangular, renderTarget = null ) {\n\n\t\treturn this._fromTexture( equirectangular, renderTarget );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\n\t * or HDR. The ideal input cube size is 256 x 256,\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromCubemap( cubemap, renderTarget = null ) {\n\n\t\treturn this._fromTexture( cubemap, renderTarget );\n\n\t}\n\n\t/**\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileCubemapShader() {\n\n\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\t\t\tthis._compileMaterial( this._cubemapMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileEquirectangularShader() {\n\n\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\t\t\tthis._compileMaterial( this._equirectMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n\t * one of them will cause any others to also become unusable.\n\t */\n\tdispose() {\n\n\t\tthis._dispose();\n\n\t\tif ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();\n\t\tif ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();\n\t\tif ( this._backgroundBox !== null ) {\n\n\t\t\tthis._backgroundBox.geometry.dispose();\n\t\t\tthis._backgroundBox.material.dispose();\n\n\t\t}\n\n\t}\n\n\t// private interface\n\n\t_setSize( cubeSize ) {\n\n\t\tthis._lodMax = Math.floor( Math.log2( cubeSize ) );\n\t\tthis._cubeSize = Math.pow( 2, this._lodMax );\n\n\t}\n\n\t_dispose() {\n\n\t\tif ( this._blurMaterial !== null ) this._blurMaterial.dispose();\n\n\t\tif ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();\n\n\t\tfor ( let i = 0; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tthis._lodPlanes[ i ].dispose();\n\n\t\t}\n\n\t}\n\n\t_cleanup( outputTarget ) {\n\n\t\tthis._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );\n\t\toutputTarget.scissorTest = false;\n\t\t_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );\n\n\t}\n\n\t_fromTexture( texture, renderTarget ) {\n\n\t\tif ( texture.mapping === three__WEBPACK_IMPORTED_MODULE_10__.CubeReflectionMapping || texture.mapping === three__WEBPACK_IMPORTED_MODULE_10__.CubeRefractionMapping ) {\n\n\t\t\tthis._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );\n\n\t\t} else { // Equirectangular\n\n\t\t\tthis._setSize( texture.image.width / 4 );\n\n\t\t}\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\n\t\tconst cubeUVRenderTarget = renderTarget || this._allocateTargets();\n\t\tthis._textureToCubeUV( texture, cubeUVRenderTarget );\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_allocateTargets() {\n\n\t\tconst width = 3 * Math.max( this._cubeSize, 16 * 7 );\n\t\tconst height = 4 * this._cubeSize;\n\n\t\tconst params = {\n\t\t\tmagFilter: three__WEBPACK_IMPORTED_MODULE_10__.LinearFilter,\n\t\t\tminFilter: three__WEBPACK_IMPORTED_MODULE_10__.LinearFilter,\n\t\t\tgenerateMipmaps: false,\n\t\t\ttype: three__WEBPACK_IMPORTED_MODULE_10__.HalfFloatType,\n\t\t\tformat: three__WEBPACK_IMPORTED_MODULE_10__.RGBAFormat,\n\t\t\tcolorSpace: three__WEBPACK_IMPORTED_MODULE_10__.LinearSRGBColorSpace,\n\t\t\t//depthBuffer: false\n\t\t};\n\n\t\tconst cubeUVRenderTarget = _createRenderTarget( width, height, params );\n\n\t\tif ( this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height ) {\n\n\t\t\tif ( this._pingPongRenderTarget !== null ) {\n\n\t\t\t\tthis._dispose();\n\n\t\t\t}\n\n\t\t\tthis._pingPongRenderTarget = _createRenderTarget( width, height, params );\n\n\t\t\tconst { _lodMax } = this;\n\t\t\t( { sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas, lodMeshes: this._lodMeshes } = _createPlanes( _lodMax ) );\n\n\t\t\tthis._blurMaterial = _getBlurShader( _lodMax, width, height );\n\n\t\t}\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_compileMaterial( material ) {\n\n\t\tconst tmpMesh = this._lodMeshes[ 0 ];\n\t\ttmpMesh.material = material;\n\n\t\tthis._renderer.compile( tmpMesh, _flatCamera );\n\n\t}\n\n\t_sceneToCubeUV( scene, near, far, cubeUVRenderTarget ) {\n\n\t\tconst cubeCamera = _cubeCamera;\n\t\tcubeCamera.near = near;\n\t\tcubeCamera.far = far;\n\n\t\t// px, py, pz, nx, ny, nz\n\t\tconst upSign = [ - 1, 1, - 1, - 1, - 1, - 1 ];\n\t\tconst forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ];\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst originalAutoClear = renderer.autoClear;\n\t\tconst toneMapping = renderer.toneMapping;\n\t\trenderer.getClearColor( _clearColor );\n\n\t\trenderer.toneMapping = three__WEBPACK_IMPORTED_MODULE_10__.NoToneMapping;\n\t\trenderer.autoClear = false;\n\n\t\tlet backgroundBox = this._backgroundBox;\n\n\t\tif ( backgroundBox === null ) {\n\n\t\t\tconst backgroundMaterial = new three__WEBPACK_IMPORTED_MODULE_10__.MeshBasicMaterial( {\n\t\t\t\tname: 'PMREM.Background',\n\t\t\t\tside: three__WEBPACK_IMPORTED_MODULE_10__.BackSide,\n\t\t\t\tdepthWrite: false,\n\t\t\t\tdepthTest: false\n\t\t\t} );\n\n\t\t\tbackgroundBox = new three__WEBPACK_IMPORTED_MODULE_10__.Mesh( new three__WEBPACK_IMPORTED_MODULE_10__.BoxGeometry(), backgroundMaterial );\n\n\t\t}\n\n\t\tlet useSolidColor = false;\n\t\tconst background = scene.background;\n\n\t\tif ( background ) {\n\n\t\t\tif ( background.isColor ) {\n\n\t\t\t\tbackgroundBox.material.color.copy( background );\n\t\t\t\tscene.background = null;\n\t\t\t\tuseSolidColor = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tbackgroundBox.material.color.copy( _clearColor );\n\t\t\tuseSolidColor = true;\n\n\t\t}\n\n\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\n\t\trenderer.clear();\n\n\t\tif ( useSolidColor ) {\n\n\t\t\trenderer.render( backgroundBox, cubeCamera );\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst col = i % 3;\n\n\t\t\tif ( col === 0 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( forwardSign[ i ], 0, 0 );\n\n\t\t\t} else if ( col === 1 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, 0, upSign[ i ] );\n\t\t\t\tcubeCamera.lookAt( 0, forwardSign[ i ], 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( 0, 0, forwardSign[ i ] );\n\n\t\t\t}\n\n\t\t\tconst size = this._cubeSize;\n\n\t\t\t_setViewport( cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size );\n\n\t\t\trenderer.render( scene, cubeCamera );\n\n\t\t}\n\n\t\trenderer.toneMapping = toneMapping;\n\t\trenderer.autoClear = originalAutoClear;\n\t\tscene.background = background;\n\n\t}\n\n\t_textureToCubeUV( texture, cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst isCubeTexture = ( texture.mapping === three__WEBPACK_IMPORTED_MODULE_10__.CubeReflectionMapping || texture.mapping === three__WEBPACK_IMPORTED_MODULE_10__.CubeRefractionMapping );\n\n\t\tif ( isCubeTexture ) {\n\n\t\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\t\tthis._cubemapMaterial = _getCubemapMaterial( texture );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\t\tthis._equirectMaterial = _getEquirectMaterial( texture );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;\n\t\tmaterial.fragmentNode.value = texture;\n\n\t\tconst mesh = this._lodMeshes[ 0 ];\n\t\tmesh.material = material;\n\n\t\tconst size = this._cubeSize;\n\n\t\t_setViewport( cubeUVRenderTarget, 0, 0, 3 * size, 2 * size );\n\n\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\t\trenderer.render( mesh, _flatCamera );\n\n\t}\n\n\t_applyPMREM( cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst autoClear = renderer.autoClear;\n\t\trenderer.autoClear = false;\n\n\t\tfor ( let i = 1; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tconst sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );\n\n\t\t\tconst poleAxis = _axisDirections[ ( i - 1 ) % _axisDirections.length ];\n\n\t\t\tthis._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );\n\n\t\t}\n\n\t\trenderer.autoClear = autoClear;\n\n\t}\n\n\t/**\n\t * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n\t * vertically and horizontally, but this breaks down on a cube. Here we apply\n\t * the blur latitudinally (around the poles), and then longitudinally (towards\n\t * the poles) to approximate the orthogonally-separable blur. It is least\n\t * accurate at the poles, but still does a decent job.\n\t */\n\t_blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {\n\n\t\tconst pingPongRenderTarget = this._pingPongRenderTarget;\n\n\t\tthis._halfBlur(\n\t\t\tcubeUVRenderTarget,\n\t\t\tpingPongRenderTarget,\n\t\t\tlodIn,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'latitudinal',\n\t\t\tpoleAxis );\n\n\t\tthis._halfBlur(\n\t\t\tpingPongRenderTarget,\n\t\t\tcubeUVRenderTarget,\n\t\t\tlodOut,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'longitudinal',\n\t\t\tpoleAxis );\n\n\t}\n\n\t_halfBlur( targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst blurMaterial = this._blurMaterial;\n\n\t\tif ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {\n\n\t\t\tconsole.error( 'blur direction must be either latitudinal or longitudinal!' );\n\n\t\t}\n\n\t\t// Number of standard deviations at which to cut off the discrete approximation.\n\t\tconst STANDARD_DEVIATIONS = 3;\n\n\t\tconst blurMesh = this._lodMeshes[ lodOut ];\n\t\tblurMesh.material = blurMaterial;\n\n\t\tconst blurUniforms = blurMaterial.uniforms;\n\n\t\tconst pixels = this._sizeLods[ lodIn ] - 1;\n\t\tconst radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );\n\t\tconst sigmaPixels = sigmaRadians / radiansPerPixel;\n\t\tconst samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;\n\n\t\tif ( samples > MAX_SAMPLES ) {\n\n\t\t\tconsole.warn( `sigmaRadians, ${\n\t\t\t\tsigmaRadians}, is too large and will clip, as it requested ${\n\t\t\t\tsamples} samples when the maximum is set to ${MAX_SAMPLES}` );\n\n\t\t}\n\n\t\tconst weights = [];\n\t\tlet sum = 0;\n\n\t\tfor ( let i = 0; i < MAX_SAMPLES; ++ i ) {\n\n\t\t\tconst x = i / sigmaPixels;\n\t\t\tconst weight = Math.exp( - x * x / 2 );\n\t\t\tweights.push( weight );\n\n\t\t\tif ( i === 0 ) {\n\n\t\t\t\tsum += weight;\n\n\t\t\t} else if ( i < samples ) {\n\n\t\t\t\tsum += 2 * weight;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < weights.length; i ++ ) {\n\n\t\t\tweights[ i ] = weights[ i ] / sum;\n\n\t\t}\n\n\t\ttargetIn.texture.frame = ( targetIn.texture.frame || 0 ) + 1;\n\n\t\tblurUniforms.envMap.value = targetIn.texture;\n\t\tblurUniforms.samples.value = samples;\n\t\tblurUniforms.weights.array = weights;\n\t\tblurUniforms.latitudinal.value = direction === 'latitudinal' ? 1 : 0;\n\n\t\tif ( poleAxis ) {\n\n\t\t\tblurUniforms.poleAxis.value = poleAxis;\n\n\t\t}\n\n\t\tconst { _lodMax } = this;\n\t\tblurUniforms.dTheta.value = radiansPerPixel;\n\t\tblurUniforms.mipInt.value = _lodMax - lodIn;\n\n\t\tconst outputSize = this._sizeLods[ lodOut ];\n\t\tconst x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );\n\t\tconst y = 4 * ( this._cubeSize - outputSize );\n\n\t\t_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );\n\t\trenderer.setRenderTarget( targetOut );\n\t\trenderer.render( blurMesh, _flatCamera );\n\n\t}\n\n}\n\nfunction _createPlanes( lodMax ) {\n\n\tconst lodPlanes = [];\n\tconst sizeLods = [];\n\tconst sigmas = [];\n\tconst lodMeshes = [];\n\n\tlet lod = lodMax;\n\n\tconst totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;\n\n\tfor ( let i = 0; i < totalLods; i ++ ) {\n\n\t\tconst sizeLod = Math.pow( 2, lod );\n\t\tsizeLods.push( sizeLod );\n\t\tlet sigma = 1.0 / sizeLod;\n\n\t\tif ( i > lodMax - LOD_MIN ) {\n\n\t\t\tsigma = EXTRA_LOD_SIGMA[ i - lodMax + LOD_MIN - 1 ];\n\n\t\t} else if ( i === 0 ) {\n\n\t\t\tsigma = 0;\n\n\t\t}\n\n\t\tsigmas.push( sigma );\n\n\t\tconst texelSize = 1.0 / ( sizeLod - 2 );\n\t\tconst min = - texelSize;\n\t\tconst max = 1 + texelSize;\n\t\tconst uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];\n\n\t\tconst cubeFaces = 6;\n\t\tconst vertices = 6;\n\t\tconst positionSize = 3;\n\t\tconst uvSize = 2;\n\t\tconst faceIndexSize = 1;\n\n\t\tconst position = new Float32Array( positionSize * vertices * cubeFaces );\n\t\tconst uv = new Float32Array( uvSize * vertices * cubeFaces );\n\t\tconst faceIndex = new Float32Array( faceIndexSize * vertices * cubeFaces );\n\n\t\tfor ( let face = 0; face < cubeFaces; face ++ ) {\n\n\t\t\tconst x = ( face % 3 ) * 2 / 3 - 1;\n\t\t\tconst y = face > 2 ? 0 : - 1;\n\t\t\tconst coordinates = [\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y + 1, 0\n\t\t\t];\n\n\t\t\tconst faceIdx = _faceLib[ face ];\n\t\t\tposition.set( coordinates, positionSize * vertices * faceIdx );\n\t\t\tuv.set( uv1, uvSize * vertices * faceIdx );\n\t\t\tconst fill = [ faceIdx, faceIdx, faceIdx, faceIdx, faceIdx, faceIdx ];\n\t\t\tfaceIndex.set( fill, faceIndexSize * vertices * faceIdx );\n\n\t\t}\n\n\t\tconst planes = new three__WEBPACK_IMPORTED_MODULE_10__.BufferGeometry();\n\t\tplanes.setAttribute( 'position', new three__WEBPACK_IMPORTED_MODULE_10__.BufferAttribute( position, positionSize ) );\n\t\tplanes.setAttribute( 'uv', new three__WEBPACK_IMPORTED_MODULE_10__.BufferAttribute( uv, uvSize ) );\n\t\tplanes.setAttribute( 'faceIndex', new three__WEBPACK_IMPORTED_MODULE_10__.BufferAttribute( faceIndex, faceIndexSize ) );\n\t\tlodPlanes.push( planes );\n\t\tlodMeshes.push( new three__WEBPACK_IMPORTED_MODULE_10__.Mesh( planes, null ) );\n\n\t\tif ( lod > LOD_MIN ) {\n\n\t\t\tlod --;\n\n\t\t}\n\n\t}\n\n\treturn { lodPlanes, sizeLods, sigmas, lodMeshes };\n\n}\n\nfunction _createRenderTarget( width, height, params ) {\n\n\tconst cubeUVRenderTarget = new three__WEBPACK_IMPORTED_MODULE_10__.RenderTarget( width, height, params );\n\tcubeUVRenderTarget.texture.mapping = three__WEBPACK_IMPORTED_MODULE_10__.CubeUVReflectionMapping;\n\tcubeUVRenderTarget.texture.name = 'PMREM.cubeUv';\n\tcubeUVRenderTarget.texture.isPMREMTexture = true;\n\tcubeUVRenderTarget.scissorTest = true;\n\treturn cubeUVRenderTarget;\n\n}\n\nfunction _setViewport( target, x, y, width, height ) {\n\n\tconst viewY = target.height - height - y;\n\n\ttarget.viewport.set( x, viewY, width, height );\n\ttarget.scissor.set( x, viewY, width, height );\n\n}\n\nfunction _getMaterial() {\n\n\tconst material = new _nodes_materials_NodeMaterial_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n\tmaterial.colorSpaced = false;\n\tmaterial.toneMapped = false;\n\tmaterial.depthTest = false;\n\tmaterial.depthWrite = false;\n\tmaterial.blending = three__WEBPACK_IMPORTED_MODULE_10__.NoBlending;\n\n\treturn material;\n\n}\n\nfunction _getBlurShader( lodMax, width, height ) {\n\n\tconst weights = (0,_nodes_accessors_UniformsNode_js__WEBPACK_IMPORTED_MODULE_4__.uniforms)( new Array( MAX_SAMPLES ).fill( 0 ) );\n\tconst poleAxis = (0,_nodes_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__.uniform)( new three__WEBPACK_IMPORTED_MODULE_10__.Vector3( 0, 1, 0 ) );\n\tconst dTheta = (0,_nodes_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__.uniform)( 0 );\n\tconst n = (0,_nodes_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.float)( MAX_SAMPLES );\n\tconst latitudinal = (0,_nodes_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__.uniform)( 0 ); // false, bool\n\tconst samples = (0,_nodes_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__.uniform)( 1 ); // int\n\tconst envMap = (0,_nodes_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_5__.texture)( null );\n\tconst mipInt = (0,_nodes_core_UniformNode_js__WEBPACK_IMPORTED_MODULE_3__.uniform)( 0 ); // int\n\tconst CUBEUV_TEXEL_WIDTH = (0,_nodes_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.float)( 1 / width );\n\tconst CUBEUV_TEXEL_HEIGHT = (0,_nodes_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.float)( 1 / height );\n\tconst CUBEUV_MAX_MIP = (0,_nodes_shadernode_ShaderNode_js__WEBPACK_IMPORTED_MODULE_7__.float)( lodMax );\n\n\tconst materialUniforms = {\n\t\tn,\n\t\tlatitudinal,\n\t\tweights,\n\t\tpoleAxis,\n\t\toutputDirection,\n\t\tdTheta,\n\t\tsamples,\n\t\tenvMap,\n\t\tmipInt,\n\t\tCUBEUV_TEXEL_WIDTH,\n\t\tCUBEUV_TEXEL_HEIGHT,\n\t\tCUBEUV_MAX_MIP\n\t};\n\n\tconst material = _getMaterial();\n\tmaterial.uniforms = materialUniforms; // TODO: Move to outside of the material\n\tmaterial.fragmentNode = (0,_nodes_pmrem_PMREMUtils_js__WEBPACK_IMPORTED_MODULE_1__.blur)( { ...materialUniforms, latitudinal: latitudinal.equal( 1 ) } );\n\n\treturn material;\n\n}\n\nfunction _getCubemapMaterial( envTexture ) {\n\n\tconst material = _getMaterial();\n\tmaterial.fragmentNode = (0,_nodes_accessors_CubeTextureNode_js__WEBPACK_IMPORTED_MODULE_6__.cubeTexture)( envTexture, outputDirection );\n\n\treturn material;\n\n}\n\nfunction _getEquirectMaterial( envTexture ) {\n\n\tconst material = _getMaterial();\n\tmaterial.fragmentNode = (0,_nodes_accessors_TextureNode_js__WEBPACK_IMPORTED_MODULE_5__.texture)( envTexture, (0,_nodes_utils_EquirectUVNode_js__WEBPACK_IMPORTED_MODULE_2__.equirectUV)( outputDirection ), 0 );\n\n\treturn material;\n\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PMREMGenerator);\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/renderers/common/extras/PMREMGenerator.js?"); + +/***/ }), + +/***/ "./node_modules/three/examples/jsm/renderers/common/nodes/NodeUniform.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/three/examples/jsm/renderers/common/nodes/NodeUniform.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ColorNodeUniform: () => (/* binding */ ColorNodeUniform),\n/* harmony export */ FloatNodeUniform: () => (/* binding */ FloatNodeUniform),\n/* harmony export */ Matrix3NodeUniform: () => (/* binding */ Matrix3NodeUniform),\n/* harmony export */ Matrix4NodeUniform: () => (/* binding */ Matrix4NodeUniform),\n/* harmony export */ Vector2NodeUniform: () => (/* binding */ Vector2NodeUniform),\n/* harmony export */ Vector3NodeUniform: () => (/* binding */ Vector3NodeUniform),\n/* harmony export */ Vector4NodeUniform: () => (/* binding */ Vector4NodeUniform)\n/* harmony export */ });\n/* harmony import */ var _Uniform_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Uniform.js */ \"./node_modules/three/examples/jsm/renderers/common/Uniform.js\");\n\n\nclass FloatNodeUniform extends _Uniform_js__WEBPACK_IMPORTED_MODULE_0__.FloatUniform {\n\n\tconstructor( nodeUniform ) {\n\n\t\tsuper( nodeUniform.name, nodeUniform.value );\n\n\t\tthis.nodeUniform = nodeUniform;\n\n\t}\n\n\tgetValue() {\n\n\t\treturn this.nodeUniform.value;\n\n\t}\n\n}\n\nclass Vector2NodeUniform extends _Uniform_js__WEBPACK_IMPORTED_MODULE_0__.Vector2Uniform {\n\n\tconstructor( nodeUniform ) {\n\n\t\tsuper( nodeUniform.name, nodeUniform.value );\n\n\t\tthis.nodeUniform = nodeUniform;\n\n\t}\n\n\tgetValue() {\n\n\t\treturn this.nodeUniform.value;\n\n\t}\n\n}\n\nclass Vector3NodeUniform extends _Uniform_js__WEBPACK_IMPORTED_MODULE_0__.Vector3Uniform {\n\n\tconstructor( nodeUniform ) {\n\n\t\tsuper( nodeUniform.name, nodeUniform.value );\n\n\t\tthis.nodeUniform = nodeUniform;\n\n\t}\n\n\tgetValue() {\n\n\t\treturn this.nodeUniform.value;\n\n\t}\n\n}\n\nclass Vector4NodeUniform extends _Uniform_js__WEBPACK_IMPORTED_MODULE_0__.Vector4Uniform {\n\n\tconstructor( nodeUniform ) {\n\n\t\tsuper( nodeUniform.name, nodeUniform.value );\n\n\t\tthis.nodeUniform = nodeUniform;\n\n\t}\n\n\tgetValue() {\n\n\t\treturn this.nodeUniform.value;\n\n\t}\n\n}\n\nclass ColorNodeUniform extends _Uniform_js__WEBPACK_IMPORTED_MODULE_0__.ColorUniform {\n\n\tconstructor( nodeUniform ) {\n\n\t\tsuper( nodeUniform.name, nodeUniform.value );\n\n\t\tthis.nodeUniform = nodeUniform;\n\n\t}\n\n\tgetValue() {\n\n\t\treturn this.nodeUniform.value;\n\n\t}\n\n}\n\nclass Matrix3NodeUniform extends _Uniform_js__WEBPACK_IMPORTED_MODULE_0__.Matrix3Uniform {\n\n\tconstructor( nodeUniform ) {\n\n\t\tsuper( nodeUniform.name, nodeUniform.value );\n\n\t\tthis.nodeUniform = nodeUniform;\n\n\t}\n\n\tgetValue() {\n\n\t\treturn this.nodeUniform.value;\n\n\t}\n\n}\n\nclass Matrix4NodeUniform extends _Uniform_js__WEBPACK_IMPORTED_MODULE_0__.Matrix4Uniform {\n\n\tconstructor( nodeUniform ) {\n\n\t\tsuper( nodeUniform.name, nodeUniform.value );\n\n\t\tthis.nodeUniform = nodeUniform;\n\n\t}\n\n\tgetValue() {\n\n\t\treturn this.nodeUniform.value;\n\n\t}\n\n}\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./node_modules/three/examples/jsm/renderers/common/nodes/NodeUniform.js?"); + +/***/ }), + +/***/ "./src/BuildingBlock_no_collision/flag.mjs": +/*!*************************************************!*\ + !*** ./src/BuildingBlock_no_collision/flag.mjs ***! + \*************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ flag: () => (/* binding */ flag)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asset_loading/assets_3d.mjs */ \"./src/asset_loading/assets_3d.mjs\");\n\n\n\n\nfunction flag(x,y,z){\n let poleHeight = 15\n let flagGroup = new three__WEBPACK_IMPORTED_MODULE_2__.Group();\n let poleGeom = new three__WEBPACK_IMPORTED_MODULE_2__.CylinderGeometry(1, 1, poleHeight, 10 );\n let poleMesh = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(poleGeom, _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__.materials.Metal1);\n poleMesh.position.set(25, poleHeight/2 ,0);\n flagGroup.add(poleMesh);\n\n let flagSGeom = new three__WEBPACK_IMPORTED_MODULE_2__.PlaneGeometry( 7, 5 );\n\n _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__.materials.Flag.side = three__WEBPACK_IMPORTED_MODULE_2__.DoubleSide;\n let flagSMesh = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(flagSGeom, _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__.materials.Flag);\n flagSMesh.position.set(29, poleHeight-3,0);\n flagGroup.add(flagSMesh);\n\n\n flagGroup.position.set(x, y, z);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(flagGroup);\n return flagGroup;\n}\n\n\n//# sourceURL=webpack://gamedev-engine/./src/BuildingBlock_no_collision/flag.mjs?"); + +/***/ }), + +/***/ "./src/BuildingBlock_no_collision/pine.mjs": +/*!*************************************************!*\ + !*** ./src/BuildingBlock_no_collision/pine.mjs ***! + \*************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createPineTree: () => (/* binding */ createPineTree)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asset_loading/assets_3d.mjs */ \"./src/asset_loading/assets_3d.mjs\");\n\n\n\n\nfunction createPineTree(x, y, z) {\n let treeHeight = 20, nSegments = 5, baseHeight = treeHeight/4, biggestSegmentRadius = 8;\n let treeGroup = new three__WEBPACK_IMPORTED_MODULE_2__.Group();\n let trunkGeom = new three__WEBPACK_IMPORTED_MODULE_2__.CylinderGeometry(\n 1, 1, treeHeight, 10 );\n let trunkMesh = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(trunkGeom, _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__.materials.Wood);\n trunkMesh.position.set(0, treeHeight/2 ,0);\n treeGroup.add(trunkMesh);\n treeGroup.position.set(x, y, z);\n\n\n for(let i = 0; i <= nSegments; i++) {\n let treeSegmentGeom = new three__WEBPACK_IMPORTED_MODULE_2__.ConeGeometry( 1 + biggestSegmentRadius/(2+i), 2 + (treeHeight - baseHeight)/nSegments, 32 );\n let treeMesh = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(treeSegmentGeom, _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__.materials.Pine);\n treeMesh.position.set(0, baseHeight + i*(treeHeight-baseHeight)/nSegments, 0);\n treeGroup.add(treeMesh);\n }\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(treeGroup);\n return treeGroup;\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/BuildingBlock_no_collision/pine.mjs?"); + +/***/ }), + +/***/ "./src/BuildingBlocks/BuildingBlock.mjs": +/*!**********************************************!*\ + !*** ./src/BuildingBlocks/BuildingBlock.mjs ***! + \**********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BuildingBlock: () => (/* binding */ BuildingBlock)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asset_loading/assets_3d.mjs */ \"./src/asset_loading/assets_3d.mjs\");\n\n\n\n\n\nclass BuildingBlock {\n constructor(x, y, z, width, height, depth) {\n // Block visual representation\n var geometry = new three__WEBPACK_IMPORTED_MODULE_2__.BoxGeometry(width, height, depth);\n var material = _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__.materials.Concrete1;\n var cube = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(geometry, material);\n cube.position.set(x, y, z);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(cube);\n\n // Block physics and collision detection\n const groundMaterialPhysics = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Material(); // Create a new material\n groundMaterialPhysics.restitution = 0.5; // Set the restitution coefficient to 0.5 (adjust as needed)\n groundMaterialPhysics.friction = 1;\n var cubeShape = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Box(new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3(width/2, height/2, depth/2));\n var cubeBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({ mass: 0, material: groundMaterialPhysics});\n cubeBody.addShape(cubeShape);\n cubeBody.position.set(x, y, z);\n cubeBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.STATIC;\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(cubeBody);\n }\n}\n\n\n//# sourceURL=webpack://gamedev-engine/./src/BuildingBlocks/BuildingBlock.mjs?"); + +/***/ }), + +/***/ "./src/BuildingBlocks/Cylinder.mjs": +/*!*****************************************!*\ + !*** ./src/BuildingBlocks/Cylinder.mjs ***! + \*****************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Cylinder: () => (/* binding */ Cylinder)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asset_loading/assets_3d.mjs */ \"./src/asset_loading/assets_3d.mjs\");\n\n\n\n\n\nclass Cylinder {\n constructor(x, y, z, radius, length) {\n // Block visual representation\n var geometry = new three__WEBPACK_IMPORTED_MODULE_2__.CylinderGeometry(radius, radius, length, 32);\n var cylinder = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(geometry, _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__.materials.Concrete2); // Corrected variable name\n cylinder.position.set(x, y, z);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(cylinder); // Corrected variable name\n\n // Block physics and collision detection\n const groundMaterialPhysics = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Material(); // Create a new material\n groundMaterialPhysics.restitution = 1; // Set the restitution coefficient to 0.5 (adjust as needed)\n var cylinderShape = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Cylinder(radius, radius, length, 32); // Corrected shape definition\n var cylinderBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({ mass: 0, material: groundMaterialPhysics });\n // var quat = new CANNON.Quaternion();\n // quat.setFromAxisAngle(new CANNON.Vec3(1, 0, 0), -Math.PI / 2);\n // var translation = new CANNON.Vec3(0, 0, 0);\n // cylinderShape.transformAllPoints(translation, quat);\n cylinderBody.addShape(cylinderShape);\n cylinderBody.position.set(x, y, z);\n cylinderBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.STATIC;\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(cylinderBody);\n }\n}\n\n\n//# sourceURL=webpack://gamedev-engine/./src/BuildingBlocks/Cylinder.mjs?"); + +/***/ }), + +/***/ "./src/BuildingBlocks/GolfHole.mjs": +/*!*****************************************!*\ + !*** ./src/BuildingBlocks/GolfHole.mjs ***! + \*****************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GolfHole: () => (/* binding */ GolfHole)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _menu_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../menu.mjs */ \"./src/menu.mjs\");\n\r\n\r\n\r\n\r\nclass GolfHole {\r\n //dupka\r\n constructor(x, y, z, radiusTop, RadiusBottom, Height, RadialSegments, HightSegments, x2, y2, z2, radiusTop2, RadiusBottom2, Height2, ballBody) {\r\n const holeGeometry = new three__WEBPACK_IMPORTED_MODULE_2__.CylinderGeometry(radiusTop, RadiusBottom, Height, RadialSegments, HightSegments);\r\n const holeMaterial = new three__WEBPACK_IMPORTED_MODULE_2__.MeshBasicMaterial({ color: 0x000000 });\r\n const hole = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(holeGeometry, holeMaterial);\r\n hole.position.set(x, y, z);\r\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(hole);\r\n\r\n const groundMaterialPhysics = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Material();\r\n groundMaterialPhysics.restitution = 0;\r\n var cylinderShape = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Cylinder(radiusTop, RadiusBottom, Height, RadialSegments);\r\n var cylinderBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({ mass: 0, material: groundMaterialPhysics });\r\n cylinderBody.addShape(cylinderShape);\r\n cylinderBody.position.set(x, y, z);\r\n console.log(cylinderBody.position, hole.position);\r\n cylinderBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.STATIC;\r\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(cylinderBody);\r\n //detection point\r\n var geometry = new three__WEBPACK_IMPORTED_MODULE_2__.CylinderGeometry(radiusTop2, RadiusBottom2, Height2);\r\n var material = new three__WEBPACK_IMPORTED_MODULE_2__.MeshBasicMaterial({ color: 0xff0000, transparent: true, opacity: 0.5 });\r\n var ellipse = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(geometry, material);\r\n ellipse.position.set(x2, y2, z2);\r\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(ellipse);\r\n\r\n const groundMaterialPhysics2 = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Material();\r\n groundMaterialPhysics2.restitution = 1;\r\n var cylinderShape = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Cylinder(radiusTop2, RadiusBottom2, Height2, 32);\r\n var cylinderBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({ mass: 0, material: groundMaterialPhysics2 });\r\n cylinderBody.addShape(cylinderShape);\r\n cylinderBody.position.set(x, y, z);\r\n console.log(cylinderBody.position, ellipse.position);\r\n cylinderBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.STATIC;\r\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(cylinderBody);\r\n\r\n _menu_mjs__WEBPACK_IMPORTED_MODULE_1__.menuConfig.setGameWon();\r\n ballBody.addEventListener('collide', (event) => {\r\n if (event.body === cylinderBody) {\r\n console.log(\"Collided with hole\");\r\n _menu_mjs__WEBPACK_IMPORTED_MODULE_1__.menuConfig.isWinner = true;\r\n }\r\n });\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://gamedev-engine/./src/BuildingBlocks/GolfHole.mjs?"); + +/***/ }), + +/***/ "./src/BuildingBlocks/GolfHole_DetectionPoint.mjs": +/*!********************************************************!*\ + !*** ./src/BuildingBlocks/GolfHole_DetectionPoint.mjs ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GolfHole_Detection: () => (/* binding */ GolfHole_Detection)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../engine.mjs */ \"./src/engine.mjs\");\n\r\n\r\n\r\n\r\nclass GolfHole_Detection{\r\n constructor_detectionPoint(x,y,z, radiusTop, RadiusBottom ,Height) {\r\n var geometry = new three__WEBPACK_IMPORTED_MODULE_1__.CylinderGeometry(radiusTop, RadiusBottom ,Height);\r\n var material = new three__WEBPACK_IMPORTED_MODULE_1__.MeshBasicMaterial({ color: 0xff0000, transparent: true, opacity: 1 });\r\n var ellipse = new three__WEBPACK_IMPORTED_MODULE_1__.Mesh(geometry, material);\r\n ellipse.position.set(x,y,z);\r\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(ellipse);\r\n \r\n const groundMaterialPhysics2 = new cannon_es__WEBPACK_IMPORTED_MODULE_2__.Material(); \r\n groundMaterialPhysics2.restitution = 1; \r\n var cylinderShape = new cannon_es__WEBPACK_IMPORTED_MODULE_2__.Cylinder(radiusTop, RadiusBottom, Height, 32); \r\n var cylinderBody = new cannon_es__WEBPACK_IMPORTED_MODULE_2__.Body({ mass: 0, material: groundMaterialPhysics2 });\r\n cylinderBody.addShape(cylinderShape);\r\n cylinderBody.position.set(x, y, z);\r\n console.log(cylinderBody.position, ellipse.position);\r\n cylinderBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_2__.Body.STATIC;\r\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(cylinderBody);\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://gamedev-engine/./src/BuildingBlocks/GolfHole_DetectionPoint.mjs?"); + +/***/ }), + +/***/ "./src/BuildingBlocks/Iceblock.mjs": +/*!*****************************************!*\ + !*** ./src/BuildingBlocks/Iceblock.mjs ***! + \*****************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Ice: () => (/* binding */ Ice)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../engine.mjs */ \"./src/engine.mjs\");\n\n\n\n\nclass Ice{\n constructor(x, y, z, width, height, depth) {\n\n // Block visual representation\n var geometry = new three__WEBPACK_IMPORTED_MODULE_1__.BoxGeometry(width, height, depth);\n var material = new three__WEBPACK_IMPORTED_MODULE_1__.MeshPhongMaterial({ color: 0x00ffff });\n var cube = new three__WEBPACK_IMPORTED_MODULE_1__.Mesh(geometry, material);\n cube.position.set(x, y, z);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(cube);\n\n // Block physics and collision detection\n const groundMaterialPhysics = new cannon_es__WEBPACK_IMPORTED_MODULE_2__.Material(); // Create a new material\n groundMaterialPhysics.restitution = 0.5; // Set the restitution coefficient to 0.5 (adjust as needed)\n groundMaterialPhysics.friction = 0.1;\n var cubeShape = new cannon_es__WEBPACK_IMPORTED_MODULE_2__.Box(new cannon_es__WEBPACK_IMPORTED_MODULE_2__.Vec3(width/2, height/2, depth/2));\n var cubeBody = new cannon_es__WEBPACK_IMPORTED_MODULE_2__.Body({ mass: 0, material: groundMaterialPhysics});\n cubeBody.addShape(cubeShape);\n cubeBody.position.set(x, y, z);\n cubeBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_2__.Body.STATIC;\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(cubeBody);\n }\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/BuildingBlocks/Iceblock.mjs?"); + +/***/ }), + +/***/ "./src/BuildingBlocks/MovingPlatform.mjs": +/*!***********************************************!*\ + !*** ./src/BuildingBlocks/MovingPlatform.mjs ***! + \***********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MovingPlatform: () => (/* binding */ MovingPlatform)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asset_loading/assets_3d.mjs */ \"./src/asset_loading/assets_3d.mjs\");\n\n\n\n\n\n/*\nx1,y1,z1 - where the platform initially is\nx2,y2,z2 - where the platform moves to\ntimeToStay - time at which the platform stays at any of the end points (ms)\ntimeToTravel - time which the platform takes to go from position 1 to position 2 (should be ms but just isnt)\n*/ \n\nclass MovingPlatform{\n constructor(x1, y1, z1, x2, y2, z2, width, height, depth, timeToStay = 1500, timeToTravel = 200) {\n // Block visual representation\n var geometry = new three__WEBPACK_IMPORTED_MODULE_2__.BoxGeometry(width, height, depth);\n var material = _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__.materials.Planks1;\n var cube = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(geometry, material);\n cube.position.set(x1, y1, z1);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(cube);\n this.Mesh = cube; //This is needed to be able to manipulate the mesh of the platform later on\n\n // Block physics and collision detection\n const groundMaterialPhysics = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Material(); // Create a new material\n groundMaterialPhysics.restitution = 0.5; // Set the restitution coefficient to 0.5 (adjust as needed)\n groundMaterialPhysics.friction = 1;\n var cubeShape = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Box(new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3(width/2, height/2, depth/2));\n var cubeBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({ mass: 0, material: groundMaterialPhysics});\n cubeBody.addShape(cubeShape);\n cubeBody.position.set(x1, y1, z1);\n cubeBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.STATIC;\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(cubeBody);\n this.Box = cubeBody; //This is needed so we can manipulate the collision box of the moving object\n\n //This is needed to know where and how to move the platform later on\n this.xDiff = x1 - x2;\n this.yDiff = y1 - y2;\n this.zDiff = z1 - z2;\n this.tts = timeToStay;\n this.ttt = timeToTravel;\n this.timePassed = 0;\n this.movingToSecondPosition = -1; //this can be either 1 or -1 and determines the values of variables that affect the movement of the platform\n this.movingInterval = setInterval(() => {this.move();}, 1);\n this.w = width;\n this.h = height;\n this.d = depth;\n }\n move(){\n if(this.timePassed >= this.ttt){\n this.movingToSecondPosition = -this.movingToSecondPosition;\n clearInterval(this.movingInterval);\n this.timePassed = 0;\n setTimeout(() => { this.movingInterval = setInterval(() => { this.move() }, 1) }, this.tts);\n }\n\n let xMove = this.movingToSecondPosition*(this.xDiff/this.ttt);\n let yMove = this.movingToSecondPosition*(this.yDiff/this.ttt);\n let zMove = this.movingToSecondPosition*(this.zDiff/this.ttt);\n\n //Offset both the mesh and physics object\n this.Mesh.position.set(this.Mesh.position.x+xMove, this.Mesh.position.y+yMove, this.Mesh.position.z+zMove);\n this.Box.position.set(this.Box.position.x+xMove, this.Box.position.y+yMove, this.Box.position.z+zMove);\n\n //This checks whether the ball is sitting atop the platform\n if(ballMesh.position.x > this.Mesh.position.x - this.w/2 && ballMesh.position.x < this.Mesh.position.x + this.w/2\n && ballMesh.position.z > this.Mesh.position.z - this.d/2 && ballMesh.position.z < this.Mesh.position.z + this.d/2\n && ballMesh.position.y > this.Mesh.position.y + this.h/2 && ballMesh.position.y < this.Mesh.position.y + 2.1){ \n ballBody.position.set(ballBody.position.x + xMove, ballBody.position.y + yMove, ballBody.position.z + zMove); //Only update ballBody because the mesh will take its coordinates anyway\n }\n this.timePassed++;\n }\n}\n\n\n//# sourceURL=webpack://gamedev-engine/./src/BuildingBlocks/MovingPlatform.mjs?"); + +/***/ }), + +/***/ "./src/BuildingBlocks/Particle.mjs": +/*!*****************************************!*\ + !*** ./src/BuildingBlocks/Particle.mjs ***! + \*****************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Emitter: () => (/* binding */ Emitter),\n/* harmony export */ Particle: () => (/* binding */ Particle),\n/* harmony export */ createNewEmitter: () => (/* binding */ createNewEmitter),\n/* harmony export */ updateEmitters: () => (/* binding */ updateEmitters)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../engine.mjs */ \"./src/engine.mjs\");\n\n\n\nlet emitters = [];\n\n//* One singular particle\nclass Particle {\n constructor(x, y, z, dx, dy, dz, size, color, lifetime) {\n //Transform:\n this.x = x;\n this.y = y;\n this.z = z;\n\n //delta xyz\n this.dx = dx;\n this.dy = dy;\n this.dz = dz;\n\n this.size = size;\n\n //Lifetime:\n this.lifetime = lifetime;\n this.isDead = false;\n\n\n //time\n this.t = 0\n\n //set up as THREE.js object\n this.material = new three__WEBPACK_IMPORTED_MODULE_1__.SpriteMaterial({color: color})\n this.sprite = new three__WEBPACK_IMPORTED_MODULE_1__.Sprite(this.material)\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(this.sprite)\n this.sprite.position.set(this.x, this.y, this.z)\n this.sprite.scale.set(size, size, 1)\n }\n\n updateParticle() {\n if(!this.isDead) {\n //update values\n this.t++\n \n this.x += this.dx\n this.y += this.dy\n this.z += this.dz\n \n //update THREE.js object pos\n this.sprite.position.set(this.x, this.y, this.z)\n \n //lifetime deletion (lifetime in seconds)\n if(this.t/100 > this.lifetime) {\n this.killParticle()\n }\n }\n }\n \n killParticle() {\n this.isDead = true;\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.remove(this.sprite)\n this.material.dispose()\n // console.log(\"Killed particle\")\n }\n}\n\n//* Emitter AKA Particle system which spawns and controls particles\nclass Emitter {\n constructor(originX, originY, originZ, type, data, index) {\n //the system will have 2 types of particle emitters - single burst and over time.\n //The type determines what values will be pulled from this.data\n //TODO over-time emitter type\n\n //Transform:\n this.x = originX;\n this.y = originY;\n this.z = originZ;\n\n //Misc:\n this.t = 0;\n this.type = type;\n this.data = data;\n this.index = index; //what index this emitter is\n this.isDead = false;\n\n this.particles = []\n }\n updateEmitter() {\n if(!this.isDead) {\n\n this.t++;\n\n for(let particle of this.particles) {\n particle.updateParticle()\n }\n \n if(this.type == \"burst\") {\n //* Data inside of a burst type emitter:\n //particle_cnt - how many particles to spawn\n //particle_lifetime - an object with min & max\n //power - how fast should the particles fly off\n //fired - whether the emitter already fired a burst\n \n if(!this.data.fired) {\n //Create particle_cnt particles\n for(let p_cnt=0; p_cnt {\n em.updateEmitter()\n })\n}\n\nfunction createNewEmitter(originX, originY, originZ, type, data) {\n emitters.push(new Emitter(originX, originY, originZ, type, data, emitters.length))\n}\n\nfunction random_range(min, max) {\n return (Math.random() * (max - min + 1)) + min;\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/BuildingBlocks/Particle.mjs?"); + +/***/ }), + +/***/ "./src/BuildingBlocks/Ramp.mjs": +/*!*************************************!*\ + !*** ./src/BuildingBlocks/Ramp.mjs ***! + \*************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Ramp: () => (/* binding */ Ramp)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asset_loading/assets_3d.mjs */ \"./src/asset_loading/assets_3d.mjs\");\n// import * as THREE from \"three\";\n// import * as CANNON from \"cannon-es\";\n// import { engine } from \"../engine.mjs\";\n// import { materials } from \"../asset_loading/assets_3d.mjs\";\n\n// class Ramp {\n// constructor(x, y, z, width, dir, angle) {\n// // Block visual representation\n\n// var rampGeometry = new THREE.BoxGeometry(width, 1, width);\n// var borderGeometry = new THREE.BoxGeometry(width, 3, 2);\n\n// var cube = new THREE.Mesh(rampGeometry, materials.Grass);\n// var border1 = new THREE.Mesh(borderGeometry, materials.Wood);\n// var border2 = new THREE.Mesh(borderGeometry, materials.Wood);\n\n// border1.position.set(0, 0, 0 - width/2);\n// border2.position.set(0, 0, 0 + width/2);\n// cube.position.set(0, 0, 0);\n\n// // Групираме ги щото искаме да ги трансформираме само веднъж\n// let rampGroup = new THREE.Group();\n// rampGroup.add(cube, border1, border2);\n// rampGroup.rotation.y = dir;\n// rampGroup.rotation.z = angle;\n// rampGroup.position.set(x, y, z);\n// // cube.rotation.y = dir;\n// // cube.rotation.z = angle;\n// // border1.rotation.y = dir;\n// // border1.rotation.z = angle;\n// // border2.rotation.y = dir;\n// // border2.rotation.z = angle;\n\n// engine.scene.add(rampGroup);\n\n// // Block physics and collision detection\n// const groundMaterialPhysics = new CANNON.Material(); // Create a new material\n// groundMaterialPhysics.restitution = 0.5; // Set the restitution coefficient to 0.5 (adjust as needed)\n// var cubeShape = new CANNON.Box(new CANNON.Vec3(width/2, 1/2, width/2));\n// var borderShape = new CANNON.Box(new CANNON.Vec3(width/2, 1.5, 1));\n\n// var cubeBody = new CANNON.Body({ mass: 1000, material: groundMaterialPhysics});\n// var border1Body = new CANNON.Body({ mass: 1000, material: groundMaterialPhysics});\n\n\n// cubeBody.addShape(cubeShape);\n// border1Body.addShape(borderShape);\n\n\n// // Копираме позиция/ ротация от three.js групата\n// cubeBody.position.copy(rampGroup.position);\n// cubeBody.quaternion.copy(rampGroup.quaternion);\n \n// border1Body.position.copy(rampGroup.position);\n// border1Body.quaternion.copy(rampGroup.quaternion);\n\n// cubeBody.type = CANNON.Body.STATIC;\n// engine.cannonjs_world.addBody(cubeBody);\n// }\n// }\n\n// export {Ramp};\n\n\n\n\n\n\nclass Ramp {\n constructor(x, y, z, width, dir, angle) {\n // Create the Three.js objects\n var rampGeometry = new three__WEBPACK_IMPORTED_MODULE_2__.BoxGeometry(width, 1, width);\n var borderGeometry = new three__WEBPACK_IMPORTED_MODULE_2__.BoxGeometry(width, 3, 2);\n\n var cube = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(rampGeometry, _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__.materials.Grass);\n var border1 = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(borderGeometry, _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__.materials.Wood);\n var border2 = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(borderGeometry, _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__.materials.Wood);\n\n border1.position.set(0, 1, -width / 2); // Adjusted height for visual alignment\n border2.position.set(0, 1, width / 2);\n cube.position.set(0, 0, 0);\n\n // Group the objects for transformation\n let rampGroup = new three__WEBPACK_IMPORTED_MODULE_2__.Group();\n rampGroup.add(cube, border1, border2);\n rampGroup.rotation.y = dir;\n rampGroup.rotation.z = angle;\n rampGroup.position.set(x, y, z);\n\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(rampGroup);\n\n // Create Cannon.js materials and shapes\n const groundMaterialPhysics = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Material();\n groundMaterialPhysics.restitution = 0.5;\n\n var cubeShape = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Box(new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3(width / 2, 0.5, width / 2));\n var borderShape = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Box(new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3(width / 2, 1.5, 1));\n\n var cubeBody = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({ mass: 0, material: groundMaterialPhysics });\n var border1Body = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({ mass: 0, material: groundMaterialPhysics });\n var border2Body = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body({ mass: 0, material: groundMaterialPhysics });\n\n cubeBody.addShape(cubeShape);\n border1Body.addShape(borderShape);\n border2Body.addShape(borderShape);\n\n // Set positions and rotations\n cubeBody.position.copy(rampGroup.position);\n cubeBody.quaternion.copy(rampGroup.quaternion);\n\n border1Body.position.set(x, y + 1, z - width / 2);\n border1Body.quaternion.copy(rampGroup.quaternion);\n\n border2Body.position.set(x, y + 1, z + width / 2);\n border2Body.quaternion.copy(rampGroup.quaternion);\n\n // Set static body type\n cubeBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.STATIC;\n border1Body.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.STATIC;\n border2Body.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.STATIC;\n\n // Add bodies to the world\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(cubeBody);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(border1Body);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(border2Body);\n\n // Store for synchronization in the animation loop\n this.bodies = [cubeBody, border1Body, border2Body];\n this.meshGroup = rampGroup;\n }\n\n // Function to update the Cannon.js bodies\n updateBodies() {\n this.bodies.forEach(body => {\n body.position.copy(this.meshGroup.position);\n body.quaternion.copy(this.meshGroup.quaternion);\n });\n }\n}\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/BuildingBlocks/Ramp.mjs?"); + +/***/ }), + +/***/ "./src/LevelEditor/ObjectAdd.mjs": +/*!***************************************!*\ + !*** ./src/LevelEditor/ObjectAdd.mjs ***! + \***************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ UIAddObj: () => (/* binding */ UIAddObj),\n/* harmony export */ objDimentions: () => (/* binding */ objDimentions)\n/* harmony export */ });\n/* harmony import */ var _BuildingBlocks_BuildingBlock_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../BuildingBlocks/BuildingBlock.mjs */ \"./src/BuildingBlocks/BuildingBlock.mjs\");\n/* harmony import */ var _BuildingBlocks_Cylinder_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../BuildingBlocks/Cylinder.mjs */ \"./src/BuildingBlocks/Cylinder.mjs\");\n/* harmony import */ var _BuildingBlocks_GolfHole_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../BuildingBlocks/GolfHole.mjs */ \"./src/BuildingBlocks/GolfHole.mjs\");\n/* harmony import */ var _BuildingBlocks_MovingPlatform_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../BuildingBlocks/MovingPlatform.mjs */ \"./src/BuildingBlocks/MovingPlatform.mjs\");\n/* harmony import */ var _ball_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../ball.mjs */ \"./src/ball.mjs\");\n/* harmony import */ var _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../BuildingBlocks/Ramp.mjs */ \"./src/BuildingBlocks/Ramp.mjs\");\n\n\n\n// import { Iceblock } from '../BuildingBlocks/Iceblock.mjs';\n\n\n\nlet objDimentions = [];\n\nasync function AddObj(obj) {\n const { x, y, z, w, h, d, t } = obj;\n\n if (t == 'Cube')\n new _BuildingBlocks_BuildingBlock_mjs__WEBPACK_IMPORTED_MODULE_0__.BuildingBlock(x, y, z, w, h, d);\n else if (t == 'Cylinder')\n new _BuildingBlocks_Cylinder_mjs__WEBPACK_IMPORTED_MODULE_1__.Cylinder(x, y, z, w, h, d);\n else if (t == 'Ramp')\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(x, y, z, w, h, d);\n else if (t == 'Moving platform')\n new _BuildingBlocks_MovingPlatform_mjs__WEBPACK_IMPORTED_MODULE_3__.MovingPlatform(x, y, z, w, h, d, 1500, 200);\n else if (t == 'Hole')\n new _BuildingBlocks_GolfHole_mjs__WEBPACK_IMPORTED_MODULE_2__.GolfHole(x, y, z, w, h, d);\n else if (t == 'Ball')\n (0,_ball_mjs__WEBPACK_IMPORTED_MODULE_4__.createBall)(x, y, z);\n}\n\nfunction UIAddObj() {\n const popup = document.createElement('div');\n const addBtn = document.createElement('button');\n const xInput = document.createElement('input');\n const yInput = document.createElement('input');\n const zInput = document.createElement('input');\n const wInput = document.createElement('input');\n const hInput = document.createElement('input');\n const dInput = document.createElement('input');\n const select = document.createElement('select');\n const opt1 = document.createElement('option');\n const opt2 = document.createElement('option');\n const opt3 = document.createElement('option');\n const opt4 = document.createElement('option');\n const opt5 = document.createElement('option');\n const opt6 = document.createElement('option');\n const opt7 = document.createElement('option');\n\n popup.textContent = 'Choose the object you want to add:';\n popup.style.position = 'absolute';\n popup.style.right = '0px';\n popup.style.top = '300px';\n popup.style.display = 'flex';\n popup.style.flexDirection = 'column';\n document.body.appendChild(popup);\n\n popup.appendChild(select);\n select.style.padding = '10px';\n select.style.borderRadius = '10px';\n select.id = 'objectSelect'\n opt1.textContent = 'Nothing';\n opt2.textContent = 'Cube';\n opt3.textContent = 'Cylinder';\n opt4.textContent = 'Ramp';\n opt5.textContent = 'Hole';\n opt6.textContent = 'Moving platform';\n opt7.textContent = 'Ball';\n select.appendChild(opt1);\n select.appendChild(opt2);\n select.appendChild(opt3);\n select.appendChild(opt4);\n select.appendChild(opt5);\n select.appendChild(opt6);\n select.appendChild(opt7);\n\n popup.appendChild(xInput);\n popup.appendChild(yInput);\n popup.appendChild(zInput);\n popup.appendChild(wInput);\n popup.appendChild(hInput);\n popup.appendChild(dInput);\n\n xInput.placeholder = 'X:';\n yInput.placeholder = 'Y:';\n zInput.placeholder = 'Z:';\n wInput.placeholder = 'Width:';\n hInput.placeholder = 'Height:';\n dInput.placeholder = 'Depth:';\n\n xInput.style.padding = '10px';\n yInput.style.padding = '10px';\n zInput.style.padding = '10px';\n wInput.style.padding = '10px';\n hInput.style.padding = '10px';\n dInput.style.padding = '10px';\n\n xInput.style.borderRadius = '10px';\n yInput.style.borderRadius = '10px';\n zInput.style.borderRadius = '10px';\n wInput.style.borderRadius = '10px';\n hInput.style.borderRadius = '10px';\n dInput.style.borderRadius = '10px';\n\n popup.appendChild(addBtn);\n addBtn.textContent = 'Add Object';\n addBtn.style.borderRadius = '10px';\n addBtn.style.border = '0px';\n addBtn.style.borderBottom = '2px solid black';\n addBtn.style.cursor = 'pointer';\n addBtn.style.padding = '10px';\n addBtn.style.backgroundColor = \"rgb(78, 188, 124)\";\n\n addBtn.onclick = async () => {\n const newObj = {\n x: parseFloat(xInput.value),\n y: parseFloat(yInput.value),\n z: parseFloat(zInput.value),\n w: parseFloat(wInput.value),\n h: parseFloat(hInput.value),\n d: parseFloat(dInput.value),\n t: select.value,\n };\n\n objDimentions.push(newObj);\n AddObj(newObj);\n\n // CORS error\n // const { data, error } = await supabase\n // .from('obj_dimensions')\n // .insert([newObj])\n // .select();\n\n // if (error) {\n // console.error('Error inserting data: ', error);\n // } else {\n // console.log('Data inserted successfully: ', data);\n // if (data && data.length > 0) {\n // const insertedId = data[0].id;\n // AddObj(insertedId);\n // }\n // }\n };\n\n // UIOM()\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/LevelEditor/ObjectAdd.mjs?"); + +/***/ }), + +/***/ "./src/Sounds.mjs": +/*!************************!*\ + !*** ./src/Sounds.mjs ***! + \************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ initSoundEvents: () => (/* binding */ initSoundEvents),\n/* harmony export */ playMusic: () => (/* binding */ playBackgroundMusic),\n/* harmony export */ playRandomSoundEffect: () => (/* binding */ playRandomSoundEffect),\n/* harmony export */ playRandomSoundEffectFall: () => (/* binding */ playRandomSoundEffectFall)\n/* harmony export */ });\n/* harmony import */ var _asset_loading_asset_loader_sounds_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asset_loading/asset_loader_sounds.mjs */ \"./src/asset_loading/asset_loader_sounds.mjs\");\n/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ \"./src/utils.mjs\");\n\n\n\nfunction playRandomSoundEffect(volume = 0.7) {\n const randomIndex = (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.randomInteger)(_asset_loading_asset_loader_sounds_mjs__WEBPACK_IMPORTED_MODULE_0__.preloadedSounds.randomSoundsArr.length);\n const soundFile = _asset_loading_asset_loader_sounds_mjs__WEBPACK_IMPORTED_MODULE_0__.preloadedSounds.randomSoundsArr[randomIndex];\n soundFile.volume = volume;\n soundFile.play();\n}\n\nfunction playRandomSoundEffectFall(volume = 0.7) {\n let soundFile = _asset_loading_asset_loader_sounds_mjs__WEBPACK_IMPORTED_MODULE_0__.preloadedSounds.bounceAudio;\n soundFile.volume = volume;\n soundFile.play();\n}\nfunction playBackgroundMusic(volume = 0.4) {\n let isMusicPlaying = false;\n var audio = _asset_loading_asset_loader_sounds_mjs__WEBPACK_IMPORTED_MODULE_0__.preloadedSounds.bgMusicSound;\n if (audio) {\n audio.loop = true;\n audio.play().then(() => { // Handle play promise\n isMusicPlaying = false; // Reset flag after playback ends (or error)\n }).catch(() => {\n isMusicPlaying = false; // Reset flag in case of errors\n });\n audio.volume = volume;\n }\n};\n\nfunction initSoundEvents() {\n let isMusicPlayingClick = false; // Flag to track playback\n\n document.body.addEventListener('click', (event) => {\n console.log(\"Clicked at X:\", event.clientX, \"Y:\", event.clientY);\n\n if (!isMusicPlayingClick) { // Only play if not already playing\n playBackgroundMusic();\n isMusicPlayingClick = true; // Set flag to true after starting playback\n }\n });\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/Sounds.mjs?"); + +/***/ }), + +/***/ "./src/Terrain/Hills.mjs": +/*!*******************************!*\ + !*** ./src/Terrain/Hills.mjs ***! + \*******************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addTreesToGround: () => (/* binding */ addTreesToGround),\n/* harmony export */ createHillsBufferGeometry: () => (/* binding */ createHillsBufferGeometry)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asset_loading/assets_3d.mjs */ \"./src/asset_loading/assets_3d.mjs\");\n/* harmony import */ var perlin_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! perlin.js */ \"./node_modules/perlin.js/perlin.js\");\n/* harmony import */ var _BuildingBlock_no_collision_pine_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../BuildingBlock_no_collision/pine.mjs */ \"./src/BuildingBlock_no_collision/pine.mjs\");\n\n\n\n\n\n\n\nfunction createHillsBufferGeometry(sizeX, sizeY, N, noiseScale, scaleZ) {\n\n // TODO: refactor and make readable\n const uvTex = new three__WEBPACK_IMPORTED_MODULE_4__.TextureLoader().load(\"./images/LiminalTextureLib/Grass2.jpg\");\n const material01 = new three__WEBPACK_IMPORTED_MODULE_4__.MeshPhongMaterial({ map: uvTex, side: three__WEBPACK_IMPORTED_MODULE_4__.DoubleSide, });\t// uv grid\n const geometry = new three__WEBPACK_IMPORTED_MODULE_4__.BufferGeometry();\n // const vertices = new Float32Array([\n // -1.0, -1.0, 1.0, // v0\n // 1.0, -1.0, 1.0, // v1\n // 1.0, 1.0, 1.0, // v2\n // -1.0, 1.0, 1.0, // v3\n // // .....\n // ]);\n let scale = noiseScale;\n // Generate perlin noise heightmap\n let vertices = Array.from({length: N}, (_, x) => Array.from({length: N}, (_, y)=> \n perlin_js__WEBPACK_IMPORTED_MODULE_2__.perlin2(x/scale, y/scale)\n )) \n // Reduce 2d array of numbers(heights) to 1d array of vertices\n .reduce((heightList, curRow, i) => {\n return Array.prototype.concat(\n heightList,\n // Map each height to an array with 3 elements\n curRow\n .map((height, j)=>[i, height, j])\n .reduce((vertices, curVertex)=>{\n return vertices.concat(curVertex)}, []));\n }, []);\n\n let indices1 = Array.from({length: N-1}, (_, x) => Array.from({length: N-1}, (_, y)=> \n [x + y*N, x+y*N+ 1, x + (y+1)*N]\n )).reduce((list, curTriangle)=>Array.prototype.concat(list, curTriangle), [])\n .reduce((list, curTriangle)=>Array.prototype.concat(list, curTriangle), []);\n\n let indices2 = Array.from({length: N-1}, (_, x) => Array.from({length: N-1}, (_, y)=> \n [x + (y+1)*N+ 1, x + (y+1)*N, x+y*N+ 1]\n )).reduce((list, curTriangle)=>Array.prototype.concat(list, curTriangle), [])\n .reduce((list, curTriangle)=>Array.prototype.concat(list, curTriangle), []);\n\n // const indices = [\n // // V0 V1 V2\n // 0, 1, 2,\n // // V2 V3 V0\n // 2, 3, 0,\n // ];\n let indices = Array.prototype.concat(indices1, indices2);\n let repOn = 2;\n let uvMap = Array.from({ length: N }, (_, x) => Array.from({ length: N }, (_, y) => \n [(x%repOn)/repOn, (y%repOn)/repOn]\n )).reduce((list, curTriangle)=>Array.prototype.concat(list, curTriangle), [])\n .reduce((list, curTriangle)=>Array.prototype.concat(list, curTriangle), []);\n\n geometry.setIndex(indices);\n geometry.setAttribute('position', new three__WEBPACK_IMPORTED_MODULE_4__.BufferAttribute(new Float32Array(vertices), 3));\n geometry.setAttribute('uv', new three__WEBPACK_IMPORTED_MODULE_4__.BufferAttribute(new Float32Array(uvMap), 2));\n geometry.computeVertexNormals();\n\n // const material = new THREE.MeshPhongMaterial({ color: \"green\" });\n const mesh = new three__WEBPACK_IMPORTED_MODULE_4__.Mesh(geometry, material01);\n\n mesh.position.set(-sizeX*N/2, -20, -sizeY*N/2);\n mesh.scale.set(sizeX, scaleZ, sizeY);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(mesh);\n return mesh;\n}\n\nfunction addTreesToGround(groundMesh, numTrees) {\n const positions = groundMesh.geometry.attributes.position.array;\n const scaleX = groundMesh.scale.x;\n const scaleZ = groundMesh.scale.z;\n const scaleY = groundMesh.scale.y;\n\n const groundWidth = Math.sqrt(positions.length / 3);\n const groundHeight = Math.sqrt(positions.length / 3);\n\n for (let i = 0; i < numTrees; i++) {\n const x = Math.random() * (groundWidth * scaleX) - (groundWidth * scaleX) / 2;\n const z = Math.random() * (groundHeight * scaleZ) - (groundHeight * scaleZ) / 2;\n const vertexIndex = Math.floor(((x + (groundWidth * scaleX) / 2) / scaleX) * groundWidth + ((z + (groundHeight * scaleZ) / 2) / scaleZ));\n const height = positions[vertexIndex * 3 + 1] * scaleY + groundMesh.position.y;\n\n (0,_BuildingBlock_no_collision_pine_mjs__WEBPACK_IMPORTED_MODULE_3__.createPineTree)(x, height, z);\n }\n}\n\n\n//# sourceURL=webpack://gamedev-engine/./src/Terrain/Hills.mjs?"); + +/***/ }), + +/***/ "./src/asset_loading/asset_config.mjs": +/*!********************************************!*\ + !*** ./src/asset_loading/asset_config.mjs ***! + \********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SoundsFalling: () => (/* binding */ SoundsFalling),\n/* harmony export */ bgMusicFileName: () => (/* binding */ bgMusicFileName),\n/* harmony export */ images: () => (/* binding */ default2dImages),\n/* harmony export */ materials_data: () => (/* binding */ materials_data),\n/* harmony export */ randomSounds: () => (/* binding */ randomSounds)\n/* harmony export */ });\n/* harmony import */ var three_examples_jsm_nodes_Nodes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three/examples/jsm/nodes/Nodes.js */ \"./node_modules/three/examples/jsm/nodes/Nodes.js\");\n\n\nlet default2dImages = [\n { imageName: 'circle', backupColor: 'black' },\n { imageName: 'backField', backupColor: 'green' }\n];\n\n\nlet materials_data = [\n { name: \"BrickConcrete\", path: './images/LiminalTextureLib/BrickConcrete1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff },\n { name: \"Brick\", path: './images/LiminalTextureLib/Brick.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff },\n { name: \"Concrete1\", path: './images/LiminalTextureLib/Concrete1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff },\n { name: \"Concrete2\", path: './images/LiminalTextureLib/Concrete3.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff },\n { name: \"Grass\", path: './images/LiminalTextureLib/Grass1.jpg', tilingx: 2, tilingy: 2, tint: 0xffffff },\n { name: \"Metal1\", path: './images/LiminalTextureLib/Metal1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.7, roughness: 0.5 },\n { name: \"Planks1\", path: './images/LiminalTextureLib/Planks1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff },\n { name: \"Sand\", path: './images/LiminalTextureLib/Sand.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff },\n { name: \"TreeBark\", path: './images/LiminalTextureLib/TreeBark.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff },\n { name: \"Asphalt\", path: './images/LiminalTextureLib/Asphalt.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff },\n { name: \"Wood\", path: './images/LiminalTextureLib/Wood2.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0, roughness: 0.5 },\n { name: \"Metal2\", path: './images/LiminalTextureLib/Metal2.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.7, roughness: 0.5 },\n { name: \"Ice\", path: './images/LiminalTextureLib/Ice.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.3, roughness: 0.2 },\n { name: \"GolfBall\", path: './images/LiminalTextureLib/GolfBall.jpg', tilingx: 3, tilingy: 3, tint: 0xffffff, metalness: 0, roughness: 0.8 },\n { name:\"Flag\", path:'./images/LiminalTextureLib/Flag_of_Bulgaria.png', tilingx: 1, tilingy: 1, tint: 0xffffff},\n { name:\"Pine\", path:'./images/LiminalTextureLib/Pine.jpg', tilingx: 3, tilingy: 3, tint: 0x006400, roughness: 1.}\n];\n\n\nconst randomSounds = [\n \"./music/golf ball hit 1.wav\",\n \"./music/golf ball hit 2.wav\",\n \"./music/golf ball hit 3.wav\",\n \"./music/golf ball hit 4.wav\",\n];\n\nconst SoundsFalling = [\n \"./music/golf ball fall.mp3\",\n];\n\nconst bgMusicFileName = './music/song.mp3';\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/asset_loading/asset_config.mjs?"); + +/***/ }), + +/***/ "./src/asset_loading/asset_loader2d.mjs": +/*!**********************************************!*\ + !*** ./src/asset_loading/asset_loader2d.mjs ***! + \**********************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MyImage: () => (/* binding */ MyImage),\n/* harmony export */ initGlobalImages: () => (/* binding */ initGlobalImages),\n/* harmony export */ tryToLoad: () => (/* binding */ tryToLoad),\n/* harmony export */ tryToLoadWithFullPath: () => (/* binding */ tryToLoadWithFullPath)\n/* harmony export */ });\n/* harmony import */ var _asset_config_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asset_config.mjs */ \"./src/asset_loading/asset_config.mjs\");\n\n\n// Custom image class - sets imgObj.img.src after imgObj.draw() has been called\nclass MyImage {\n constructor(src_, backupColor_) {\n this.src = src_;\n this.backupColor = backupColor_;\n\n // Create image object with no source path\n this.img = new Image();\n this.canDraw = false;\n this.drawBackup = false;\n\n this.img.onload = () => {\n this.canDraw = true;\n }\n this.img.onerror = () => {\n this.canDraw = false;\n this.drawBackup = true;\n throw \"Unable to load image \" + this.src;\n }\n\n }\n draw(x, y, xs, ys) {\n if (xs == undefined) {\n xs = this.img.width | 100;\n ys = this.img.height | 100;\n }\n // If img.src is undefined - set it\n if (!this.img.src) {\n // Load image\n this.img.src = this.src;\n } else if (this.canDraw) {\n try {\n engine.context2d.drawImage(this.img, x, y, xs, ys);\n } catch (e) {\n this.canDraw = false;\n this.drawBackup = true;\n throw e;\n }\n } else if (this.drawBackup) {\n engine.context2d.fillStyle = this.backupColor;\n engine.context2d.fillRect(x, y, xs, ys);\n }\n }\n preload() {\n this.img.src = this.src;\n }\n}\n\n// Attach image objects to global scope\nfunction initGlobalImages() {\n // Load all images from ./images folder \"BY HAND\"\n const imageObjectList = _asset_config_mjs__WEBPACK_IMPORTED_MODULE_0__.images;\n\n // For each element of array - create a global variable\n for (let i = 0; i < imageObjectList.length; i++) {\n let name = imageObjectList[i].imageName,\n backupColor = imageObjectList[i].backupColor;\n\n // Handle image names like \"asdfg[21]\"\n if (name.indexOf(\"[\") > -1) {\n let arrayName = name.slice(0, name.indexOf(\"[\"));\n let arrayNumber = name.slice(name.indexOf(\"[\") + 1, name.indexOf(\"]\"));\n if (!window[arrayName]) {\n window[arrayName] = [];\n }\n window[arrayName][arrayNumber] = tryToLoad(name, backupColor);\n } else {\n // Handle image names like \"backMountains.png\"\n window[name] = tryToLoad(name, backupColor);\n }\n }\n};\n\n\n\nfunction tryToLoad(imageNameWithoutDotPng, backupColor) {\n return new MyImage(\"./images/\" + imageNameWithoutDotPng + \".png\", backupColor);\n}\n\nfunction tryToLoadWithFullPath(pathAndImageName, backupColor) {\n return new MyImage(pathAndImageName, backupColor);\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/asset_loading/asset_loader2d.mjs?"); + +/***/ }), + +/***/ "./src/asset_loading/asset_loader_sounds.mjs": +/*!***************************************************!*\ + !*** ./src/asset_loading/asset_loader_sounds.mjs ***! + \***************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ initSounds: () => (/* binding */ initSounds),\n/* harmony export */ initSoundsFalling: () => (/* binding */ initSoundsFalling),\n/* harmony export */ preloadedSounds: () => (/* binding */ preloadedSounds)\n/* harmony export */ });\n/* harmony import */ var _asset_config_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asset_config.mjs */ \"./src/asset_loading/asset_config.mjs\");\n\n\nlet preloadedSounds = {\n randomSoundsArr: [],\n bgMusicSound: null,\n bounceAudio: null\n};\nfunction initSounds() {\n for(let soundPath of _asset_config_mjs__WEBPACK_IMPORTED_MODULE_0__.randomSounds) {\n const audio = new Audio(soundPath);\n preloadedSounds.randomSoundsArr.push(audio);\n }\n preloadedSounds.bgMusicSound = new Audio(_asset_config_mjs__WEBPACK_IMPORTED_MODULE_0__.bgMusicFileName);\n preloadedSounds.bounceAudio = new Audio(_asset_config_mjs__WEBPACK_IMPORTED_MODULE_0__.SoundsFalling);\n}\nfunction initSoundsFalling() {\n for(let soundPath of _asset_config_mjs__WEBPACK_IMPORTED_MODULE_0__.SoundsFalling) {\n const audio = new Audio(soundPath);\n preloadedSounds.randomSoundsArr.push(audio);\n }\n}\n\n\n//# sourceURL=webpack://gamedev-engine/./src/asset_loading/asset_loader_sounds.mjs?"); + +/***/ }), + +/***/ "./src/asset_loading/assets_3d.mjs": +/*!*****************************************!*\ + !*** ./src/asset_loading/assets_3d.mjs ***! + \*****************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Skybox: () => (/* binding */ Skybox),\n/* harmony export */ loadLiminalTextureLib: () => (/* binding */ loadLiminalTextureLib),\n/* harmony export */ materials: () => (/* binding */ materials),\n/* harmony export */ skybox_texture: () => (/* binding */ skybox_texture)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _asset_config_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./asset_config.mjs */ \"./src/asset_loading/asset_config.mjs\");\n\n\n\n\nlet skybox_texture = null;\nclass Skybox {\n constructor() {\n this.x = 0\n this.y = 0\n this.z = 0\n\n //Load texture\n skybox_texture = new three__WEBPACK_IMPORTED_MODULE_2__.TextureLoader().load('./images/SkyboxTexture.jpg')\n\n //Threejs setup\n this.geometry = new three__WEBPACK_IMPORTED_MODULE_2__.SphereGeometry(500, 32, 16)\n this.material = new three__WEBPACK_IMPORTED_MODULE_2__.MeshBasicMaterial({map: skybox_texture, side: three__WEBPACK_IMPORTED_MODULE_2__.BackSide, fog: false, })\n this.mesh = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh( this.geometry, this.material);\n\n\n //Add to scene\n this.mesh.position.set(this.x, this.y, this.z)\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(this.mesh)\n }\n}\n\nfunction RegisterNewMaterial(name, path, tilingx, tilingy, tint, metalness, roughness) {\n let _tex = new three__WEBPACK_IMPORTED_MODULE_2__.TextureLoader().load(path)\n _tex.wrapS = three__WEBPACK_IMPORTED_MODULE_2__.RepeatWrapping\n _tex.wrapT = three__WEBPACK_IMPORTED_MODULE_2__.RepeatWrapping\n _tex.repeat.set(tilingx, tilingy)\n if(metalness == undefined) metalness = 0;\n if(roughness == undefined) roughness = 0.8;\n materials[name] = new three__WEBPACK_IMPORTED_MODULE_2__.MeshStandardMaterial({color: tint, map: _tex, metalness: metalness, roughness: roughness})\n}\n\nfunction loadLiminalTextureLib() {\n for(let material of _asset_config_mjs__WEBPACK_IMPORTED_MODULE_1__.materials_data) {\n RegisterNewMaterial(material.name, material.path, material.tilingx, material.tilingy, material.tint, material.metalness, material.roughness);\n\n }\n}\n//simply use materials.xmaterial or materials[\"xmaterial\"] and it will return a material for a three mesh\nlet materials = {}\n\n\n//# sourceURL=webpack://gamedev-engine/./src/asset_loading/assets_3d.mjs?"); + +/***/ }), + +/***/ "./src/ball.mjs": +/*!**********************!*\ + !*** ./src/ball.mjs ***! + \**********************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ballBody: () => (/* binding */ ballBody),\n/* harmony export */ ballMesh: () => (/* binding */ ballMesh),\n/* harmony export */ createBall: () => (/* binding */ createBall),\n/* harmony export */ deleteBall: () => (/* binding */ deleteBall)\n/* harmony export */ });\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./asset_loading/assets_3d.mjs */ \"./src/asset_loading/assets_3d.mjs\");\n\n\n\n\nlet ballMesh, ballBody;\n\nfunction createBall(x, y, z) {\n // Ball\n const ballMaterialPhysics = new cannon_es__WEBPACK_IMPORTED_MODULE_2__.Material(); // Create a new material\n ballMaterialPhysics.friction = 1;\n ballMaterialPhysics.restitution = 1.3;\n const ballShape = new cannon_es__WEBPACK_IMPORTED_MODULE_2__.Sphere(1);\n ballBody = new cannon_es__WEBPACK_IMPORTED_MODULE_2__.Body({\n mass: 5,\n position: new cannon_es__WEBPACK_IMPORTED_MODULE_2__.Vec3(x, y, z),\n shape: ballShape,\n material: ballMaterialPhysics,\n });\n \n ballBody.linearDamping = 0.5;\n \n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(ballBody);\n const ballGeometry = new three__WEBPACK_IMPORTED_MODULE_3__.SphereGeometry(1, 32, 32);\n \n // It is golf. The ball must be white\n const ballMaterial = new three__WEBPACK_IMPORTED_MODULE_3__.MeshPhongMaterial({ color: 0xffffff });\n ballMesh = new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(ballGeometry, _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_1__.materials.GolfBall);\n\n window.ballMesh = ballMesh;\n window.ballBody = ballBody;\n\n ballMesh.position.set(x, y, z);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(ballMesh);\n}\nfunction deleteBall() {\n // Remove mesh from scene\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.remove(ballMesh);\n // Remove body from world\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.removeBody(ballBody);\n }\n \n \n\n\n//# sourceURL=webpack://gamedev-engine/./src/ball.mjs?"); + +/***/ }), + +/***/ "./src/engine.mjs": +/*!************************!*\ + !*** ./src/engine.mjs ***! + \************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ engine: () => (/* binding */ engine)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var _menu_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./menu.mjs */ \"./src/menu.mjs\");\n\n\n\n\nlet engine = {\n // Start engine\n init: initEngine,\n // Game update function\n update: () => { console.log(\"No update function is set in game engine.\"); engine.isCustomUpdate = false },\n isCustomUpdate: true,\n // Game 2d draw function (draws on 2d canvas)\n draw2d: default_draw,\n // Events\n onkeyup: keyCode => { console.log(\"Default keyup. keycode:\", keyCode) },\n onkeydown: keyCode => { console.log(\"Default keydown. keycode:\", keyCode) },\n oninit: () => { console.log(\"Default oninit.\") },\n onmouseup: () => { console.log(\"Mouseup: \", engine.mouseX, engine.mouseY) },\n onmousedown: () => { console.log(\"Mousedown: \", engine.mouseX, engine.mouseY) },\n onmousemove: () => { },\n // context2d objects\n context2d: null,\n canvas2d: null,\n updateTime: 10,\n mouseX: 0,\n mouseY: 0,\n isKeyPressed: new Array(256).fill(0),\n endlessCanvas: false,\n // Three js objects\n scene: null,\n camera: null,\n renderer: null,\n // Cannon js\n cannonjs_world: null\n};\n\nconst reqAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) {\n setTimeout(callback, 1000 / 30);\n};\n\n\nfunction updateMousePosition(e) {\n let boundingRect = engine.canvas2d.getBoundingClientRect();\n engine.mouseX = e.pageX - boundingRect.x;\n engine.mouseY = e.pageY - boundingRect.y;\n}\n\nfunction updateMousePositionTouchEvent(e) {\n let boundingRect = engine.canvas2d.getBoundingClientRect();\n let touchobj = e.changedTouches[0];\n engine.mouseX = touchobj.pageX - boundingRect.x;\n engine.mouseY = touchobj.pageY - boundingRect.y;\n}\n\nfunction init2dCanvas() {\n // Get engine.canvas element\n let canvasElement = document.createElement('canvas');\n canvasElement.id = \"engine-canvas\";\n document.body.appendChild(canvasElement);\n\n canvasElement.style.position = \"absolute\"; // Position canvas absolutely\n canvasElement.style.left = \"0\"; // Align canvas to the left of the parent element\n canvasElement.style.top = \"0\"; // Align canvas to the top of the parent element\n canvasElement.style.zIndex = \"1\"; // Set higher zIndex to display over other elements\n // canvasElement.style.pointerEvents = \"none\"; // Disable pointer events to allow interaction with underlying canvas\n\n engine.canvas2d = canvasElement;\n if (engine.endlessCanvas) {\n engine.canvas2d.width = window.innerWidth;\n engine.canvas2d.height = window.innerHeight;\n\n // Change engine.canvas.width and .height on browser resize\n window.onresize = function () {\n engine.canvas2d.width = window.innerWidth;\n engine.canvas2d.height = window.innerHeight;\n };\n } else {\n // Default engine.canvas size\n engine.canvas2d.width = 800;\n engine.canvas2d.height = 600;\n }\n\n // Get 2d engine.context\n engine.context2d = engine.canvas2d.getContext(\"2d\");\n engine.context2d.fillStyle = \"#0000ff\";\n}\n\nfunction initThreeJS() {\n if (!engine.canvas2d) throw \"2d canvas should be initialized first\";\n\n engine.scene = new three__WEBPACK_IMPORTED_MODULE_1__.Scene();\n engine.camera = new three__WEBPACK_IMPORTED_MODULE_1__.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);\n engine.renderer = new three__WEBPACK_IMPORTED_MODULE_1__.WebGLRenderer();\n engine.renderer.setSize(canvas2d.width, canvas2d.height);\n engine.renderer.domElement.style.margin = 0;\n document.body.appendChild(engine.renderer.domElement);\n\n engine.cannonjs_world = new cannon_es__WEBPACK_IMPORTED_MODULE_2__.World();\n engine.cannonjs_world.gravity.set(0, -9.82, 0); // Set gravity\n engine.cannonjs_world.broadphase = new cannon_es__WEBPACK_IMPORTED_MODULE_2__.NaiveBroadphase(); // Use naive broadphase\n engine.cannonjs_world.solver.iterations = 10; // Set solver iterations\n}\n\nfunction initEvents() {\n // Events for touchscreen devices\n if ('ontouchstart' in window || navigator.maxTouchPoints) {\n window.addEventListener(\"touchstart\", function (e) {\n // Update global mouseX, mouseY variables\n updateMousePositionTouchEvent(e);\n engine.onmousedown();\n });\n window.addEventListener(\"touchend\", function (e) {\n updateMousePositionTouchEvent(e);\n engine.onmouseup();\n });\n window.addEventListener(\"touchmove\", function (e) {\n updateMousePositionTouchEvent(e);\n });\n }\n\n // Update global mouseX, mouseY variables\n window.addEventListener(\"mousemove\", updateMousePosition);\n\n // Call mousemove, mouseup, mousedown function from game.js if they exist\n window.addEventListener(\"mousemove\", (e) => { engine.onmousemove(e) });\n window.addEventListener(\"mouseup\", (e) => { engine.onmouseup(e) });\n window.addEventListener(\"mousedown\", () => { engine.onmousedown() });\n\n // Update global isKeyPressed array\n window.addEventListener(\"keydown\", function (e) {\n engine.isKeyPressed[e.keyCode] = 1;\n engine.onkeydown(e.keyCode);\n });\n window.addEventListener(\"keyup\", function (e) {\n engine.isKeyPressed[e.keyCode] = 0;\n engine.onkeyup(e.keyCode);\n });\n}\n// Redraw will be executed many times\nfunction redraw() {\n if(_menu_mjs__WEBPACK_IMPORTED_MODULE_0__.menuConfig.gameStarted){\n engine.cannonjs_world.step(1 / 20);\n }\n engine.context2d.save();\n\n // Call draw function from game.js\n engine.draw2d();\n\n engine.renderer.render(engine.scene, engine.camera);\n engine.context2d.restore();\n // Call redraw after some time (the browser decides this time)\n reqAnimationFrame(redraw);\n};\n\nfunction default_draw() {\n engine.context2d.clearRect(0, 0, engine.canvas2d.width, engine.canvas2d.height);\n engine.context2d.globalAlpha = 1;\n engine.context2d.fillStyle = \"#FF0000\";\n engine.context2d.font = \"20px Arial\";\n\n engine.context2d.fillText(\"No 2d draw function set. (calling default engine.draw2d function).\", 40, 40);\n\n if (!engine.isCustomUpdate) {\n engine.isCustomUpdate = true;\n engine.context2d.fillText(\"No update function set. (calling default engine.update function).\", 40, 80);\n }\n}\n\n// Init game engine\nfunction initEngine() {\n \n init2dCanvas();\n\n // Attach basic mouse and keyboard events\n initEvents();\n\n // Attach common objects to global scope\n window.engine = engine;\n window.context2d = engine.context2d;\n window.canvas2d = engine.canvas2d;\n\n initThreeJS();\n\n // Start draw loop\n redraw();\n // Start update loop\n setInterval(() => { engine.update() }, engine.updateTime);\n}\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/engine.mjs?"); + +/***/ }), + +/***/ "./src/firingTheBall.mjs": +/*!*******************************!*\ + !*** ./src/firingTheBall.mjs ***! + \*******************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ firingTheBall: () => (/* binding */ firingTheBall)\n/* harmony export */ });\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var _Sounds_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Sounds.mjs */ \"./src/Sounds.mjs\");\n/* harmony import */ var _ball_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ball.mjs */ \"./src/ball.mjs\");\n/* harmony import */ var _menu_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./menu.mjs */ \"./src/menu.mjs\");\n\n\n\n\n\nlet lastShotTime = 0;\nconst cooldownTime = 10 * 500; // 10 seconds in milliseconds\n\nlet firingTheBall = {\n power: 1,\n direction: 0,\n Shoot: () => { shoot() },\n isBallShot: false,\n shotFromWhere: {x: 0, y: 0, z: 0},\n initUI: initShootingUI\n};\n\nfunction addLabel(id, text, where) {\n let labelEl = document.createElement(\"label\");\n labelEl.for = id;\n labelEl.innerHTML = text;\n where.appendChild(labelEl);\n}\n\nfunction initShootingUI() {\n // Create UI elements\n let inputsDivEl = document.createElement(\"div\");\n inputsDivEl.id = \"inputs\";\n inputsDivEl.style.position = \"absolute\";\n inputsDivEl.style.right = \"0\";\n inputsDivEl.style.top = \"0\";\n inputsDivEl.style.display = \"flex\";\n inputsDivEl.style.flexDirection = \"column\";\n inputsDivEl.style.justifyContent = \"start\";\n inputsDivEl.style.gap = \"10px\";\n document.body.appendChild(inputsDivEl);\n\n let powerSliderEl = document.createElement(\"input\");\n powerSliderEl.type = \"range\";\n powerSliderEl.id = \"power\";\n powerSliderEl.min = 0.1;\n powerSliderEl.max = 100;\n powerSliderEl.step = 0.1\n powerSliderEl.value = 1;\n addLabel(\"power\", \"Power:\", inputsDivEl);\n inputsDivEl.appendChild(powerSliderEl);\n\n\n let shootButtonEl = document.createElement(\"button\");\n shootButtonEl.id = \"shootB\";\n shootButtonEl.innerHTML = \"Shoot\";\n shootButtonEl.onclick = shoot;\n inputsDivEl.appendChild(shootButtonEl);\n\n powerSliderEl.addEventListener(\"input\", () => {\n firingTheBall.power = parseFloat(powerSliderEl.value);\n });\n}\n\n\nfunction shoot() {\n const currentTime = Date.now();\n \n // Check if enough time has passed since the last shot\n if (currentTime - lastShotTime < cooldownTime) {0\n console.log(\"Cooldown period active. Ostavat ti owe\", (currentTime - lastShotTime)/1000, \"sekundi do 5\" );\n return;\n }\n\n // Reset last shot time to current time\n lastShotTime = currentTime;\n\n firingTheBall.isBallShot = true;\n if (_menu_mjs__WEBPACK_IMPORTED_MODULE_2__.menuConfig.sfxEnabled) { \n (0,_Sounds_mjs__WEBPACK_IMPORTED_MODULE_0__.playRandomSoundEffect)(); \n }\n firingTheBall.shotFromWhere.x = _ball_mjs__WEBPACK_IMPORTED_MODULE_1__.ballBody.position.x;\n firingTheBall.shotFromWhere.y = _ball_mjs__WEBPACK_IMPORTED_MODULE_1__.ballBody.position.y;\n firingTheBall.shotFromWhere.z = _ball_mjs__WEBPACK_IMPORTED_MODULE_1__.ballBody.position.z;\n\n if (_ball_mjs__WEBPACK_IMPORTED_MODULE_1__.ballBody.type == cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.STATIC) {\n _ball_mjs__WEBPACK_IMPORTED_MODULE_1__.ballBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_3__.Body.DYNAMIC;\n }\n\n let calPower = firingTheBall.power;\n let calDirection = firingTheBall.direction;\n\n let impulse = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3(Math.cos(calDirection) * calPower, 0, Math.sin(calDirection) * calPower);\n let relativePoint = new cannon_es__WEBPACK_IMPORTED_MODULE_3__.Vec3();\n _ball_mjs__WEBPACK_IMPORTED_MODULE_1__.ballBody.applyImpulse(impulse, relativePoint);\n}\n\n\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/firingTheBall.mjs?"); + +/***/ }), + +/***/ "./src/game.mjs": +/*!**********************!*\ + !*** ./src/game.mjs ***! + \**********************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ game: () => (/* binding */ game)\n/* harmony export */ });\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var three_addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! three/addons/controls/OrbitControls.js */ \"./node_modules/three/examples/jsm/controls/OrbitControls.js\");\n/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ \"./src/utils.mjs\");\n/* harmony import */ var _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./firingTheBall.mjs */ \"./src/firingTheBall.mjs\");\n/* harmony import */ var _menu_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./menu.mjs */ \"./src/menu.mjs\");\n/* harmony import */ var _Sounds_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Sounds.mjs */ \"./src/Sounds.mjs\");\n/* harmony import */ var _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BuildingBlocks/Ramp.mjs */ \"./src/BuildingBlocks/Ramp.mjs\");\n/* harmony import */ var _BuildingBlocks_BuildingBlock_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BuildingBlocks/BuildingBlock.mjs */ \"./src/BuildingBlocks/BuildingBlock.mjs\");\n/* harmony import */ var _BuildingBlocks_MovingPlatform_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./BuildingBlocks/MovingPlatform.mjs */ \"./src/BuildingBlocks/MovingPlatform.mjs\");\n/* harmony import */ var _BuildingBlocks_Cylinder_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./BuildingBlocks/Cylinder.mjs */ \"./src/BuildingBlocks/Cylinder.mjs\");\n/* harmony import */ var _BuildingBlocks_GolfHole_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./BuildingBlocks/GolfHole.mjs */ \"./src/BuildingBlocks/GolfHole.mjs\");\n/* harmony import */ var _BuildingBlocks_GolfHole_DetectionPoint_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./BuildingBlocks/GolfHole_DetectionPoint.mjs */ \"./src/BuildingBlocks/GolfHole_DetectionPoint.mjs\");\n/* harmony import */ var _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./asset_loading/assets_3d.mjs */ \"./src/asset_loading/assets_3d.mjs\");\n/* harmony import */ var _ball_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ball.mjs */ \"./src/ball.mjs\");\n/* harmony import */ var _BuildingBlocks_Particle_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./BuildingBlocks/Particle.mjs */ \"./src/BuildingBlocks/Particle.mjs\");\n/* harmony import */ var _Terrain_Hills_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Terrain/Hills.mjs */ \"./src/Terrain/Hills.mjs\");\n/* harmony import */ var _BuildingBlocks_Iceblock_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./BuildingBlocks/Iceblock.mjs */ \"./src/BuildingBlocks/Iceblock.mjs\");\n/* harmony import */ var _BuildingBlock_no_collision_flag_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./BuildingBlock_no_collision/flag.mjs */ \"./src/BuildingBlock_no_collision/flag.mjs\");\n\n\n\n\n\n\n\n\n // Visuals for the game\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst orbitControls = true;\nlet controls = null;\n\n\nfunction createGround() {\n // Create ground plane\n const groundShape = new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Plane();\n const groundBody = new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Body({ mass: 2, shape: groundShape });\n groundBody.quaternion.setFromAxisAngle(new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Vec3(1, 0, 0), -Math.PI / 2); // Set rotation to align with Cannon.js\n groundBody.position.set(0, 0, 0); // Set position\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(groundBody);\n\n // Create visual representation of ground (in Three.js)\n const groundGeometry = new three__WEBPACK_IMPORTED_MODULE_18__.PlaneGeometry(100, 100);\n const groundMaterial = new three__WEBPACK_IMPORTED_MODULE_18__.MeshPhongMaterial({ color: 0x00ff00, side: three__WEBPACK_IMPORTED_MODULE_18__.DoubleSide });\n const groundMesh = new three__WEBPACK_IMPORTED_MODULE_18__.Mesh(groundGeometry, groundMaterial);\n groundMesh.rotation.x = -Math.PI / 2; // Rotate to align with Cannon.js\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(groundMesh);\n}\n\nfunction initCamera() {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Play\",275,175,250,100,\"red\",50,\"white\");\n\n // Init camera\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.position.set(0, 20, 80);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.lookAt(0, 10, 0);\n\n // Change far frustum plane to account for skybox\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.far = 10000;\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.updateProjectionMatrix();\n}\n\nfunction initLights() {\n //Ambient light is now the skybox\n const ambientLight = new three__WEBPACK_IMPORTED_MODULE_18__.AmbientLight(_asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_11__.skybox_texture, 1);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(ambientLight);\n\n //directional light is white to not tint the phong material too much\n const directionalLight = new three__WEBPACK_IMPORTED_MODULE_18__.DirectionalLight(0xffffff, 1);\n directionalLight.position.set(10, 20, 10);\n directionalLight.lookAt(0, 0, 0);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(directionalLight);\n}\n\nfunction initLevel() {\n // const block1 = new BuildingBlock(0, 5, 0, 20, 10, 20);\n // const block2 = new BuildingBlock(20, 0, 0, 50, 10, 20);\n\n // new BuildingBlock(0, 5, 0, 20, 10, 20);\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(0, 9.3, 0, 20, 0, 0);\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(16.5, 2.5, 0, 20, Math.PI, Math.PI / 4);\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(33, -5.2, 0, 20, 0, 0);\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(53, -5.2, 0, 20, 0, 0);\n\n\n new _BuildingBlocks_MovingPlatform_mjs__WEBPACK_IMPORTED_MODULE_7__.MovingPlatform(73, -5.2, 0, 133, 25.2, 0, 20, 1, 15);\n\n new _BuildingBlocks_BuildingBlock_mjs__WEBPACK_IMPORTED_MODULE_6__.BuildingBlock(153, 20.2, 0, 20, 10, 20);\n // new Cylinder(25, 0, 2, 5, 5);\n new _BuildingBlocks_Iceblock_mjs__WEBPACK_IMPORTED_MODULE_15__.Ice(153, 22.8, -60, 20, 5, 100);\n\n new _BuildingBlocks_BuildingBlock_mjs__WEBPACK_IMPORTED_MODULE_6__.BuildingBlock(153, 20.2, -120, 20, 10, 20);\n new _BuildingBlocks_GolfHole_mjs__WEBPACK_IMPORTED_MODULE_9__.GolfHole(153, 26.2, -120, 1.8, 1, 2.1, 64, 12, 51.2, -5.9, 0, 1, 2, 2, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody)\n let f1 = (0,_BuildingBlock_no_collision_flag_mjs__WEBPACK_IMPORTED_MODULE_16__.flag)(-14,9,-20);\n f1.rotation.y = 30;\n}\n\nlet ballDirectionMesh = [];\nfunction initBallDirectionArrows() {\n let colors = [0xffd000, 0xff9900, 0xff0000];\n for (let i = 0; i < 3; i++) {\n const ballDirectionGeometry = new three__WEBPACK_IMPORTED_MODULE_18__.ConeGeometry(.5, 5, 5);\n const ballDirectionMaterial = new three__WEBPACK_IMPORTED_MODULE_18__.MeshPhongMaterial({ color: colors[i], flatShading: true });\n ballDirectionMesh.push(new three__WEBPACK_IMPORTED_MODULE_18__.Mesh(ballDirectionGeometry, ballDirectionMaterial));\n ballDirectionMesh[i].position.set(5, 30 + 4 * i, 0)\n\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(ballDirectionMesh[i]);\n }\n}\nlet time = 0, obx = 0, oby = 0, obz = 0;\nfunction initGame() {\n // initSoundEvents();\n if (_menu_mjs__WEBPACK_IMPORTED_MODULE_3__.menuConfig.showMenu) {\n (0,_menu_mjs__WEBPACK_IMPORTED_MODULE_3__.initMenu)(initLevel);\n } else {\n _menu_mjs__WEBPACK_IMPORTED_MODULE_3__.menuConfig.gameStarted = true;\n (0,_Sounds_mjs__WEBPACK_IMPORTED_MODULE_4__.initSoundEvents)();\n initLevel();\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.initUI();\n\n }\n // Create ball and attach to window\n (0,_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.createBall)(5, 30, 0);\n\n let groundMesh = (0,_Terrain_Hills_mjs__WEBPACK_IMPORTED_MODULE_14__.createHillsBufferGeometry)(10, 10, 100, 5, 20);\n // Init slider and buttons for firing the ball\n (0,_Terrain_Hills_mjs__WEBPACK_IMPORTED_MODULE_14__.addTreesToGround)(groundMesh, 100);\n\n // Setup camera position\n initCamera();\n\n // Init orbit controls\n if (orbitControls) {\n controls = new three_addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_19__.OrbitControls(_engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera, _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.canvas2d);\n controls.target = _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position;\n controls.maxDistance = 150\n controls.enableDamping = true\n controls.dampingFactor = .1\n if (_menu_mjs__WEBPACK_IMPORTED_MODULE_3__.menuConfig.gameStarted == false) {\n controls.autoRotate = true\n controls.autoRotateSpeed = 0.5\n\n }\n }\n\n // Setup camera position\n initCamera();\n\n initLights();\n\n initBallDirectionArrows();\n\n // Init skybox\n const skybox = new _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_11__.Skybox();\n\n //DEBUG spawn test emitter\n\n let lastDX, lastDY, lastDZ;\n\n // Set custom update function\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.update = () => {\n\n time++;\n controls.update();\n\n //update all particle systems\n (0,_BuildingBlocks_Particle_mjs__WEBPACK_IMPORTED_MODULE_13__.updateEmitters)()\n\n // Update ball mesh position\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.copy(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position);\n\n const bounceThreshold = 3;\n\n function checkBounce(lastVelocities, currentVelocities) {\n return Object.keys(currentVelocities).some(axis =>\n Math.abs(lastVelocities[axis] - currentVelocities[axis]) > bounceThreshold\n );\n }\n\n const currentVelocities = { x: _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.velocity.x, y: _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.velocity.y, z: _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.velocity.z };\n\n if (checkBounce({ x: lastDX, y: lastDY, z: lastDZ }, currentVelocities)) {\n (0,_BuildingBlocks_Particle_mjs__WEBPACK_IMPORTED_MODULE_13__.createNewEmitter)(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.x, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.y, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.z, \"burst\", {particle_cnt: 20, particle_lifetime: {min:0.2, max:0.5}, power: 0.05, fired: false})\n ;(0,_Sounds_mjs__WEBPACK_IMPORTED_MODULE_4__.playRandomSoundEffectFall)();\n }\n lastDX = currentVelocities.x;\n lastDY = currentVelocities.y;\n lastDZ = currentVelocities.z;\n make_the_ball_static_when_is_not_moving();\n\n adjust_the_ball_direction();\n\n show_the_ball_direction();\n\n if(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.y < -50){ //respawns the ball if it has fallen beneath the map\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.set(_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.shotFromWhere.x, _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.shotFromWhere.y, _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.shotFromWhere.z);\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_17__.Body.STATIC\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.isBallShot = false;\n }\n };\n}\n\n\nfunction make_the_ball_static_when_is_not_moving() {\n const velocityThreshold = 0;\n const timeInterval = 10;\n\n if (time % timeInterval === 0 && _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.velocity.length() < velocityThreshold) {\n const groundRay = new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Ray(\n new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Vec3(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.x, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.y - 1.1, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.z),\n new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Vec3(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.x, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.y - 1.2, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.z)\n );\n\n const intersect = groundRay.intersectWorld(_engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world, {});\n\n if (intersect) {\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_17__.Body.STATIC;\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.isBallShot = false;\n }\n\n }\n}\n\nfunction adjust_the_ball_direction() {\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.direction = Math.atan2(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.z - _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.position.z, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.x - _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.position.x);\n}\n\nfunction show_the_ball_direction() {\n for (let i = 0; i < 3; i++) {\n if(_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.isBallShot){\n ballDirectionMesh[i].visible = false;\n\n continue;\n }\n if (ballDirectionMesh[i] !== undefined) {\n // Calculates the needed arrows\n if (i <= Math.floor(Math.abs((_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.power + 20) / 100) * 2)) {\n ballDirectionMesh[i].visible = true;\n\n ballDirectionMesh[i].position.set(\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.x + Math.cos(_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.direction) * 3.5 * (i + 1),\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.y,\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.z + Math.sin(_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.direction) * 3.5 * (i + 1)\n );\n\n\n ballDirectionMesh[i].rotation.x = Math.PI/2;\n ballDirectionMesh[i].rotation.y = 0;\n ballDirectionMesh[i].rotation.z = _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.direction - Math.PI/2;\n\n } else {\n ballDirectionMesh[i].visible = false;\n }\n }\n }\n};\n\nlet game = {\n init: initGame\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/game.mjs?"); + +/***/ }), + +/***/ "./src/menu.mjs": +/*!**********************!*\ + !*** ./src/menu.mjs ***! + \**********************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Menu: () => (/* binding */ Menu),\n/* harmony export */ initMenu: () => (/* binding */ initMenu),\n/* harmony export */ menuConfig: () => (/* binding */ menuConfig)\n/* harmony export */ });\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ \"./src/utils.mjs\");\n/* harmony import */ var _Sounds_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Sounds.mjs */ \"./src/Sounds.mjs\");\n/* harmony import */ var _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./firingTheBall.mjs */ \"./src/firingTheBall.mjs\");\n\n\n\n\n\n\nfunction initMenu(onPlayButtonCB) {\n let menu = new Menu();\n // Set custom draw function\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.draw2d = (() => {\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.context2d.clearRect(0, 0, _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.canvas2d.width, _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.canvas2d.height);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.context2d.strokeRect(0, 0, canvas2d.width, canvas2d.height);\n menu.draw()\n });\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.onmouseup = ((e) => {\n let mouseX = e.clientX;\n let mouseY = e.clientY;\n if (!menuConfig.gameStarted) {\n if ((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.areColliding)(mouseX, mouseY, 1, 1, 275, 200, 250, 100)) { //Play\n //initGame();\n onPlayButtonCB();\n menu.startSimulation();\n }\n if ((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.areColliding)(mouseX, mouseY, 1, 1, 175, 475, 200, 75)) { //Music\n menu.toggleMusic()\n }\n if ((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.areColliding)(mouseX, mouseY, 1, 1, 425, 475, 200, 75)) { //Sfx\n menu.toggleSfx()\n }\n }\n })\n return menu;\n}\n\nclass Menu {\n constructor(){\n }\n draw(){\n if (!menuConfig.gameStarted) {\n //play button\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Play\", 275, 175, 250, 100, \"red\", 50, \"white\");\n //skins button - no functionality\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Skins\", 275, 300, 250, 100, \"red\", 50, \"white\");\n //music toggle button - should be replaced with icon\n if (menuConfig.musicEnabled) {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Toggle music\", 175, 475, 200, 75, \"red\", 30, \"white\");\n } else {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Toggle music\", 175, 475, 200, 75, \"grey\", 30, \"white\");\n }\n //SFX toggle button - should be replaced with icon\n if (menuConfig.sfxEnabled) {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Toggle SFX\", 425, 475, 200, 75, \"red\", 30, \"white\");\n } else {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Toggle SFX\", 425, 475, 200, 75, \"grey\", 30, \"white\");\n }\n } else if(isWinner) {\n // TODO: for some reason - this does nothing\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"You Win\", 275, 175, 250, 100, \"red\", 50, \"white\");\n }\n }\n startSimulation(){\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.context2d.globalAlpha = 0;\n menuConfig.gameStarted = true;\n if(menuConfig.musicEnabled){ //there is no pause menu so this should work for now\n (0,_Sounds_mjs__WEBPACK_IMPORTED_MODULE_2__.playMusic)();\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_3__.firingTheBall.initUI();\n }\n }\n toggleMusic(){\n menuConfig.musicEnabled = !menuConfig.musicEnabled\n }\n toggleSfx(){\n menuConfig.sfxEnabled = !menuConfig.sfxEnabled\n }\n}\nlet isWinner = false;\nlet menuConfig = {\n gameStarted: false,\n setGameWon: ()=>{isWinner = true;},\n musicEnabled: true,\n sfxEnabled: true,\n showMenu: true\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/menu.mjs?"); + +/***/ }), + +/***/ "./src/utils.mjs": +/*!***********************!*\ + !*** ./src/utils.mjs ***! + \***********************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ areColliding: () => (/* binding */ areColliding),\n/* harmony export */ createButton: () => (/* binding */ createButton),\n/* harmony export */ drawImage: () => (/* binding */ drawImage),\n/* harmony export */ drawLine: () => (/* binding */ drawLine),\n/* harmony export */ drawText: () => (/* binding */ drawText),\n/* harmony export */ isFunction: () => (/* binding */ isFunction),\n/* harmony export */ randomInteger: () => (/* binding */ randomInteger)\n/* harmony export */ });\nfunction areColliding(Ax, Ay, Awidth, Aheight, Bx, By, Bwidth, Bheight) {\n if (Bx <= Ax + Awidth) {\n if (Ax <= Bx + Bwidth) {\n if (By <= Ay + Aheight) {\n if (Ay <= By + Bheight) {\n return 1;\n }\n }\n }\n }\n return 0;\n};\n\nfunction randomInteger(upTo) {\n return Math.floor(Math.random() * upTo);\n}\n\nfunction drawLine(startX, startY, endX, endY) {\n // For better performance bunch calls to lineTo without beginPath() and stroke() inbetween.\n engine.context2d.beginPath(); // resets the current path\n engine.context2d.moveTo(startX, startY);\n engine.context2d.lineTo(endX, endY);\n engine.context2d.stroke();\n}\nfunction drawImage(myImageObject, x, y, xs, ys) {\n myImageObject.draw(x, y, xs, ys);\n}\n\nfunction isFunction(f) {\n return typeof (f) == \"function\";\n}\nfunction drawText(text, x, y, fontsize = 16, textCol = \"black\", font = \"Arial\") {\n const ctx = engine.context2d;\n ctx.fillStyle = textCol;\n ctx.font = `${fontsize}px ${font}`;\n ctx.textAlign = \"left\";\n ctx.textBaseline = \"top\";\n ctx.fillText(text, x, y);\n}\n\nfunction createButton(text, x, y, w, h, buttonCol, fontsize, textCol, borderRadius = 10, font = \"Arial\") {\n const ctx = engine.context2d;\n ctx.fillStyle = buttonCol;\n ctx.beginPath();\n ctx.moveTo(x + borderRadius, y);\n ctx.lineTo(x + w - borderRadius, y);\n ctx.quadraticCurveTo(x + w, y, x + w, y + borderRadius);\n ctx.lineTo(x + w, y + h - borderRadius);\n ctx.quadraticCurveTo(x + w, y + h, x + w - borderRadius, y + h);\n ctx.lineTo(x + borderRadius, y + h);\n ctx.quadraticCurveTo(x, y + h, x, y + h - borderRadius);\n ctx.lineTo(x, y + borderRadius);\n ctx.quadraticCurveTo(x, y, x + borderRadius, y);\n ctx.closePath();\n ctx.fill();\n \n ctx.fillStyle = textCol;\n ctx.font = `${fontsize}px ${font}`;\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(text, x + w / 2, y + h / 2);\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/utils.mjs?"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval devtool is used. +/******/ var __webpack_exports__ = __webpack_require__("./src/init.js"); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/public/index_bundle.js.LICENSE.txt b/public/index_bundle.js.LICENSE.txt new file mode 100644 index 0000000..4af725c --- /dev/null +++ b/public/index_bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/** + * @license + * Copyright 2010-2023 Three.js Authors + * SPDX-License-Identifier: MIT + */ + +/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ diff --git a/src/BuildingBlock_no_collision/flag.mjs b/src/BuildingBlock_no_collision/flag.mjs new file mode 100644 index 0000000..3cd20b3 --- /dev/null +++ b/src/BuildingBlock_no_collision/flag.mjs @@ -0,0 +1,25 @@ +import * as THREE from "three"; +import { engine } from "../engine.mjs"; +import { materials } from "../asset_loading/assets_3d.mjs"; + +function flag(x,y,z){ + let poleHeight = 15 + let flagGroup = new THREE.Group(); + let poleGeom = new THREE.CylinderGeometry(1, 1, poleHeight, 10 ); + let poleMesh = new THREE.Mesh(poleGeom, materials.Metal1); + poleMesh.position.set(25, poleHeight/2 ,0); + flagGroup.add(poleMesh); + + let flagSGeom = new THREE.PlaneGeometry( 7, 5 ); + + materials.Flag.side = THREE.DoubleSide; + let flagSMesh = new THREE.Mesh(flagSGeom, materials.Flag); + flagSMesh.position.set(29, poleHeight-3,0); + flagGroup.add(flagSMesh); + + + flagGroup.position.set(x, y, z); + engine.scene.add(flagGroup); + return flagGroup; +} +export {flag}; \ No newline at end of file diff --git a/src/BuildingBlock_no_collision/pine.mjs b/src/BuildingBlock_no_collision/pine.mjs index bf69789..40cd9b6 100644 --- a/src/BuildingBlock_no_collision/pine.mjs +++ b/src/BuildingBlock_no_collision/pine.mjs @@ -9,14 +9,13 @@ function createPineTree(x, y, z) { 1, 1, treeHeight, 10 ); let trunkMesh = new THREE.Mesh(trunkGeom, materials.Wood); trunkMesh.position.set(0, treeHeight/2 ,0); - console.log(materials.Wood) treeGroup.add(trunkMesh); treeGroup.position.set(x, y, z); for(let i = 0; i <= nSegments; i++) { let treeSegmentGeom = new THREE.ConeGeometry( 1 + biggestSegmentRadius/(2+i), 2 + (treeHeight - baseHeight)/nSegments, 32 ); - let treeMesh = new THREE.Mesh(treeSegmentGeom, materials.Grass); + let treeMesh = new THREE.Mesh(treeSegmentGeom, materials.Pine); treeMesh.position.set(0, baseHeight + i*(treeHeight-baseHeight)/nSegments, 0); treeGroup.add(treeMesh); } diff --git a/src/BuildingBlocks/BuildingBlock.mjs b/src/BuildingBlocks/BuildingBlock.mjs index f57536e..015e432 100644 --- a/src/BuildingBlocks/BuildingBlock.mjs +++ b/src/BuildingBlocks/BuildingBlock.mjs @@ -17,7 +17,7 @@ class BuildingBlock { groundMaterialPhysics.restitution = 0.5; // Set the restitution coefficient to 0.5 (adjust as needed) groundMaterialPhysics.friction = 1; var cubeShape = new CANNON.Box(new CANNON.Vec3(width/2, height/2, depth/2)); - var cubeBody = new CANNON.Body({ mass: 1000, material: groundMaterialPhysics}); + var cubeBody = new CANNON.Body({ mass: 0, material: groundMaterialPhysics}); cubeBody.addShape(cubeShape); cubeBody.position.set(x, y, z); cubeBody.type = CANNON.Body.STATIC; diff --git a/src/BuildingBlocks/Cylinder.mjs b/src/BuildingBlocks/Cylinder.mjs index 9d63a9f..f14ce62 100644 --- a/src/BuildingBlocks/Cylinder.mjs +++ b/src/BuildingBlocks/Cylinder.mjs @@ -22,7 +22,6 @@ class Cylinder { // cylinderShape.transformAllPoints(translation, quat); cylinderBody.addShape(cylinderShape); cylinderBody.position.set(x, y, z); - console.log(cylinderBody.position, cylinder.position); cylinderBody.type = CANNON.Body.STATIC; engine.cannonjs_world.addBody(cylinderBody); } diff --git a/src/BuildingBlocks/GolfHole.mjs b/src/BuildingBlocks/GolfHole.mjs index dfc56a5..3df8ee9 100644 --- a/src/BuildingBlocks/GolfHole.mjs +++ b/src/BuildingBlocks/GolfHole.mjs @@ -1,8 +1,10 @@ import * as THREE from "three"; import * as CANNON from "cannon-es"; import { engine } from "../engine.mjs"; +import { menuConfig } from "../menu.mjs"; class GolfHole { - constructor(x, y, z, radiusTop, RadiusBottom, Height, RadialSegments, HightSegments) { + //dupka + constructor(x, y, z, radiusTop, RadiusBottom, Height, RadialSegments, HightSegments, x2, y2, z2, radiusTop2, RadiusBottom2, Height2, ballBody) { const holeGeometry = new THREE.CylinderGeometry(radiusTop, RadiusBottom, Height, RadialSegments, HightSegments); const holeMaterial = new THREE.MeshBasicMaterial({ color: 0x000000 }); const hole = new THREE.Mesh(holeGeometry, holeMaterial); @@ -18,6 +20,30 @@ class GolfHole { console.log(cylinderBody.position, hole.position); cylinderBody.type = CANNON.Body.STATIC; engine.cannonjs_world.addBody(cylinderBody); + //detection point + var geometry = new THREE.CylinderGeometry(radiusTop2, RadiusBottom2, Height2); + var material = new THREE.MeshBasicMaterial({ color: 0xff0000, transparent: true, opacity: 0.5 }); + var ellipse = new THREE.Mesh(geometry, material); + ellipse.position.set(x2, y2, z2); + engine.scene.add(ellipse); + + const groundMaterialPhysics2 = new CANNON.Material(); + groundMaterialPhysics2.restitution = 1; + var cylinderShape = new CANNON.Cylinder(radiusTop2, RadiusBottom2, Height2, 32); + var cylinderBody = new CANNON.Body({ mass: 0, material: groundMaterialPhysics2 }); + cylinderBody.addShape(cylinderShape); + cylinderBody.position.set(x, y, z); + console.log(cylinderBody.position, ellipse.position); + cylinderBody.type = CANNON.Body.STATIC; + engine.cannonjs_world.addBody(cylinderBody); + + menuConfig.setGameWon(); + ballBody.addEventListener('collide', (event) => { + if (event.body === cylinderBody) { + console.log("Collided with hole"); + menuConfig.isWinner = true; + } + }); } } export { GolfHole }; \ No newline at end of file diff --git a/src/BuildingBlocks/Iceblock.mjs b/src/BuildingBlocks/Iceblock.mjs new file mode 100644 index 0000000..d92df1d --- /dev/null +++ b/src/BuildingBlocks/Iceblock.mjs @@ -0,0 +1,27 @@ +import * as THREE from "three"; +import * as CANNON from "cannon-es"; +import { engine } from "../engine.mjs"; + +class Ice{ + constructor(x, y, z, width, height, depth) { + + // Block visual representation + var geometry = new THREE.BoxGeometry(width, height, depth); + var material = new THREE.MeshPhongMaterial({ color: 0x00ffff }); + var cube = new THREE.Mesh(geometry, material); + cube.position.set(x, y, z); + engine.scene.add(cube); + + // Block physics and collision detection + const groundMaterialPhysics = new CANNON.Material(); // Create a new material + groundMaterialPhysics.restitution = 0.5; // Set the restitution coefficient to 0.5 (adjust as needed) + groundMaterialPhysics.friction = 0.1; + var cubeShape = new CANNON.Box(new CANNON.Vec3(width/2, height/2, depth/2)); + var cubeBody = new CANNON.Body({ mass: 0, material: groundMaterialPhysics}); + cubeBody.addShape(cubeShape); + cubeBody.position.set(x, y, z); + cubeBody.type = CANNON.Body.STATIC; + engine.cannonjs_world.addBody(cubeBody); + } +} +export {Ice} diff --git a/src/BuildingBlocks/MovingPlatform.mjs b/src/BuildingBlocks/MovingPlatform.mjs index e7a0698..c531a4c 100644 --- a/src/BuildingBlocks/MovingPlatform.mjs +++ b/src/BuildingBlocks/MovingPlatform.mjs @@ -1,6 +1,7 @@ import * as THREE from "three"; import * as CANNON from "cannon-es"; import { engine } from "../engine.mjs"; +import { materials } from "../asset_loading/assets_3d.mjs"; /* x1,y1,z1 - where the platform initially is @@ -13,7 +14,7 @@ class MovingPlatform{ constructor(x1, y1, z1, x2, y2, z2, width, height, depth, timeToStay = 1500, timeToTravel = 200) { // Block visual representation var geometry = new THREE.BoxGeometry(width, height, depth); - var material = new THREE.MeshPhongMaterial({ color: 0x00ff00 }); + var material = materials.Planks1; var cube = new THREE.Mesh(geometry, material); cube.position.set(x1, y1, z1); engine.scene.add(cube); @@ -24,7 +25,7 @@ class MovingPlatform{ groundMaterialPhysics.restitution = 0.5; // Set the restitution coefficient to 0.5 (adjust as needed) groundMaterialPhysics.friction = 1; var cubeShape = new CANNON.Box(new CANNON.Vec3(width/2, height/2, depth/2)); - var cubeBody = new CANNON.Body({ mass: 1000, material: groundMaterialPhysics}); + var cubeBody = new CANNON.Body({ mass: 0, material: groundMaterialPhysics}); cubeBody.addShape(cubeShape); cubeBody.position.set(x1, y1, z1); cubeBody.type = CANNON.Body.STATIC; diff --git a/src/BuildingBlocks/Particle.mjs b/src/BuildingBlocks/Particle.mjs index b2da5d0..8d5e03c 100644 --- a/src/BuildingBlocks/Particle.mjs +++ b/src/BuildingBlocks/Particle.mjs @@ -57,6 +57,7 @@ class Particle { this.isDead = true; engine.scene.remove(this.sprite) this.material.dispose() + // console.log("Killed particle") } } @@ -109,7 +110,7 @@ class Emitter { (Math.random() - 0.5) * 2 * this.data.power, (Math.random() - 0.5) * 2 * this.data.power, // Particle color - 2, 0x013220, _lft + 2, 0x90ee90, _lft )) } this.data.fired = true; @@ -129,6 +130,7 @@ class Emitter { particle.killParticle(); } this.isDead = true; + console.log("Killed emitter i:", this.index) emitters.splice(this.index, 1); } } diff --git a/src/BuildingBlocks/Ramp.mjs b/src/BuildingBlocks/Ramp.mjs index b207676..55ea725 100644 --- a/src/BuildingBlocks/Ramp.mjs +++ b/src/BuildingBlocks/Ramp.mjs @@ -1,3 +1,66 @@ +// import * as THREE from "three"; +// import * as CANNON from "cannon-es"; +// import { engine } from "../engine.mjs"; +// import { materials } from "../asset_loading/assets_3d.mjs"; + +// class Ramp { +// constructor(x, y, z, width, dir, angle) { +// // Block visual representation + +// var rampGeometry = new THREE.BoxGeometry(width, 1, width); +// var borderGeometry = new THREE.BoxGeometry(width, 3, 2); + +// var cube = new THREE.Mesh(rampGeometry, materials.Grass); +// var border1 = new THREE.Mesh(borderGeometry, materials.Wood); +// var border2 = new THREE.Mesh(borderGeometry, materials.Wood); + +// border1.position.set(0, 0, 0 - width/2); +// border2.position.set(0, 0, 0 + width/2); +// cube.position.set(0, 0, 0); + +// // Групираме ги щото искаме да ги трансформираме само веднъж +// let rampGroup = new THREE.Group(); +// rampGroup.add(cube, border1, border2); +// rampGroup.rotation.y = dir; +// rampGroup.rotation.z = angle; +// rampGroup.position.set(x, y, z); +// // cube.rotation.y = dir; +// // cube.rotation.z = angle; +// // border1.rotation.y = dir; +// // border1.rotation.z = angle; +// // border2.rotation.y = dir; +// // border2.rotation.z = angle; + +// engine.scene.add(rampGroup); + +// // Block physics and collision detection +// const groundMaterialPhysics = new CANNON.Material(); // Create a new material +// groundMaterialPhysics.restitution = 0.5; // Set the restitution coefficient to 0.5 (adjust as needed) +// var cubeShape = new CANNON.Box(new CANNON.Vec3(width/2, 1/2, width/2)); +// var borderShape = new CANNON.Box(new CANNON.Vec3(width/2, 1.5, 1)); + +// var cubeBody = new CANNON.Body({ mass: 1000, material: groundMaterialPhysics}); +// var border1Body = new CANNON.Body({ mass: 1000, material: groundMaterialPhysics}); + + +// cubeBody.addShape(cubeShape); +// border1Body.addShape(borderShape); + + +// // Копираме позиция/ ротация от three.js групата +// cubeBody.position.copy(rampGroup.position); +// cubeBody.quaternion.copy(rampGroup.quaternion); + +// border1Body.position.copy(rampGroup.position); +// border1Body.quaternion.copy(rampGroup.quaternion); + +// cubeBody.type = CANNON.Body.STATIC; +// engine.cannonjs_world.addBody(cubeBody); +// } +// } + +// export {Ramp}; + import * as THREE from "three"; import * as CANNON from "cannon-es"; import { engine } from "../engine.mjs"; @@ -5,8 +68,7 @@ import { materials } from "../asset_loading/assets_3d.mjs"; class Ramp { constructor(x, y, z, width, dir, angle) { - // Block visual representation - + // Create the Three.js objects var rampGeometry = new THREE.BoxGeometry(width, 1, width); var borderGeometry = new THREE.BoxGeometry(width, 3, 2); @@ -14,49 +76,66 @@ class Ramp { var border1 = new THREE.Mesh(borderGeometry, materials.Wood); var border2 = new THREE.Mesh(borderGeometry, materials.Wood); - border1.position.set(0, 0, 0 - width/2); - border2.position.set(0, 0, 0 + width/2); + border1.position.set(0, 1, -width / 2); // Adjusted height for visual alignment + border2.position.set(0, 1, width / 2); cube.position.set(0, 0, 0); - // Групираме ги щото искаме да ги трансформираме само веднъж + // Group the objects for transformation let rampGroup = new THREE.Group(); rampGroup.add(cube, border1, border2); rampGroup.rotation.y = dir; rampGroup.rotation.z = angle; rampGroup.position.set(x, y, z); - // cube.rotation.y = dir; - // cube.rotation.z = angle; - // border1.rotation.y = dir; - // border1.rotation.z = angle; - // border2.rotation.y = dir; - // border2.rotation.z = angle; engine.scene.add(rampGroup); - // Block physics and collision detection - const groundMaterialPhysics = new CANNON.Material(); // Create a new material - groundMaterialPhysics.restitution = 0.5; // Set the restitution coefficient to 0.5 (adjust as needed) - var cubeShape = new CANNON.Box(new CANNON.Vec3(width/2, 1/2, width/2)); - var borderShape = new CANNON.Box(new CANNON.Vec3(width/2, 1.5, 1)); + // Create Cannon.js materials and shapes + const groundMaterialPhysics = new CANNON.Material(); + groundMaterialPhysics.restitution = 0.5; - var cubeBody = new CANNON.Body({ mass: 1000, material: groundMaterialPhysics}); - var border1Body = new CANNON.Body({ mass: 1000, material: groundMaterialPhysics}); + var cubeShape = new CANNON.Box(new CANNON.Vec3(width / 2, 0.5, width / 2)); + var borderShape = new CANNON.Box(new CANNON.Vec3(width / 2, 1.5, 1)); + var cubeBody = new CANNON.Body({ mass: 0, material: groundMaterialPhysics }); + var border1Body = new CANNON.Body({ mass: 0, material: groundMaterialPhysics }); + var border2Body = new CANNON.Body({ mass: 0, material: groundMaterialPhysics }); cubeBody.addShape(cubeShape); border1Body.addShape(borderShape); + border2Body.addShape(borderShape); - - // Копираме позиция/ ротация от three.js групата + // Set positions and rotations cubeBody.position.copy(rampGroup.position); cubeBody.quaternion.copy(rampGroup.quaternion); - - border1Body.position.copy(rampGroup.position); + + border1Body.position.set(x, y + 1, z - width / 2); border1Body.quaternion.copy(rampGroup.quaternion); + border2Body.position.set(x, y + 1, z + width / 2); + border2Body.quaternion.copy(rampGroup.quaternion); + + // Set static body type cubeBody.type = CANNON.Body.STATIC; + border1Body.type = CANNON.Body.STATIC; + border2Body.type = CANNON.Body.STATIC; + + // Add bodies to the world engine.cannonjs_world.addBody(cubeBody); + engine.cannonjs_world.addBody(border1Body); + engine.cannonjs_world.addBody(border2Body); + + // Store for synchronization in the animation loop + this.bodies = [cubeBody, border1Body, border2Body]; + this.meshGroup = rampGroup; + } + + // Function to update the Cannon.js bodies + updateBodies() { + this.bodies.forEach(body => { + body.position.copy(this.meshGroup.position); + body.quaternion.copy(this.meshGroup.quaternion); + }); } } -export {Ramp}; \ No newline at end of file +export { Ramp }; diff --git a/src/LevelEditor/ObjectAdd.mjs b/src/LevelEditor/ObjectAdd.mjs new file mode 100644 index 0000000..c002a17 --- /dev/null +++ b/src/LevelEditor/ObjectAdd.mjs @@ -0,0 +1,143 @@ +import { BuildingBlock } from '../BuildingBlocks/BuildingBlock.mjs'; +import { Cylinder } from '../BuildingBlocks/Cylinder.mjs'; +import { GolfHole } from '../BuildingBlocks/GolfHole.mjs'; +// import { Iceblock } from '../BuildingBlocks/Iceblock.mjs'; +import { MovingPlatform } from '../BuildingBlocks/MovingPlatform.mjs'; +import { createBall } from '../ball.mjs'; +import { Ramp } from '../BuildingBlocks/Ramp.mjs'; +let objDimentions = []; + +async function AddObj(obj) { + const { x, y, z, w, h, d, t } = obj; + + if (t == 'Cube') + new BuildingBlock(x, y, z, w, h, d); + else if (t == 'Cylinder') + new Cylinder(x, y, z, w, h, d); + else if (t == 'Ramp') + new Ramp(x, y, z, w, h, d); + else if (t == 'Moving platform') + new MovingPlatform(x, y, z, w, h, d, 1500, 200); + else if (t == 'Hole') + new GolfHole(x, y, z, w, h, d); + else if (t == 'Ball') + createBall(x, y, z); +} + +function UIAddObj() { + const popup = document.createElement('div'); + const addBtn = document.createElement('button'); + const xInput = document.createElement('input'); + const yInput = document.createElement('input'); + const zInput = document.createElement('input'); + const wInput = document.createElement('input'); + const hInput = document.createElement('input'); + const dInput = document.createElement('input'); + const select = document.createElement('select'); + const opt1 = document.createElement('option'); + const opt2 = document.createElement('option'); + const opt3 = document.createElement('option'); + const opt4 = document.createElement('option'); + const opt5 = document.createElement('option'); + const opt6 = document.createElement('option'); + const opt7 = document.createElement('option'); + + popup.textContent = 'Choose the object you want to add:'; + popup.style.position = 'absolute'; + popup.style.right = '0px'; + popup.style.top = '300px'; + popup.style.display = 'flex'; + popup.style.flexDirection = 'column'; + document.body.appendChild(popup); + + popup.appendChild(select); + select.style.padding = '10px'; + select.style.borderRadius = '10px'; + select.id = 'objectSelect' + opt1.textContent = 'Nothing'; + opt2.textContent = 'Cube'; + opt3.textContent = 'Cylinder'; + opt4.textContent = 'Ramp'; + opt5.textContent = 'Hole'; + opt6.textContent = 'Moving platform'; + opt7.textContent = 'Ball'; + select.appendChild(opt1); + select.appendChild(opt2); + select.appendChild(opt3); + select.appendChild(opt4); + select.appendChild(opt5); + select.appendChild(opt6); + select.appendChild(opt7); + + popup.appendChild(xInput); + popup.appendChild(yInput); + popup.appendChild(zInput); + popup.appendChild(wInput); + popup.appendChild(hInput); + popup.appendChild(dInput); + + xInput.placeholder = 'X:'; + yInput.placeholder = 'Y:'; + zInput.placeholder = 'Z:'; + wInput.placeholder = 'Width:'; + hInput.placeholder = 'Height:'; + dInput.placeholder = 'Depth:'; + + xInput.style.padding = '10px'; + yInput.style.padding = '10px'; + zInput.style.padding = '10px'; + wInput.style.padding = '10px'; + hInput.style.padding = '10px'; + dInput.style.padding = '10px'; + + xInput.style.borderRadius = '10px'; + yInput.style.borderRadius = '10px'; + zInput.style.borderRadius = '10px'; + wInput.style.borderRadius = '10px'; + hInput.style.borderRadius = '10px'; + dInput.style.borderRadius = '10px'; + + popup.appendChild(addBtn); + addBtn.textContent = 'Add Object'; + addBtn.style.borderRadius = '10px'; + addBtn.style.border = '0px'; + addBtn.style.borderBottom = '2px solid black'; + addBtn.style.cursor = 'pointer'; + addBtn.style.padding = '10px'; + addBtn.style.backgroundColor = "rgb(78, 188, 124)"; + + addBtn.onclick = async () => { + const newObj = { + x: parseFloat(xInput.value), + y: parseFloat(yInput.value), + z: parseFloat(zInput.value), + w: parseFloat(wInput.value), + h: parseFloat(hInput.value), + d: parseFloat(dInput.value), + t: select.value, + }; + + objDimentions.push(newObj); + AddObj(newObj); + + // CORS error + // const { data, error } = await supabase + // .from('obj_dimensions') + // .insert([newObj]) + // .select(); + + // if (error) { + // console.error('Error inserting data: ', error); + // } else { + // console.log('Data inserted successfully: ', data); + // if (data && data.length > 0) { + // const insertedId = data[0].id; + // AddObj(insertedId); + // } + // } + }; + + // UIOM() +} + +export { UIAddObj, objDimentions }; \ No newline at end of file diff --git a/src/Sounds.mjs b/src/Sounds.mjs index abb8d14..64280fe 100644 --- a/src/Sounds.mjs +++ b/src/Sounds.mjs @@ -31,6 +31,7 @@ function initSoundEvents() { let isMusicPlayingClick = false; // Flag to track playback document.body.addEventListener('click', (event) => { + console.log("Clicked at X:", event.clientX, "Y:", event.clientY); if (!isMusicPlayingClick) { // Only play if not already playing playBackgroundMusic(); diff --git a/src/Terrain/Hills.mjs b/src/Terrain/Hills.mjs index 871042a..7dd498d 100644 --- a/src/Terrain/Hills.mjs +++ b/src/Terrain/Hills.mjs @@ -3,6 +3,7 @@ import { engine } from "../engine.mjs"; import * as CANNON from "cannon-es"; import { materials } from "../asset_loading/assets_3d.mjs"; import * as perlin from 'perlin.js'; +import { createPineTree } from "../BuildingBlock_no_collision/pine.mjs"; function createHillsBufferGeometry(sizeX, sizeY, N, noiseScale, scaleZ) { @@ -30,7 +31,6 @@ function createHillsBufferGeometry(sizeX, sizeY, N, noiseScale, scaleZ) { curRow .map((height, j)=>[i, height, j]) .reduce((vertices, curVertex)=>{ - // console.log(vertices, curVertex); return vertices.concat(curVertex)}, [])); }, []); @@ -43,7 +43,6 @@ function createHillsBufferGeometry(sizeX, sizeY, N, noiseScale, scaleZ) { [x + (y+1)*N+ 1, x + (y+1)*N, x+y*N+ 1] )).reduce((list, curTriangle)=>Array.prototype.concat(list, curTriangle), []) .reduce((list, curTriangle)=>Array.prototype.concat(list, curTriangle), []); - // console.log(ind2); // const indices = [ // // V0 V1 V2 @@ -69,6 +68,25 @@ function createHillsBufferGeometry(sizeX, sizeY, N, noiseScale, scaleZ) { mesh.position.set(-sizeX*N/2, -20, -sizeY*N/2); mesh.scale.set(sizeX, scaleZ, sizeY); engine.scene.add(mesh); + return mesh; } -export {createHillsBufferGeometry}; \ No newline at end of file +function addTreesToGround(groundMesh, numTrees) { + const positions = groundMesh.geometry.attributes.position.array; + const scaleX = groundMesh.scale.x; + const scaleZ = groundMesh.scale.z; + const scaleY = groundMesh.scale.y; + + const groundWidth = Math.sqrt(positions.length / 3); + const groundHeight = Math.sqrt(positions.length / 3); + + for (let i = 0; i < numTrees; i++) { + const x = Math.random() * (groundWidth * scaleX) - (groundWidth * scaleX) / 2; + const z = Math.random() * (groundHeight * scaleZ) - (groundHeight * scaleZ) / 2; + const vertexIndex = Math.floor(((x + (groundWidth * scaleX) / 2) / scaleX) * groundWidth + ((z + (groundHeight * scaleZ) / 2) / scaleZ)); + const height = positions[vertexIndex * 3 + 1] * scaleY + groundMesh.position.y; + + createPineTree(x, height, z); + } +} +export {createHillsBufferGeometry, addTreesToGround}; \ No newline at end of file diff --git a/src/asset_loading/asset_config.mjs b/src/asset_loading/asset_config.mjs index 1935944..3033fae 100644 --- a/src/asset_loading/asset_config.mjs +++ b/src/asset_loading/asset_config.mjs @@ -1,38 +1,42 @@ -let default2dImages = [ - { imageName: 'circle', backupColor: 'black' }, - { imageName: 'backField', backupColor: 'green' } -]; - - -let materials_data = [ - { name: "BrickConcrete", path: './images/LiminalTextureLib/BrickConcrete1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Brick", path: './images/LiminalTextureLib/Brick.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Concrete1", path: './images/LiminalTextureLib/Concrete1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Concrete2", path: './images/LiminalTextureLib/Concrete3.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Grass", path: './images/LiminalTextureLib/Grass1.jpg', tilingx: 2, tilingy: 2, tint: 0xffffff }, - { name: "Metal1", path: './images/LiminalTextureLib/Metal1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.7, roughness: 0.5 }, - { name: "Planks1", path: './images/LiminalTextureLib/Planks1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Sand", path: './images/LiminalTextureLib/Sand.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "TreeBark", path: './images/LiminalTextureLib/TreeBark.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Asphalt", path: './images/LiminalTextureLib/Asphalt.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, - { name: "Wood", path: './images/LiminalTextureLib/Wood2.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0, roughness: 0.5 }, - { name: "Metal2", path: './images/LiminalTextureLib/Metal2.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.7, roughness: 0.5 }, - { name: "Ice", path: './images/LiminalTextureLib/Ice.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.3, roughness: 0.2 }, - { name: "GolfBall", path: './images/LiminalTextureLib/GolfBall.jpg', tilingx: 3, tilingy: 3, tint: 0xffffff, metalness: 0, roughness: 0.8 } -]; - - -const randomSounds = [ - "./music/golf ball hit 1.wav", - "./music/golf ball hit 2.wav", - "./music/golf ball hit 3.wav", - "./music/golf ball hit 4.wav", -]; - -const SoundsFalling = [ - "./music/golf ball fall.mp3", -]; - -const bgMusicFileName = './music/song.mp3'; - +import { roughness } from "three/examples/jsm/nodes/Nodes.js"; + +let default2dImages = [ + { imageName: 'circle', backupColor: 'black' }, + { imageName: 'backField', backupColor: 'green' } +]; + + +let materials_data = [ + { name: "BrickConcrete", path: './images/LiminalTextureLib/BrickConcrete1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Brick", path: './images/LiminalTextureLib/Brick.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Concrete1", path: './images/LiminalTextureLib/Concrete1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Concrete2", path: './images/LiminalTextureLib/Concrete3.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Grass", path: './images/LiminalTextureLib/Grass1.jpg', tilingx: 2, tilingy: 2, tint: 0xffffff }, + { name: "Metal1", path: './images/LiminalTextureLib/Metal1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.7, roughness: 0.5 }, + { name: "Planks1", path: './images/LiminalTextureLib/Planks1.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Sand", path: './images/LiminalTextureLib/Sand.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "TreeBark", path: './images/LiminalTextureLib/TreeBark.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Asphalt", path: './images/LiminalTextureLib/Asphalt.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff }, + { name: "Wood", path: './images/LiminalTextureLib/Wood2.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0, roughness: 0.5 }, + { name: "Metal2", path: './images/LiminalTextureLib/Metal2.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.7, roughness: 0.5 }, + { name: "Ice", path: './images/LiminalTextureLib/Ice.jpg', tilingx: 1, tilingy: 1, tint: 0xffffff, metalness: 0.3, roughness: 0.2 }, + { name: "GolfBall", path: './images/LiminalTextureLib/GolfBall.jpg', tilingx: 3, tilingy: 3, tint: 0xffffff, metalness: 0, roughness: 0.8 }, + { name:"Flag", path:'./images/LiminalTextureLib/Flag_of_Bulgaria.png', tilingx: 1, tilingy: 1, tint: 0xffffff}, + { name:"Pine", path:'./images/LiminalTextureLib/Pine.jpg', tilingx: 3, tilingy: 3, tint: 0x006400, roughness: 1.} +]; + + +const randomSounds = [ + "./music/golf ball hit 1.wav", + "./music/golf ball hit 2.wav", + "./music/golf ball hit 3.wav", + "./music/golf ball hit 4.wav", +]; + +const SoundsFalling = [ + "./music/golf ball fall.mp3", +]; + +const bgMusicFileName = './music/song.mp3'; + export { default2dImages as images, materials_data, randomSounds, bgMusicFileName,SoundsFalling }; \ No newline at end of file diff --git a/src/asset_loading/asset_loader2d.mjs b/src/asset_loading/asset_loader2d.mjs index 74ce5f7..0ecf0c6 100644 --- a/src/asset_loading/asset_loader2d.mjs +++ b/src/asset_loading/asset_loader2d.mjs @@ -1,86 +1,86 @@ -import { images } from "./asset_config.mjs"; - -// Custom image class - sets imgObj.img.src after imgObj.draw() has been called -class MyImage { - constructor(src_, backupColor_) { - this.src = src_; - this.backupColor = backupColor_; - - // Create image object with no source path - this.img = new Image(); - this.canDraw = false; - this.drawBackup = false; - - this.img.onload = () => { - this.canDraw = true; - } - this.img.onerror = () => { - this.canDraw = false; - this.drawBackup = true; - throw "Unable to load image " + this.src; - } - - } - draw(x, y, xs, ys) { - if (xs == undefined) { - xs = this.img.width | 100; - ys = this.img.height | 100; - } - // If img.src is undefined - set it - if (!this.img.src) { - // Load image - this.img.src = this.src; - } else if (this.canDraw) { - try { - engine.context2d.drawImage(this.img, x, y, xs, ys); - } catch (e) { - this.canDraw = false; - this.drawBackup = true; - throw e; - } - } else if (this.drawBackup) { - engine.context2d.fillStyle = this.backupColor; - engine.context2d.fillRect(x, y, xs, ys); - } - } - preload() { - this.img.src = this.src; - } -} - -// Attach image objects to global scope -function initGlobalImages() { - // Load all images from ./images folder "BY HAND" - const imageObjectList = images; - - // For each element of array - create a global variable - for (let i = 0; i < imageObjectList.length; i++) { - let name = imageObjectList[i].imageName, - backupColor = imageObjectList[i].backupColor; - - // Handle image names like "asdfg[21]" - if (name.indexOf("[") > -1) { - let arrayName = name.slice(0, name.indexOf("[")); - let arrayNumber = name.slice(name.indexOf("[") + 1, name.indexOf("]")); - if (!window[arrayName]) { - window[arrayName] = []; - } - window[arrayName][arrayNumber] = tryToLoad(name, backupColor); - } else { - // Handle image names like "backMountains.png" - window[name] = tryToLoad(name, backupColor); - } - } -}; - - - -function tryToLoad(imageNameWithoutDotPng, backupColor) { - return new MyImage("./images/" + imageNameWithoutDotPng + ".png", backupColor); -} - -function tryToLoadWithFullPath(pathAndImageName, backupColor) { - return new MyImage(pathAndImageName, backupColor); -} - +import { images } from "./asset_config.mjs"; + +// Custom image class - sets imgObj.img.src after imgObj.draw() has been called +class MyImage { + constructor(src_, backupColor_) { + this.src = src_; + this.backupColor = backupColor_; + + // Create image object with no source path + this.img = new Image(); + this.canDraw = false; + this.drawBackup = false; + + this.img.onload = () => { + this.canDraw = true; + } + this.img.onerror = () => { + this.canDraw = false; + this.drawBackup = true; + throw "Unable to load image " + this.src; + } + + } + draw(x, y, xs, ys) { + if (xs == undefined) { + xs = this.img.width | 100; + ys = this.img.height | 100; + } + // If img.src is undefined - set it + if (!this.img.src) { + // Load image + this.img.src = this.src; + } else if (this.canDraw) { + try { + engine.context2d.drawImage(this.img, x, y, xs, ys); + } catch (e) { + this.canDraw = false; + this.drawBackup = true; + throw e; + } + } else if (this.drawBackup) { + engine.context2d.fillStyle = this.backupColor; + engine.context2d.fillRect(x, y, xs, ys); + } + } + preload() { + this.img.src = this.src; + } +} + +// Attach image objects to global scope +function initGlobalImages() { + // Load all images from ./images folder "BY HAND" + const imageObjectList = images; + + // For each element of array - create a global variable + for (let i = 0; i < imageObjectList.length; i++) { + let name = imageObjectList[i].imageName, + backupColor = imageObjectList[i].backupColor; + + // Handle image names like "asdfg[21]" + if (name.indexOf("[") > -1) { + let arrayName = name.slice(0, name.indexOf("[")); + let arrayNumber = name.slice(name.indexOf("[") + 1, name.indexOf("]")); + if (!window[arrayName]) { + window[arrayName] = []; + } + window[arrayName][arrayNumber] = tryToLoad(name, backupColor); + } else { + // Handle image names like "backMountains.png" + window[name] = tryToLoad(name, backupColor); + } + } +}; + + + +function tryToLoad(imageNameWithoutDotPng, backupColor) { + return new MyImage("./images/" + imageNameWithoutDotPng + ".png", backupColor); +} + +function tryToLoadWithFullPath(pathAndImageName, backupColor) { + return new MyImage(pathAndImageName, backupColor); +} + export {MyImage, initGlobalImages, tryToLoad, tryToLoadWithFullPath} \ No newline at end of file diff --git a/src/asset_loading/asset_loader_sounds.mjs b/src/asset_loading/asset_loader_sounds.mjs index 6373ab3..0aa18d8 100644 --- a/src/asset_loading/asset_loader_sounds.mjs +++ b/src/asset_loading/asset_loader_sounds.mjs @@ -1,22 +1,22 @@ -import {randomSounds, bgMusicFileName,SoundsFalling} from "./asset_config.mjs"; - -let preloadedSounds = { - randomSoundsArr: [], - bgMusicSound: null, - bounceAudio: null -}; -function initSounds() { - for(let soundPath of randomSounds) { - const audio = new Audio(soundPath); - preloadedSounds.randomSoundsArr.push(audio); - } - preloadedSounds.bgMusicSound = new Audio(bgMusicFileName); - preloadedSounds.bounceAudio = new Audio(SoundsFalling); -} -function initSoundsFalling() { - for(let soundPath of SoundsFalling) { - const audio = new Audio(soundPath); - preloadedSounds.randomSoundsArr.push(audio); - } -} +import {randomSounds, bgMusicFileName,SoundsFalling} from "./asset_config.mjs"; + +let preloadedSounds = { + randomSoundsArr: [], + bgMusicSound: null, + bounceAudio: null +}; +function initSounds() { + for(let soundPath of randomSounds) { + const audio = new Audio(soundPath); + preloadedSounds.randomSoundsArr.push(audio); + } + preloadedSounds.bgMusicSound = new Audio(bgMusicFileName); + preloadedSounds.bounceAudio = new Audio(SoundsFalling); +} +function initSoundsFalling() { + for(let soundPath of SoundsFalling) { + const audio = new Audio(soundPath); + preloadedSounds.randomSoundsArr.push(audio); + } +} export {preloadedSounds,initSoundsFalling, initSounds}; \ No newline at end of file diff --git a/src/asset_loading/assets_3d.mjs b/src/asset_loading/assets_3d.mjs index d1e4518..6f72983 100644 --- a/src/asset_loading/assets_3d.mjs +++ b/src/asset_loading/assets_3d.mjs @@ -1,45 +1,45 @@ -import * as THREE from "three"; -import { engine } from "../engine.mjs"; -import { materials_data } from "./asset_config.mjs"; - -let skybox_texture = null; -class Skybox { - constructor() { - this.x = 0 - this.y = 0 - this.z = 0 - - //Load texture - skybox_texture = new THREE.TextureLoader().load('./images/SkyboxTexture.jpg') - - //Threejs setup - this.geometry = new THREE.SphereGeometry(500, 32, 16) - this.material = new THREE.MeshBasicMaterial({map: skybox_texture, side: THREE.BackSide, fog: false, }) - this.mesh = new THREE.Mesh( this.geometry, this.material); - - - //Add to scene - this.mesh.position.set(this.x, this.y, this.z) - engine.scene.add(this.mesh) - } -} - -function RegisterNewMaterial(name, path, tilingx, tilingy, tint, metalness, roughness) { - let _tex = new THREE.TextureLoader().load(path) - _tex.wrapS = THREE.RepeatWrapping - _tex.wrapT = THREE.RepeatWrapping - _tex.repeat.set(tilingx, tilingy) - if(metalness == undefined) metalness = 0; - if(roughness == undefined) roughness = 0.8; - materials[name] = new THREE.MeshStandardMaterial({color: tint, map: _tex, metalness: metalness, roughness: roughness}) -} - -function loadLiminalTextureLib() { - for(let material of materials_data) { - RegisterNewMaterial(material.name, material.path, material.tilingx, material.tilingy, material.tint, material.metalness, material.roughness); - - } -} -//simply use materials.xmaterial or materials["xmaterial"] and it will return a material for a three mesh -let materials = {} +import * as THREE from "three"; +import { engine } from "../engine.mjs"; +import { materials_data } from "./asset_config.mjs"; + +let skybox_texture = null; +class Skybox { + constructor() { + this.x = 0 + this.y = 0 + this.z = 0 + + //Load texture + skybox_texture = new THREE.TextureLoader().load('./images/SkyboxTexture.jpg') + + //Threejs setup + this.geometry = new THREE.SphereGeometry(500, 32, 16) + this.material = new THREE.MeshBasicMaterial({map: skybox_texture, side: THREE.BackSide, fog: false, }) + this.mesh = new THREE.Mesh( this.geometry, this.material); + + + //Add to scene + this.mesh.position.set(this.x, this.y, this.z) + engine.scene.add(this.mesh) + } +} + +function RegisterNewMaterial(name, path, tilingx, tilingy, tint, metalness, roughness) { + let _tex = new THREE.TextureLoader().load(path) + _tex.wrapS = THREE.RepeatWrapping + _tex.wrapT = THREE.RepeatWrapping + _tex.repeat.set(tilingx, tilingy) + if(metalness == undefined) metalness = 0; + if(roughness == undefined) roughness = 0.8; + materials[name] = new THREE.MeshStandardMaterial({color: tint, map: _tex, metalness: metalness, roughness: roughness}) +} + +function loadLiminalTextureLib() { + for(let material of materials_data) { + RegisterNewMaterial(material.name, material.path, material.tilingx, material.tilingy, material.tint, material.metalness, material.roughness); + + } +} +//simply use materials.xmaterial or materials["xmaterial"] and it will return a material for a three mesh +let materials = {} export {Skybox, materials, loadLiminalTextureLib, skybox_texture} \ No newline at end of file diff --git a/src/ball.mjs b/src/ball.mjs index 73b77e9..acefe7c 100644 --- a/src/ball.mjs +++ b/src/ball.mjs @@ -5,6 +5,7 @@ import { materials } from "./asset_loading/assets_3d.mjs"; let ballMesh, ballBody; function createBall(x, y, z) { + // Ball const ballMaterialPhysics = new CANNON.Material(); // Create a new material ballMaterialPhysics.friction = 1; ballMaterialPhysics.restitution = 1.3; @@ -31,4 +32,11 @@ function createBall(x, y, z) { ballMesh.position.set(x, y, z); engine.scene.add(ballMesh); } - export { createBall, ballMesh, ballBody }; +function deleteBall() { + // Remove mesh from scene + engine.scene.remove(ballMesh); + // Remove body from world + engine.cannonjs_world.removeBody(ballBody); + } + + export { createBall, deleteBall, ballMesh, ballBody }; diff --git a/src/firingTheBall.mjs b/src/firingTheBall.mjs index 63952c1..64b63ea 100644 --- a/src/firingTheBall.mjs +++ b/src/firingTheBall.mjs @@ -57,6 +57,7 @@ function initShootingUI() { }); } + function shoot() { const currentTime = Date.now(); @@ -89,4 +90,5 @@ function shoot() { ballBody.applyImpulse(impulse, relativePoint); } + export { firingTheBall }; diff --git a/src/game.mjs b/src/game.mjs index b71218b..2420c5b 100644 --- a/src/game.mjs +++ b/src/game.mjs @@ -1,236 +1,254 @@ - import { engine } from "./engine.mjs"; - import * as THREE from "three"; - import * as CANNON from "cannon-es"; - import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - import Stats from 'three/examples/jsm/libs/stats.module.js'; - import { areColliding, randomInteger, drawLine, drawImage, isFunction, createButton } from './utils.mjs'; - import { firingTheBall } from "./firingTheBall.mjs"; - import { Menu, initMenu, menuConfig } from "./menu.mjs"; - import { initSoundEvents, playRandomSoundEffectFall } from "./Sounds.mjs"; - // Visuals for the game - import { Ramp } from "./BuildingBlocks/Ramp.mjs"; - import { BuildingBlock } from "./BuildingBlocks/BuildingBlock.mjs"; - import { MovingPlatform } from "./BuildingBlocks/MovingPlatform.mjs"; - import { Cylinder } from "./BuildingBlocks/Cylinder.mjs"; - import { GolfHole } from "./BuildingBlocks/GolfHole.mjs"; - import { GolfHole_Detection } from "./BuildingBlocks/GolfHole_DetectionPoint.mjs"; - import { Skybox, skybox_texture } from "./asset_loading/assets_3d.mjs"; - import { createPineTree } from "./BuildingBlock_no_collision/pine.mjs"; - import { createBall, ballMesh, ballBody } from "./ball.mjs"; - import { createNewEmitter, updateEmitters } from "./BuildingBlocks/Particle.mjs"; - import { createHillsBufferGeometry } from './Terrain/Hills.mjs'; - const orbitControls = true; - let controls = null; - - function createGround() { - // Create ground plane - const groundShape = new CANNON.Plane(); - const groundBody = new CANNON.Body({ mass: 2, shape: groundShape }); - groundBody.quaternion.setFromAxisAngle(new CANNON.Vec3(1, 0, 0), -Math.PI / 2); // Set rotation to align with Cannon.js - groundBody.position.set(0, 0, 0); // Set position - engine.cannonjs_world.addBody(groundBody); - - // Create visual representation of ground (in Three.js) - const groundGeometry = new THREE.PlaneGeometry(100, 100); - const groundMaterial = new THREE.MeshPhongMaterial({ color: 0x00ff00, side: THREE.DoubleSide }); - const groundMesh = new THREE.Mesh(groundGeometry, groundMaterial); - groundMesh.rotation.x = -Math.PI / 2; // Rotate to align with Cannon.js - engine.scene.add(groundMesh); +import { engine } from "./engine.mjs"; +import * as THREE from "three"; +import * as CANNON from "cannon-es"; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { areColliding, randomInteger, drawLine, drawImage, isFunction, createButton } from './utils.mjs'; +import { firingTheBall } from "./firingTheBall.mjs"; +import { Menu, initMenu, menuConfig } from "./menu.mjs"; +import { initSoundEvents, playRandomSoundEffectFall } from "./Sounds.mjs"; + // Visuals for the game +import { Ramp } from "./BuildingBlocks/Ramp.mjs"; +import { BuildingBlock } from "./BuildingBlocks/BuildingBlock.mjs"; +import { MovingPlatform } from "./BuildingBlocks/MovingPlatform.mjs"; +import { Cylinder } from "./BuildingBlocks/Cylinder.mjs"; +import { GolfHole } from "./BuildingBlocks/GolfHole.mjs"; +import { GolfHole_Detection } from "./BuildingBlocks/GolfHole_DetectionPoint.mjs"; +import { Skybox, skybox_texture } from "./asset_loading/assets_3d.mjs"; +import { createBall, ballMesh, ballBody, deleteBall} from "./ball.mjs"; +import { createNewEmitter, updateEmitters } from "./BuildingBlocks/Particle.mjs"; +import { addTreesToGround, createHillsBufferGeometry } from './Terrain/Hills.mjs'; +import { Ice } from "./BuildingBlocks/Iceblock.mjs"; +import {flag} from "./BuildingBlock_no_collision/flag.mjs" + +const orbitControls = true; +let controls = null; + + +function createGround() { + // Create ground plane + const groundShape = new CANNON.Plane(); + const groundBody = new CANNON.Body({ mass: 2, shape: groundShape }); + groundBody.quaternion.setFromAxisAngle(new CANNON.Vec3(1, 0, 0), -Math.PI / 2); // Set rotation to align with Cannon.js + groundBody.position.set(0, 0, 0); // Set position + engine.cannonjs_world.addBody(groundBody); + + // Create visual representation of ground (in Three.js) + const groundGeometry = new THREE.PlaneGeometry(100, 100); + const groundMaterial = new THREE.MeshPhongMaterial({ color: 0x00ff00, side: THREE.DoubleSide }); + const groundMesh = new THREE.Mesh(groundGeometry, groundMaterial); + groundMesh.rotation.x = -Math.PI / 2; // Rotate to align with Cannon.js + engine.scene.add(groundMesh); +} + +function initCamera() { + createButton("Play",275,175,250,100,"red",50,"white"); + + // Init camera + engine.camera.position.set(0, 20, 80); + engine.camera.lookAt(0, 10, 0); + + // Change far frustum plane to account for skybox + engine.camera.far = 10000; + engine.camera.updateProjectionMatrix(); +} + +function initLights() { + //Ambient light is now the skybox + const ambientLight = new THREE.AmbientLight(skybox_texture, 1); + engine.scene.add(ambientLight); + + //directional light is white to not tint the phong material too much + const directionalLight = new THREE.DirectionalLight(0xffffff, 1); + directionalLight.position.set(10, 20, 10); + directionalLight.lookAt(0, 0, 0); + engine.scene.add(directionalLight); +} + +function initLevel() { + // const block1 = new BuildingBlock(0, 5, 0, 20, 10, 20); + // const block2 = new BuildingBlock(20, 0, 0, 50, 10, 20); + + // new BuildingBlock(0, 5, 0, 20, 10, 20); + new Ramp(0, 9.3, 0, 20, 0, 0); + new Ramp(16.5, 2.5, 0, 20, Math.PI, Math.PI / 4); + new Ramp(33, -5.2, 0, 20, 0, 0); + new Ramp(53, -5.2, 0, 20, 0, 0); + + + new MovingPlatform(73, -5.2, 0, 133, 25.2, 0, 20, 1, 15); + + new BuildingBlock(153, 20.2, 0, 20, 10, 20); + // new Cylinder(25, 0, 2, 5, 5); + new Ice(153, 22.8, -60, 20, 5, 100); + + new BuildingBlock(153, 20.2, -120, 20, 10, 20); + new GolfHole(153, 26.2, -120, 1.8, 1, 2.1, 64, 12, 51.2, -5.9, 0, 1, 2, 2, ballBody) + let f1 = flag(-14,9,-20); + f1.rotation.y = 30; +} + +let ballDirectionMesh = []; +function initBallDirectionArrows() { + let colors = [0xffd000, 0xff9900, 0xff0000]; + for (let i = 0; i < 3; i++) { + const ballDirectionGeometry = new THREE.ConeGeometry(.5, 5, 5); + const ballDirectionMaterial = new THREE.MeshPhongMaterial({ color: colors[i], flatShading: true }); + ballDirectionMesh.push(new THREE.Mesh(ballDirectionGeometry, ballDirectionMaterial)); + ballDirectionMesh[i].position.set(5, 30 + 4 * i, 0) + + engine.scene.add(ballDirectionMesh[i]); } +} +let time = 0, obx = 0, oby = 0, obz = 0; +function initGame() { + // initSoundEvents(); + if (menuConfig.showMenu) { + initMenu(initLevel); + } else { + menuConfig.gameStarted = true; + initSoundEvents(); + initLevel(); + firingTheBall.initUI(); - function initCamera() { - createButton("Play",275,175,250,100,"red",50,"white"); - - // Init camera - engine.camera.position.set(0, 20, 80); - engine.camera.lookAt(0, 10, 0); - - // Change far frustum plane to account for skybox - engine.camera.far = 10000; - engine.camera.updateProjectionMatrix(); } + // Create ball and attach to window + createBall(5, 30, 0); + + let groundMesh = createHillsBufferGeometry(10, 10, 100, 5, 20); + // Init slider and buttons for firing the ball + addTreesToGround(groundMesh, 100); + + // Setup camera position + initCamera(); + + // Init orbit controls + if (orbitControls) { + controls = new OrbitControls(engine.camera, engine.canvas2d); + controls.target = ballMesh.position; + controls.maxDistance = 150 + controls.enableDamping = true + controls.dampingFactor = .1 + if (menuConfig.gameStarted == false) { + controls.autoRotate = true + controls.autoRotateSpeed = 0.5 - function initLights() { - // Ambient light is now the skybox - const ambientLight = new THREE.AmbientLight(skybox_texture, 1); - engine.scene.add(ambientLight); - - // Directional light is white to not tint the Phong material too much - const directionalLight = new THREE.DirectionalLight(0xffffff, 1); - directionalLight.position.set(10, 20, 10); - directionalLight.lookAt(0, 0, 0); - engine.scene.add(directionalLight); + } } - function initLevel() { - // createGround(); - const block1 = new BuildingBlock(0, 5, 0, 20, 10, 20); - // const block2 = new BuildingBlock(20, 0, 0, 50, 10, 20); + // Setup camera position + initCamera(); - // new BuildingBlock(0, 5, 0, 20, 10, 20); - new Ramp(16.5, 2.5, 0, 20, Math.PI, Math.PI / 4); - new Ramp(33, -5.2, 0, 20, 0, 0); + initLights(); - new BuildingBlock(30, -10, 0, 40, 10, 20); + initBallDirectionArrows(); - new MovingPlatform(15, 20, 20, 30, 30, 30, 20, 1, 15); - new Cylinder(25, 0, 2, 5, 5); - new GolfHole(51.2, -6, 0, 1.8, 1, 2.1, 64, 12); - new GolfHole_Detection(51.2, -5.9, 0, 1, 2, 2); + // Init skybox + const skybox = new Skybox(); - createPineTree(0, 20, 0); - } + //DEBUG spawn test emitter - let ballDirectionMesh = []; - function initBallDirectionArrows() { - let colors = [0xffd000, 0xff9900, 0xff0000]; - for (let i = 0; i < 3; i++) { - const ballDirectionGeometry = new THREE.ConeGeometry(0.5, 5, 5); - const ballDirectionMaterial = new THREE.MeshPhongMaterial({ color: colors[i], flatShading: true }); - ballDirectionMesh.push(new THREE.Mesh(ballDirectionGeometry, ballDirectionMaterial)); - ballDirectionMesh[i].position.set(5, 30 + 4 * i, 0); + let lastDX, lastDY, lastDZ; - engine.scene.add(ballDirectionMesh[i]); - } - } + // Set custom update function + engine.update = () => { - let time = 0; - function initGame() { - // initSoundEvents(); - if (menuConfig.showMenu) { - initMenu(initLevel); - } else { - menuConfig.gameStarted = true; - initSoundEvents(); - initLevel(); - } - // Create ball and attach to window - createBall(11, 30, 0); + time++; + controls.update(); - createHillsBufferGeometry(10, 10, 100, 5, 20); - // Init slider and buttons for firing the ball - firingTheBall.initUI(); + //update all particle systems + updateEmitters() - // Setup camera position - initCamera(); + // Update ball mesh position + ballMesh.position.copy(ballBody.position); - // Init orbit controls - if (orbitControls) { - controls = new OrbitControls(engine.camera, engine.canvas2d); - controls.target = ballMesh.position; - controls.maxDistance = 150 - controls.enableDamping = true - controls.dampingFactor = .1 - if (menuConfig.gameStarted == false) { - controls.autoRotate = true - controls.autoRotateSpeed = 0.5 + const bounceThreshold = 3; - } + function checkBounce(lastVelocities, currentVelocities) { + return Object.keys(currentVelocities).some(axis => + Math.abs(lastVelocities[axis] - currentVelocities[axis]) > bounceThreshold + ); } - initLights(); - initBallDirectionArrows(); + const currentVelocities = { x: ballBody.velocity.x, y: ballBody.velocity.y, z: ballBody.velocity.z }; - // Init skybox - const skybox = new Skybox(); + if (checkBounce({ x: lastDX, y: lastDY, z: lastDZ }, currentVelocities)) { + createNewEmitter(ballBody.position.x, ballBody.position.y, ballBody.position.z, "burst", {particle_cnt: 20, particle_lifetime: {min:0.2, max:0.5}, power: 0.05, fired: false}) + playRandomSoundEffectFall(); + } + lastDX = currentVelocities.x; + lastDY = currentVelocities.y; + lastDZ = currentVelocities.z; + make_the_ball_static_when_is_not_moving(); - // DEBUG spawn test emitter + adjust_the_ball_direction(); - let lastDX, lastDY, lastDZ; + show_the_ball_direction(); - // Set custom update function - engine.update = () => { - if (controls) controls.update(); - // Update all particle systems - updateEmitters(); + if(ballBody.position.y < -50){ //respawns the ball if it has fallen beneath the map + ballBody.position.set(firingTheBall.shotFromWhere.x, firingTheBall.shotFromWhere.y, firingTheBall.shotFromWhere.z); + ballBody.type = CANNON.Body.STATIC + firingTheBall.isBallShot = false; + } + }; +} - // Update ball mesh position - ballMesh.position.copy(ballBody.position); - const bounceThreshold = 3; +function make_the_ball_static_when_is_not_moving() { + const velocityThreshold = 0; + const timeInterval = 10; - function checkBounce(lastVelocities, currentVelocities) { - return Object.keys(currentVelocities).some(axis => - Math.abs(lastVelocities[axis] - currentVelocities[axis]) > bounceThreshold - ); - } + if (time % timeInterval === 0 && ballBody.velocity.length() < velocityThreshold) { + const groundRay = new CANNON.Ray( + new CANNON.Vec3(ballBody.position.x, ballBody.position.y - 1.1, ballBody.position.z), + new CANNON.Vec3(ballBody.position.x, ballBody.position.y - 1.2, ballBody.position.z) + ); - const currentVelocities = { x: ballBody.velocity.x, y: ballBody.velocity.y, z: ballBody.velocity.z }; + const intersect = groundRay.intersectWorld(engine.cannonjs_world, {}); - if (checkBounce({ x: lastDX, y: lastDY, z: lastDZ }, currentVelocities)) { - createNewEmitter(ballBody.position.x, ballBody.position.y, ballBody.position.z, "burst", { particle_cnt: 50, particle_lifetime: { min: 0.2, max: 0.5 }, power: 0.05, fired: false }); - playRandomSoundEffectFall(); - } - lastDX = currentVelocities.x; - lastDY = currentVelocities.y; - lastDZ = currentVelocities.z; - make_the_ball_static_when_is_not_moving(); + if (intersect) { + ballBody.type = CANNON.Body.STATIC; + firingTheBall.isBallShot = false; + } - adjust_the_ball_direction(); + } +} - show_the_ball_direction(); +function adjust_the_ball_direction() { + firingTheBall.direction = Math.atan2(ballMesh.position.z - engine.camera.position.z, ballMesh.position.x - engine.camera.position.x); +} - if (ballBody.position.y < -50) { // Respawns the ball if it has fallen beneath the map - ballBody.position.set(firingTheBall.shotFromWhere.x, firingTheBall.shotFromWhere.y, firingTheBall.shotFromWhere.z); - ballBody.type = CANNON.Body.STATIC; - firingTheBall.isBallShot = false; - } - }; - } - function make_the_ball_static_when_is_not_moving() { - const velocityThreshold = 0; - const timeInterval = 10; - - if (time % timeInterval === 0 && ballBody.velocity.length() < velocityThreshold) { - const groundRay = new CANNON.Ray( - new CANNON.Vec3(ballBody.position.x, ballBody.position.y - 1.1, ballBody.position.z), - new CANNON.Vec3(ballBody.position.x, ballBody.position.y - 1.2, ballBody.position.z) - ); - - const intersect = groundRay.intersectWorld(engine.cannonjs_world, {}); - - if (intersect) { - ballBody.type = CANNON.Body.STATIC; - firingTheBall.isBallShot = false; - } +function show_the_ball_direction() { + for (let i = 0; i < 3; i++) { + if(firingTheBall.isBallShot){ + ballDirectionMesh[i].visible = false; + continue; } - } + if (ballDirectionMesh[i] !== undefined) { + // Calculates the needed arrows + if (i <= Math.floor(Math.abs((firingTheBall.power + 20) / 100) * 2)) { + ballDirectionMesh[i].visible = true; + + ballDirectionMesh[i].position.set( + ballMesh.position.x + Math.cos(firingTheBall.direction) * 3.5 * (i + 1), + ballMesh.position.y, + ballMesh.position.z + Math.sin(firingTheBall.direction) * 3.5 * (i + 1) + ); - function adjust_the_ball_direction() { - firingTheBall.direction = Math.atan2(ballMesh.position.z - engine.camera.position.z, ballMesh.position.x - engine.camera.position.x); - } - function show_the_ball_direction() { - for (let i = 0; i < 3; i++) { - if (firingTheBall.isBallShot) { + ballDirectionMesh[i].rotation.x = Math.PI/2; + ballDirectionMesh[i].rotation.y = 0; + ballDirectionMesh[i].rotation.z = firingTheBall.direction - Math.PI/2; + + } else { ballDirectionMesh[i].visible = false; - continue; - } - if (ballDirectionMesh[i] !== undefined) { - // Calculates the needed arrows - if (i <= Math.floor(Math.abs((firingTheBall.power + 20) / 100) * 2)) { - ballDirectionMesh[i].visible = true; - - ballDirectionMesh[i].position.set( - ballMesh.position.x + Math.cos(firingTheBall.direction) * 3.5 * (i + 1), - ballMesh.position.y, - ballMesh.position.z + Math.sin(firingTheBall.direction) * 3.5 * (i + 1) - ); - - ballDirectionMesh[i].rotation.x = Math.PI / 2; - ballDirectionMesh[i].rotation.y = 0; - ballDirectionMesh[i].rotation.z = firingTheBall.direction - Math.PI / 2; - - } else { - ballDirectionMesh[i].visible = false; - } } } } +}; - let game = { - init: initGame - }; +let game = { + init: initGame +} - export { game }; +export { game }; \ No newline at end of file diff --git a/src/init.js b/src/init.js index fe4fb1b..b31440b 100644 --- a/src/init.js +++ b/src/init.js @@ -3,7 +3,7 @@ import { game } from "./game.mjs" import { initGlobalImages } from "./asset_loading/asset_loader2d.mjs"; import { loadLiminalTextureLib } from "./asset_loading/assets_3d.mjs"; import { initSounds } from "./asset_loading/asset_loader_sounds.mjs"; - +import { UIAddObj } from './LevelEditor/ObjectAdd.mjs' document.body.onload = () => { console.log("Front end scripts starting."); @@ -21,4 +21,6 @@ document.body.onload = () => { engine.init(); game.init(); + + UIAddObj(); }; \ No newline at end of file diff --git a/src/menu.mjs b/src/menu.mjs index 1d9dd8b..b0d7d5b 100644 --- a/src/menu.mjs +++ b/src/menu.mjs @@ -2,6 +2,7 @@ import { engine } from "./engine.mjs"; import { createButton } from "./utils.mjs"; import { playMusic } from "./Sounds.mjs"; import { areColliding } from "./utils.mjs"; +import { firingTheBall } from "./firingTheBall.mjs"; function initMenu(onPlayButtonCB) { let menu = new Menu(); @@ -14,7 +15,6 @@ function initMenu(onPlayButtonCB) { engine.onmouseup = ((e) => { let mouseX = e.clientX; let mouseY = e.clientY; - console.log(e, mouseX, mouseY) if (!menuConfig.gameStarted) { if (areColliding(mouseX, mouseY, 1, 1, 275, 200, 250, 100)) { //Play //initGame(); @@ -36,21 +36,26 @@ class Menu { constructor(){ } draw(){ - //play button - createButton("Play",275,175,250,100,"red",50,"white"); - //skins button - no functionality - createButton("Skins",275,300,250,100,"red",50,"white"); - //music toggle button - should be replaced with icon - if(menuConfig.musicEnabled){ - createButton("Toggle music",175,475,200,75,"red",30,"white"); - }else{ - createButton("Toggle music",175,475,200,75,"grey",30,"white"); - } - //SFX toggle button - should be replaced with icon - if(menuConfig.sfxEnabled){ - createButton("Toggle SFX",425,475,200,75,"red",30,"white"); - }else{ - createButton("Toggle SFX",425,475,200,75,"grey",30,"white"); + if (!menuConfig.gameStarted) { + //play button + createButton("Play", 275, 175, 250, 100, "red", 50, "white"); + //skins button - no functionality + createButton("Skins", 275, 300, 250, 100, "red", 50, "white"); + //music toggle button - should be replaced with icon + if (menuConfig.musicEnabled) { + createButton("Toggle music", 175, 475, 200, 75, "red", 30, "white"); + } else { + createButton("Toggle music", 175, 475, 200, 75, "grey", 30, "white"); + } + //SFX toggle button - should be replaced with icon + if (menuConfig.sfxEnabled) { + createButton("Toggle SFX", 425, 475, 200, 75, "red", 30, "white"); + } else { + createButton("Toggle SFX", 425, 475, 200, 75, "grey", 30, "white"); + } + } else if(isWinner) { + // TODO: for some reason - this does nothing + createButton("You Win", 275, 175, 250, 100, "red", 50, "white"); } } startSimulation(){ @@ -58,6 +63,7 @@ class Menu { menuConfig.gameStarted = true; if(menuConfig.musicEnabled){ //there is no pause menu so this should work for now playMusic(); + firingTheBall.initUI(); } } toggleMusic(){ @@ -67,9 +73,10 @@ class Menu { menuConfig.sfxEnabled = !menuConfig.sfxEnabled } } - +let isWinner = false; let menuConfig = { gameStarted: false, + setGameWon: ()=>{isWinner = true;}, musicEnabled: true, sfxEnabled: true, showMenu: true diff --git a/src/utils.mjs b/src/utils.mjs index 761cfe9..a642f99 100644 --- a/src/utils.mjs +++ b/src/utils.mjs @@ -1,18 +1,27 @@ function areColliding(Ax, Ay, Awidth, Aheight, Bx, By, Bwidth, Bheight) { - return Bx <= Ax + Awidth && Ax <= Bx + Bwidth && By <= Ay + Aheight && Ay <= By + Bheight; -} + if (Bx <= Ax + Awidth) { + if (Ax <= Bx + Bwidth) { + if (By <= Ay + Aheight) { + if (Ay <= By + Bheight) { + return 1; + } + } + } + } + return 0; +}; function randomInteger(upTo) { return Math.floor(Math.random() * upTo); } function drawLine(startX, startY, endX, endY) { - engine.context2d.beginPath(); + // For better performance bunch calls to lineTo without beginPath() and stroke() inbetween. + engine.context2d.beginPath(); // resets the current path engine.context2d.moveTo(startX, startY); engine.context2d.lineTo(endX, endY); engine.context2d.stroke(); } - function drawImage(myImageObject, x, y, xs, ys) { myImageObject.draw(x, y, xs, ys); } @@ -20,7 +29,6 @@ function drawImage(myImageObject, x, y, xs, ys) { function isFunction(f) { return typeof (f) == "function"; } - function drawText(text, x, y, fontsize = 16, textCol = "black", font = "Arial") { const ctx = engine.context2d; ctx.fillStyle = textCol; @@ -52,5 +60,4 @@ function createButton(text, x, y, w, h, buttonCol, fontsize, textCol, borderRadi ctx.textBaseline = "middle"; ctx.fillText(text, x + w / 2, y + h / 2); } - export { areColliding, randomInteger, drawLine, drawImage, isFunction, createButton, drawText }; From 92dd30ed88e32bad78c586cff4f7bd9f670f826f Mon Sep 17 00:00:00 2001 From: DPH888 <109276020+DPH888@users.noreply.github.com> Date: Sun, 16 Jun 2024 21:57:44 +0300 Subject: [PATCH 8/8] Fixed bug with UI of the firing of the ball not showing --- package.json | 2 +- public/index_bundle.js | 4 ++-- src/firingTheBall.mjs | 2 +- src/game.mjs | 2 +- src/menu.mjs | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index cd5863c..5455bed 100644 --- a/package.json +++ b/package.json @@ -36,4 +36,4 @@ "three": "^0.163.0", "three-orbit-controls": "^82.1.0" } -} +} \ No newline at end of file diff --git a/public/index_bundle.js b/public/index_bundle.js index 0faa8c3..e8326df 100644 --- a/public/index_bundle.js +++ b/public/index_bundle.js @@ -2325,7 +2325,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ game: () => (/* binding */ game)\n/* harmony export */ });\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var three_addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! three/addons/controls/OrbitControls.js */ \"./node_modules/three/examples/jsm/controls/OrbitControls.js\");\n/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ \"./src/utils.mjs\");\n/* harmony import */ var _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./firingTheBall.mjs */ \"./src/firingTheBall.mjs\");\n/* harmony import */ var _menu_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./menu.mjs */ \"./src/menu.mjs\");\n/* harmony import */ var _Sounds_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Sounds.mjs */ \"./src/Sounds.mjs\");\n/* harmony import */ var _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BuildingBlocks/Ramp.mjs */ \"./src/BuildingBlocks/Ramp.mjs\");\n/* harmony import */ var _BuildingBlocks_BuildingBlock_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BuildingBlocks/BuildingBlock.mjs */ \"./src/BuildingBlocks/BuildingBlock.mjs\");\n/* harmony import */ var _BuildingBlocks_MovingPlatform_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./BuildingBlocks/MovingPlatform.mjs */ \"./src/BuildingBlocks/MovingPlatform.mjs\");\n/* harmony import */ var _BuildingBlocks_Cylinder_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./BuildingBlocks/Cylinder.mjs */ \"./src/BuildingBlocks/Cylinder.mjs\");\n/* harmony import */ var _BuildingBlocks_GolfHole_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./BuildingBlocks/GolfHole.mjs */ \"./src/BuildingBlocks/GolfHole.mjs\");\n/* harmony import */ var _BuildingBlocks_GolfHole_DetectionPoint_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./BuildingBlocks/GolfHole_DetectionPoint.mjs */ \"./src/BuildingBlocks/GolfHole_DetectionPoint.mjs\");\n/* harmony import */ var _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./asset_loading/assets_3d.mjs */ \"./src/asset_loading/assets_3d.mjs\");\n/* harmony import */ var _ball_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ball.mjs */ \"./src/ball.mjs\");\n/* harmony import */ var _BuildingBlocks_Particle_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./BuildingBlocks/Particle.mjs */ \"./src/BuildingBlocks/Particle.mjs\");\n/* harmony import */ var _Terrain_Hills_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Terrain/Hills.mjs */ \"./src/Terrain/Hills.mjs\");\n/* harmony import */ var _BuildingBlocks_Iceblock_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./BuildingBlocks/Iceblock.mjs */ \"./src/BuildingBlocks/Iceblock.mjs\");\n/* harmony import */ var _BuildingBlock_no_collision_flag_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./BuildingBlock_no_collision/flag.mjs */ \"./src/BuildingBlock_no_collision/flag.mjs\");\n\n\n\n\n\n\n\n\n // Visuals for the game\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst orbitControls = true;\nlet controls = null;\n\n\nfunction createGround() {\n // Create ground plane\n const groundShape = new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Plane();\n const groundBody = new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Body({ mass: 2, shape: groundShape });\n groundBody.quaternion.setFromAxisAngle(new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Vec3(1, 0, 0), -Math.PI / 2); // Set rotation to align with Cannon.js\n groundBody.position.set(0, 0, 0); // Set position\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(groundBody);\n\n // Create visual representation of ground (in Three.js)\n const groundGeometry = new three__WEBPACK_IMPORTED_MODULE_18__.PlaneGeometry(100, 100);\n const groundMaterial = new three__WEBPACK_IMPORTED_MODULE_18__.MeshPhongMaterial({ color: 0x00ff00, side: three__WEBPACK_IMPORTED_MODULE_18__.DoubleSide });\n const groundMesh = new three__WEBPACK_IMPORTED_MODULE_18__.Mesh(groundGeometry, groundMaterial);\n groundMesh.rotation.x = -Math.PI / 2; // Rotate to align with Cannon.js\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(groundMesh);\n}\n\nfunction initCamera() {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Play\",275,175,250,100,\"red\",50,\"white\");\n\n // Init camera\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.position.set(0, 20, 80);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.lookAt(0, 10, 0);\n\n // Change far frustum plane to account for skybox\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.far = 10000;\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.updateProjectionMatrix();\n}\n\nfunction initLights() {\n //Ambient light is now the skybox\n const ambientLight = new three__WEBPACK_IMPORTED_MODULE_18__.AmbientLight(_asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_11__.skybox_texture, 1);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(ambientLight);\n\n //directional light is white to not tint the phong material too much\n const directionalLight = new three__WEBPACK_IMPORTED_MODULE_18__.DirectionalLight(0xffffff, 1);\n directionalLight.position.set(10, 20, 10);\n directionalLight.lookAt(0, 0, 0);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(directionalLight);\n}\n\nfunction initLevel() {\n // const block1 = new BuildingBlock(0, 5, 0, 20, 10, 20);\n // const block2 = new BuildingBlock(20, 0, 0, 50, 10, 20);\n\n // new BuildingBlock(0, 5, 0, 20, 10, 20);\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(0, 9.3, 0, 20, 0, 0);\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(16.5, 2.5, 0, 20, Math.PI, Math.PI / 4);\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(33, -5.2, 0, 20, 0, 0);\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(53, -5.2, 0, 20, 0, 0);\n\n\n new _BuildingBlocks_MovingPlatform_mjs__WEBPACK_IMPORTED_MODULE_7__.MovingPlatform(73, -5.2, 0, 133, 25.2, 0, 20, 1, 15);\n\n new _BuildingBlocks_BuildingBlock_mjs__WEBPACK_IMPORTED_MODULE_6__.BuildingBlock(153, 20.2, 0, 20, 10, 20);\n // new Cylinder(25, 0, 2, 5, 5);\n new _BuildingBlocks_Iceblock_mjs__WEBPACK_IMPORTED_MODULE_15__.Ice(153, 22.8, -60, 20, 5, 100);\n\n new _BuildingBlocks_BuildingBlock_mjs__WEBPACK_IMPORTED_MODULE_6__.BuildingBlock(153, 20.2, -120, 20, 10, 20);\n new _BuildingBlocks_GolfHole_mjs__WEBPACK_IMPORTED_MODULE_9__.GolfHole(153, 26.2, -120, 1.8, 1, 2.1, 64, 12, 51.2, -5.9, 0, 1, 2, 2, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody)\n let f1 = (0,_BuildingBlock_no_collision_flag_mjs__WEBPACK_IMPORTED_MODULE_16__.flag)(-14,9,-20);\n f1.rotation.y = 30;\n}\n\nlet ballDirectionMesh = [];\nfunction initBallDirectionArrows() {\n let colors = [0xffd000, 0xff9900, 0xff0000];\n for (let i = 0; i < 3; i++) {\n const ballDirectionGeometry = new three__WEBPACK_IMPORTED_MODULE_18__.ConeGeometry(.5, 5, 5);\n const ballDirectionMaterial = new three__WEBPACK_IMPORTED_MODULE_18__.MeshPhongMaterial({ color: colors[i], flatShading: true });\n ballDirectionMesh.push(new three__WEBPACK_IMPORTED_MODULE_18__.Mesh(ballDirectionGeometry, ballDirectionMaterial));\n ballDirectionMesh[i].position.set(5, 30 + 4 * i, 0)\n\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(ballDirectionMesh[i]);\n }\n}\nlet time = 0, obx = 0, oby = 0, obz = 0;\nfunction initGame() {\n // initSoundEvents();\n if (_menu_mjs__WEBPACK_IMPORTED_MODULE_3__.menuConfig.showMenu) {\n (0,_menu_mjs__WEBPACK_IMPORTED_MODULE_3__.initMenu)(initLevel);\n } else {\n _menu_mjs__WEBPACK_IMPORTED_MODULE_3__.menuConfig.gameStarted = true;\n (0,_Sounds_mjs__WEBPACK_IMPORTED_MODULE_4__.initSoundEvents)();\n initLevel();\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.initUI();\n\n }\n // Create ball and attach to window\n (0,_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.createBall)(5, 30, 0);\n\n let groundMesh = (0,_Terrain_Hills_mjs__WEBPACK_IMPORTED_MODULE_14__.createHillsBufferGeometry)(10, 10, 100, 5, 20);\n // Init slider and buttons for firing the ball\n (0,_Terrain_Hills_mjs__WEBPACK_IMPORTED_MODULE_14__.addTreesToGround)(groundMesh, 100);\n\n // Setup camera position\n initCamera();\n\n // Init orbit controls\n if (orbitControls) {\n controls = new three_addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_19__.OrbitControls(_engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera, _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.canvas2d);\n controls.target = _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position;\n controls.maxDistance = 150\n controls.enableDamping = true\n controls.dampingFactor = .1\n if (_menu_mjs__WEBPACK_IMPORTED_MODULE_3__.menuConfig.gameStarted == false) {\n controls.autoRotate = true\n controls.autoRotateSpeed = 0.5\n\n }\n }\n\n // Setup camera position\n initCamera();\n\n initLights();\n\n initBallDirectionArrows();\n\n // Init skybox\n const skybox = new _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_11__.Skybox();\n\n //DEBUG spawn test emitter\n\n let lastDX, lastDY, lastDZ;\n\n // Set custom update function\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.update = () => {\n\n time++;\n controls.update();\n\n //update all particle systems\n (0,_BuildingBlocks_Particle_mjs__WEBPACK_IMPORTED_MODULE_13__.updateEmitters)()\n\n // Update ball mesh position\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.copy(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position);\n\n const bounceThreshold = 3;\n\n function checkBounce(lastVelocities, currentVelocities) {\n return Object.keys(currentVelocities).some(axis =>\n Math.abs(lastVelocities[axis] - currentVelocities[axis]) > bounceThreshold\n );\n }\n\n const currentVelocities = { x: _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.velocity.x, y: _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.velocity.y, z: _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.velocity.z };\n\n if (checkBounce({ x: lastDX, y: lastDY, z: lastDZ }, currentVelocities)) {\n (0,_BuildingBlocks_Particle_mjs__WEBPACK_IMPORTED_MODULE_13__.createNewEmitter)(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.x, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.y, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.z, \"burst\", {particle_cnt: 20, particle_lifetime: {min:0.2, max:0.5}, power: 0.05, fired: false})\n ;(0,_Sounds_mjs__WEBPACK_IMPORTED_MODULE_4__.playRandomSoundEffectFall)();\n }\n lastDX = currentVelocities.x;\n lastDY = currentVelocities.y;\n lastDZ = currentVelocities.z;\n make_the_ball_static_when_is_not_moving();\n\n adjust_the_ball_direction();\n\n show_the_ball_direction();\n\n if(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.y < -50){ //respawns the ball if it has fallen beneath the map\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.set(_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.shotFromWhere.x, _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.shotFromWhere.y, _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.shotFromWhere.z);\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_17__.Body.STATIC\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.isBallShot = false;\n }\n };\n}\n\n\nfunction make_the_ball_static_when_is_not_moving() {\n const velocityThreshold = 0;\n const timeInterval = 10;\n\n if (time % timeInterval === 0 && _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.velocity.length() < velocityThreshold) {\n const groundRay = new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Ray(\n new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Vec3(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.x, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.y - 1.1, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.z),\n new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Vec3(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.x, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.y - 1.2, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.z)\n );\n\n const intersect = groundRay.intersectWorld(_engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world, {});\n\n if (intersect) {\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_17__.Body.STATIC;\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.isBallShot = false;\n }\n\n }\n}\n\nfunction adjust_the_ball_direction() {\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.direction = Math.atan2(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.z - _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.position.z, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.x - _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.position.x);\n}\n\nfunction show_the_ball_direction() {\n for (let i = 0; i < 3; i++) {\n if(_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.isBallShot){\n ballDirectionMesh[i].visible = false;\n\n continue;\n }\n if (ballDirectionMesh[i] !== undefined) {\n // Calculates the needed arrows\n if (i <= Math.floor(Math.abs((_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.power + 20) / 100) * 2)) {\n ballDirectionMesh[i].visible = true;\n\n ballDirectionMesh[i].position.set(\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.x + Math.cos(_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.direction) * 3.5 * (i + 1),\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.y,\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.z + Math.sin(_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.direction) * 3.5 * (i + 1)\n );\n\n\n ballDirectionMesh[i].rotation.x = Math.PI/2;\n ballDirectionMesh[i].rotation.y = 0;\n ballDirectionMesh[i].rotation.z = _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.direction - Math.PI/2;\n\n } else {\n ballDirectionMesh[i].visible = false;\n }\n }\n }\n};\n\nlet game = {\n init: initGame\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/game.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ game: () => (/* binding */ game)\n/* harmony export */ });\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var cannon_es__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! cannon-es */ \"./node_modules/cannon-es/dist/cannon-es.js\");\n/* harmony import */ var three_addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! three/addons/controls/OrbitControls.js */ \"./node_modules/three/examples/jsm/controls/OrbitControls.js\");\n/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ \"./src/utils.mjs\");\n/* harmony import */ var _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./firingTheBall.mjs */ \"./src/firingTheBall.mjs\");\n/* harmony import */ var _menu_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./menu.mjs */ \"./src/menu.mjs\");\n/* harmony import */ var _Sounds_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Sounds.mjs */ \"./src/Sounds.mjs\");\n/* harmony import */ var _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BuildingBlocks/Ramp.mjs */ \"./src/BuildingBlocks/Ramp.mjs\");\n/* harmony import */ var _BuildingBlocks_BuildingBlock_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BuildingBlocks/BuildingBlock.mjs */ \"./src/BuildingBlocks/BuildingBlock.mjs\");\n/* harmony import */ var _BuildingBlocks_MovingPlatform_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./BuildingBlocks/MovingPlatform.mjs */ \"./src/BuildingBlocks/MovingPlatform.mjs\");\n/* harmony import */ var _BuildingBlocks_Cylinder_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./BuildingBlocks/Cylinder.mjs */ \"./src/BuildingBlocks/Cylinder.mjs\");\n/* harmony import */ var _BuildingBlocks_GolfHole_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./BuildingBlocks/GolfHole.mjs */ \"./src/BuildingBlocks/GolfHole.mjs\");\n/* harmony import */ var _BuildingBlocks_GolfHole_DetectionPoint_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./BuildingBlocks/GolfHole_DetectionPoint.mjs */ \"./src/BuildingBlocks/GolfHole_DetectionPoint.mjs\");\n/* harmony import */ var _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./asset_loading/assets_3d.mjs */ \"./src/asset_loading/assets_3d.mjs\");\n/* harmony import */ var _ball_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ball.mjs */ \"./src/ball.mjs\");\n/* harmony import */ var _BuildingBlocks_Particle_mjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./BuildingBlocks/Particle.mjs */ \"./src/BuildingBlocks/Particle.mjs\");\n/* harmony import */ var _Terrain_Hills_mjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Terrain/Hills.mjs */ \"./src/Terrain/Hills.mjs\");\n/* harmony import */ var _BuildingBlocks_Iceblock_mjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./BuildingBlocks/Iceblock.mjs */ \"./src/BuildingBlocks/Iceblock.mjs\");\n/* harmony import */ var _BuildingBlock_no_collision_flag_mjs__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./BuildingBlock_no_collision/flag.mjs */ \"./src/BuildingBlock_no_collision/flag.mjs\");\n\n\n\n\n\n\n\n\n // Visuals for the game\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst orbitControls = true;\nlet controls = null;\n\n\nfunction createGround() {\n // Create ground plane\n const groundShape = new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Plane();\n const groundBody = new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Body({ mass: 2, shape: groundShape });\n groundBody.quaternion.setFromAxisAngle(new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Vec3(1, 0, 0), -Math.PI / 2); // Set rotation to align with Cannon.js\n groundBody.position.set(0, 0, 0); // Set position\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world.addBody(groundBody);\n\n // Create visual representation of ground (in Three.js)\n const groundGeometry = new three__WEBPACK_IMPORTED_MODULE_18__.PlaneGeometry(100, 100);\n const groundMaterial = new three__WEBPACK_IMPORTED_MODULE_18__.MeshPhongMaterial({ color: 0x00ff00, side: three__WEBPACK_IMPORTED_MODULE_18__.DoubleSide });\n const groundMesh = new three__WEBPACK_IMPORTED_MODULE_18__.Mesh(groundGeometry, groundMaterial);\n groundMesh.rotation.x = -Math.PI / 2; // Rotate to align with Cannon.js\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(groundMesh);\n}\n\nfunction initCamera() {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Play\",275,175,250,100,\"red\",50,\"white\");\n\n // Init camera\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.position.set(0, 20, 80);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.lookAt(0, 10, 0);\n\n // Change far frustum plane to account for skybox\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.far = 10000;\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.updateProjectionMatrix();\n}\n\nfunction initLights() {\n //Ambient light is now the skybox\n const ambientLight = new three__WEBPACK_IMPORTED_MODULE_18__.AmbientLight(_asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_11__.skybox_texture, 1);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(ambientLight);\n\n //directional light is white to not tint the phong material too much\n const directionalLight = new three__WEBPACK_IMPORTED_MODULE_18__.DirectionalLight(0xffffff, 1);\n directionalLight.position.set(10, 20, 10);\n directionalLight.lookAt(0, 0, 0);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(directionalLight);\n}\n\nfunction initLevel() {\n // const block1 = new BuildingBlock(0, 5, 0, 20, 10, 20);\n // const block2 = new BuildingBlock(20, 0, 0, 50, 10, 20);\n\n // new BuildingBlock(0, 5, 0, 20, 10, 20);\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(0, 9.3, 0, 20, 0, 0);\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(16.5, 2.5, 0, 20, Math.PI, Math.PI / 4);\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(33, -5.2, 0, 20, 0, 0);\n new _BuildingBlocks_Ramp_mjs__WEBPACK_IMPORTED_MODULE_5__.Ramp(53, -5.2, 0, 20, 0, 0);\n\n\n new _BuildingBlocks_MovingPlatform_mjs__WEBPACK_IMPORTED_MODULE_7__.MovingPlatform(73, -5.2, 0, 133, 25.2, 0, 20, 1, 15);\n\n new _BuildingBlocks_BuildingBlock_mjs__WEBPACK_IMPORTED_MODULE_6__.BuildingBlock(153, 20.2, 0, 20, 10, 20);\n // new Cylinder(25, 0, 2, 5, 5);\n new _BuildingBlocks_Iceblock_mjs__WEBPACK_IMPORTED_MODULE_15__.Ice(153, 22.8, -60, 20, 5, 100);\n\n new _BuildingBlocks_BuildingBlock_mjs__WEBPACK_IMPORTED_MODULE_6__.BuildingBlock(153, 20.2, -120, 20, 10, 20);\n new _BuildingBlocks_GolfHole_mjs__WEBPACK_IMPORTED_MODULE_9__.GolfHole(153, 26.2, -120, 1.8, 1, 2.1, 64, 12, 51.2, -5.9, 0, 1, 2, 2, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody)\n let f1 = (0,_BuildingBlock_no_collision_flag_mjs__WEBPACK_IMPORTED_MODULE_16__.flag)(-14,9,-20);\n f1.rotation.y = 30;\n}\n\nlet ballDirectionMesh = [];\nfunction initBallDirectionArrows() {\n let colors = [0xffd000, 0xff9900, 0xff0000];\n for (let i = 0; i < 3; i++) {\n const ballDirectionGeometry = new three__WEBPACK_IMPORTED_MODULE_18__.ConeGeometry(.5, 5, 5);\n const ballDirectionMaterial = new three__WEBPACK_IMPORTED_MODULE_18__.MeshPhongMaterial({ color: colors[i], flatShading: true });\n ballDirectionMesh.push(new three__WEBPACK_IMPORTED_MODULE_18__.Mesh(ballDirectionGeometry, ballDirectionMaterial));\n ballDirectionMesh[i].position.set(5, 30 + 4 * i, 0)\n\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.scene.add(ballDirectionMesh[i]);\n }\n}\nlet time = 0, obx = 0, oby = 0, obz = 0;\nfunction initGame() {\n // initSoundEvents();\n if (_menu_mjs__WEBPACK_IMPORTED_MODULE_3__.menuConfig.showMenu) {\n (0,_menu_mjs__WEBPACK_IMPORTED_MODULE_3__.initMenu)(initLevel);\n } else {\n _menu_mjs__WEBPACK_IMPORTED_MODULE_3__.menuConfig.gameStarted = true;\n (0,_Sounds_mjs__WEBPACK_IMPORTED_MODULE_4__.initSoundEvents)();\n initLevel();\n\n }\n\n // Create ball and attach to window\n (0,_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.createBall)(5, 30, 0);\n\n let groundMesh = (0,_Terrain_Hills_mjs__WEBPACK_IMPORTED_MODULE_14__.createHillsBufferGeometry)(10, 10, 100, 5, 20);\n // Init slider and buttons for firing the ball\n (0,_Terrain_Hills_mjs__WEBPACK_IMPORTED_MODULE_14__.addTreesToGround)(groundMesh, 100);\n\n // Setup camera position\n initCamera();\n\n // Init orbit controls\n if (orbitControls) {\n controls = new three_addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_19__.OrbitControls(_engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera, _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.canvas2d);\n controls.target = _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position;\n controls.maxDistance = 150\n controls.enableDamping = true\n controls.dampingFactor = .1\n if (_menu_mjs__WEBPACK_IMPORTED_MODULE_3__.menuConfig.gameStarted == false) {\n controls.autoRotate = true\n controls.autoRotateSpeed = 0.5\n\n }\n }\n\n // Setup camera position\n initCamera();\n\n initLights();\n\n initBallDirectionArrows();\n\n // Init skybox\n const skybox = new _asset_loading_assets_3d_mjs__WEBPACK_IMPORTED_MODULE_11__.Skybox();\n\n //DEBUG spawn test emitter\n\n let lastDX, lastDY, lastDZ;\n\n // Set custom update function\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.update = () => {\n\n time++;\n controls.update();\n\n //update all particle systems\n (0,_BuildingBlocks_Particle_mjs__WEBPACK_IMPORTED_MODULE_13__.updateEmitters)()\n\n // Update ball mesh position\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.copy(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position);\n\n const bounceThreshold = 3;\n\n function checkBounce(lastVelocities, currentVelocities) {\n return Object.keys(currentVelocities).some(axis =>\n Math.abs(lastVelocities[axis] - currentVelocities[axis]) > bounceThreshold\n );\n }\n\n const currentVelocities = { x: _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.velocity.x, y: _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.velocity.y, z: _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.velocity.z };\n\n if (checkBounce({ x: lastDX, y: lastDY, z: lastDZ }, currentVelocities)) {\n (0,_BuildingBlocks_Particle_mjs__WEBPACK_IMPORTED_MODULE_13__.createNewEmitter)(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.x, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.y, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.z, \"burst\", {particle_cnt: 20, particle_lifetime: {min:0.2, max:0.5}, power: 0.05, fired: false})\n ;(0,_Sounds_mjs__WEBPACK_IMPORTED_MODULE_4__.playRandomSoundEffectFall)();\n }\n lastDX = currentVelocities.x;\n lastDY = currentVelocities.y;\n lastDZ = currentVelocities.z;\n make_the_ball_static_when_is_not_moving();\n\n adjust_the_ball_direction();\n\n show_the_ball_direction();\n\n if(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.y < -50){ //respawns the ball if it has fallen beneath the map\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.set(_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.shotFromWhere.x, _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.shotFromWhere.y, _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.shotFromWhere.z);\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_17__.Body.STATIC\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.isBallShot = false;\n }\n };\n}\n\n\nfunction make_the_ball_static_when_is_not_moving() {\n const velocityThreshold = 0;\n const timeInterval = 10;\n\n if (time % timeInterval === 0 && _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.velocity.length() < velocityThreshold) {\n const groundRay = new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Ray(\n new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Vec3(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.x, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.y - 1.1, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.z),\n new cannon_es__WEBPACK_IMPORTED_MODULE_17__.Vec3(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.x, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.y - 1.2, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.position.z)\n );\n\n const intersect = groundRay.intersectWorld(_engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.cannonjs_world, {});\n\n if (intersect) {\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballBody.type = cannon_es__WEBPACK_IMPORTED_MODULE_17__.Body.STATIC;\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.isBallShot = false;\n }\n\n }\n}\n\nfunction adjust_the_ball_direction() {\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.direction = Math.atan2(_ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.z - _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.position.z, _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.x - _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.camera.position.x);\n}\n\nfunction show_the_ball_direction() {\n for (let i = 0; i < 3; i++) {\n if(_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.isBallShot){\n ballDirectionMesh[i].visible = false;\n\n continue;\n }\n if (ballDirectionMesh[i] !== undefined) {\n // Calculates the needed arrows\n if (i <= Math.floor(Math.abs((_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.power + 20) / 100) * 2)) {\n ballDirectionMesh[i].visible = true;\n\n ballDirectionMesh[i].position.set(\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.x + Math.cos(_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.direction) * 3.5 * (i + 1),\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.y,\n _ball_mjs__WEBPACK_IMPORTED_MODULE_12__.ballMesh.position.z + Math.sin(_firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.direction) * 3.5 * (i + 1)\n );\n\n\n ballDirectionMesh[i].rotation.x = Math.PI/2;\n ballDirectionMesh[i].rotation.y = 0;\n ballDirectionMesh[i].rotation.z = _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_2__.firingTheBall.direction - Math.PI/2;\n\n } else {\n ballDirectionMesh[i].visible = false;\n }\n }\n }\n};\n\nlet game = {\n init: initGame\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/game.mjs?"); /***/ }), @@ -2336,7 +2336,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Menu: () => (/* binding */ Menu),\n/* harmony export */ initMenu: () => (/* binding */ initMenu),\n/* harmony export */ menuConfig: () => (/* binding */ menuConfig)\n/* harmony export */ });\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ \"./src/utils.mjs\");\n/* harmony import */ var _Sounds_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Sounds.mjs */ \"./src/Sounds.mjs\");\n/* harmony import */ var _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./firingTheBall.mjs */ \"./src/firingTheBall.mjs\");\n\n\n\n\n\n\nfunction initMenu(onPlayButtonCB) {\n let menu = new Menu();\n // Set custom draw function\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.draw2d = (() => {\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.context2d.clearRect(0, 0, _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.canvas2d.width, _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.canvas2d.height);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.context2d.strokeRect(0, 0, canvas2d.width, canvas2d.height);\n menu.draw()\n });\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.onmouseup = ((e) => {\n let mouseX = e.clientX;\n let mouseY = e.clientY;\n if (!menuConfig.gameStarted) {\n if ((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.areColliding)(mouseX, mouseY, 1, 1, 275, 200, 250, 100)) { //Play\n //initGame();\n onPlayButtonCB();\n menu.startSimulation();\n }\n if ((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.areColliding)(mouseX, mouseY, 1, 1, 175, 475, 200, 75)) { //Music\n menu.toggleMusic()\n }\n if ((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.areColliding)(mouseX, mouseY, 1, 1, 425, 475, 200, 75)) { //Sfx\n menu.toggleSfx()\n }\n }\n })\n return menu;\n}\n\nclass Menu {\n constructor(){\n }\n draw(){\n if (!menuConfig.gameStarted) {\n //play button\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Play\", 275, 175, 250, 100, \"red\", 50, \"white\");\n //skins button - no functionality\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Skins\", 275, 300, 250, 100, \"red\", 50, \"white\");\n //music toggle button - should be replaced with icon\n if (menuConfig.musicEnabled) {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Toggle music\", 175, 475, 200, 75, \"red\", 30, \"white\");\n } else {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Toggle music\", 175, 475, 200, 75, \"grey\", 30, \"white\");\n }\n //SFX toggle button - should be replaced with icon\n if (menuConfig.sfxEnabled) {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Toggle SFX\", 425, 475, 200, 75, \"red\", 30, \"white\");\n } else {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Toggle SFX\", 425, 475, 200, 75, \"grey\", 30, \"white\");\n }\n } else if(isWinner) {\n // TODO: for some reason - this does nothing\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"You Win\", 275, 175, 250, 100, \"red\", 50, \"white\");\n }\n }\n startSimulation(){\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.context2d.globalAlpha = 0;\n menuConfig.gameStarted = true;\n if(menuConfig.musicEnabled){ //there is no pause menu so this should work for now\n (0,_Sounds_mjs__WEBPACK_IMPORTED_MODULE_2__.playMusic)();\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_3__.firingTheBall.initUI();\n }\n }\n toggleMusic(){\n menuConfig.musicEnabled = !menuConfig.musicEnabled\n }\n toggleSfx(){\n menuConfig.sfxEnabled = !menuConfig.sfxEnabled\n }\n}\nlet isWinner = false;\nlet menuConfig = {\n gameStarted: false,\n setGameWon: ()=>{isWinner = true;},\n musicEnabled: true,\n sfxEnabled: true,\n showMenu: true\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/menu.mjs?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Menu: () => (/* binding */ Menu),\n/* harmony export */ initMenu: () => (/* binding */ initMenu),\n/* harmony export */ menuConfig: () => (/* binding */ menuConfig)\n/* harmony export */ });\n/* harmony import */ var _engine_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine.mjs */ \"./src/engine.mjs\");\n/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.mjs */ \"./src/utils.mjs\");\n/* harmony import */ var _Sounds_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Sounds.mjs */ \"./src/Sounds.mjs\");\n/* harmony import */ var _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./firingTheBall.mjs */ \"./src/firingTheBall.mjs\");\n\n\n\n\n\n\nfunction initMenu(onPlayButtonCB) {\n let menu = new Menu();\n // Set custom draw function\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.draw2d = (() => {\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.context2d.clearRect(0, 0, _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.canvas2d.width, _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.canvas2d.height);\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.context2d.strokeRect(0, 0, canvas2d.width, canvas2d.height);\n menu.draw()\n });\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.onmouseup = ((e) => {\n let mouseX = e.clientX;\n let mouseY = e.clientY;\n if (!menuConfig.gameStarted) {\n if ((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.areColliding)(mouseX, mouseY, 1, 1, 275, 200, 250, 100)) { //Play\n //initGame();\n onPlayButtonCB();\n menu.startSimulation();\n }\n if ((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.areColliding)(mouseX, mouseY, 1, 1, 175, 475, 200, 75)) { //Music\n menu.toggleMusic()\n }\n if ((0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.areColliding)(mouseX, mouseY, 1, 1, 425, 475, 200, 75)) { //Sfx\n menu.toggleSfx()\n }\n }\n })\n return menu;\n}\n\nclass Menu {\n constructor(){\n }\n draw(){\n if (!menuConfig.gameStarted) {\n //play button\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Play\", 275, 175, 250, 100, \"red\", 50, \"white\");\n //skins button - no functionality\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Skins\", 275, 300, 250, 100, \"red\", 50, \"white\");\n //music toggle button - should be replaced with icon\n if (menuConfig.musicEnabled) {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Toggle music\", 175, 475, 200, 75, \"red\", 30, \"white\");\n } else {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Toggle music\", 175, 475, 200, 75, \"grey\", 30, \"white\");\n }\n //SFX toggle button - should be replaced with icon\n if (menuConfig.sfxEnabled) {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Toggle SFX\", 425, 475, 200, 75, \"red\", 30, \"white\");\n } else {\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"Toggle SFX\", 425, 475, 200, 75, \"grey\", 30, \"white\");\n }\n } else if(isWinner) {\n // TODO: for some reason - this does nothing\n (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.createButton)(\"You Win\", 275, 175, 250, 100, \"red\", 50, \"white\");\n }\n }\n startSimulation(){\n _engine_mjs__WEBPACK_IMPORTED_MODULE_0__.engine.context2d.globalAlpha = 0;\n menuConfig.gameStarted = true;\n if(menuConfig.musicEnabled){ //there is no pause menu so this should work for now\n (0,_Sounds_mjs__WEBPACK_IMPORTED_MODULE_2__.playMusic)();\n _firingTheBall_mjs__WEBPACK_IMPORTED_MODULE_3__.firingTheBall.initUI();\n\n }\n }\n toggleMusic(){\n menuConfig.musicEnabled = !menuConfig.musicEnabled\n }\n toggleSfx(){\n menuConfig.sfxEnabled = !menuConfig.sfxEnabled\n }\n}\nlet isWinner = false;\nlet menuConfig = {\n gameStarted: false,\n setGameWon: ()=>{isWinner = true;},\n musicEnabled: true,\n sfxEnabled: true,\n showMenu: true\n}\n\n\n\n//# sourceURL=webpack://gamedev-engine/./src/menu.mjs?"); /***/ }), diff --git a/src/firingTheBall.mjs b/src/firingTheBall.mjs index 004a6a6..64b63ea 100644 --- a/src/firingTheBall.mjs +++ b/src/firingTheBall.mjs @@ -82,7 +82,7 @@ function shoot() { ballBody.type = CANNON.Body.DYNAMIC; } - let calPower = firingTheBall.power*10; + let calPower = firingTheBall.power; let calDirection = firingTheBall.direction; let impulse = new CANNON.Vec3(Math.cos(calDirection) * calPower, 0, Math.sin(calDirection) * calPower); diff --git a/src/game.mjs b/src/game.mjs index 2420c5b..58b83ec 100644 --- a/src/game.mjs +++ b/src/game.mjs @@ -108,9 +108,9 @@ function initGame() { menuConfig.gameStarted = true; initSoundEvents(); initLevel(); - firingTheBall.initUI(); } + // Create ball and attach to window createBall(5, 30, 0); diff --git a/src/menu.mjs b/src/menu.mjs index b0d7d5b..60ef9c6 100644 --- a/src/menu.mjs +++ b/src/menu.mjs @@ -64,6 +64,7 @@ class Menu { if(menuConfig.musicEnabled){ //there is no pause menu so this should work for now playMusic(); firingTheBall.initUI(); + } } toggleMusic(){